Opening a Word Document with a Java program in Windows

When running a Java program in Windows, is it possible to have a button where when it is clicked it will open a Word document?
If so, is it hard and can someone tell me how to do it??
Thanks

try this instead of Excel.exe you have to use Word.exe
1. Declare your button
               JButton butexlcom = new JButton("Carnet Offre");
               butexlcom.addActionListener( new ButExlCommercial(msgout));
               butexlcom.setBounds(215,510,110,30);
               c.add( butexlcom );
2. run your word document.
class ButExlCommercial implements ActionListener {
     private JTextArea msgout;
     public ButExlCommercial( JTextArea msg) {
     msgout = msg;
     public void actionPerformed( ActionEvent e ) {
          try {
               Runtime.getRuntime().exec("c:\\Program Files\\Microsoft Office\\Office\\Excel.exe NameWordDocument");
          catch(Exception en) {
               msgout.append( "\n*** PROBLEME WORD ***\n" );
}

Similar Messages

  • Open a word document from a Java Application

    Hi,
    Can I open a word document from a java GUI apllication and point to a bokkmark automatically in the word document when opened.

    See this thread:
    http://forum.java.sun.com/thread.jspa?threadID=228332&messageID=810684

  • Opening PC WORd documents with AW

    I am new IMAC user. Unfortunately salesman (Best Buy) told me that a word processor and spread sheet were part of the software package! I want to buy AW (sounds like a great program and my son loves it), but need to know how to open PC Word documents from email. Will I be able to do this?
    Thanks.

    As Roger said, AppleWorks may not open newer Word & Excel files, from a PC or Mac. In the past, AppleWorks 6 was able to open almost all Word & Excel documents, it is not able to open those saved with newer versions of either Mac or PC application. The Office translators in AppleWorks were introduced in late 2000 or early 2001 & have not been updated. In the meantime, Microsoft has made significant changes in the file formats in the last year or two that AppleWorks can't open them any more. AppleWorks 6 was released in March, 2000, & hasn't even had any kind of update since January, 2004.

  • Word Document generation using Perl programming on Windows Server 2003 R2

    Hello,
    Our application generates word document based on pre-defined template on Windows Server 2003 using Perl Scripting.
    Configuration data is fetched from the database and document is populated based on the template. Sections in the document are identified using Bookmarks. We are facing a problem on Windows server 2003 R2. When I do a group update operation, i.e generation
    of multiple word documents (using Word 2010) in a loop, one of the section of the word document shifts up  and data gets overlapped.
    When I use the same piece of code in windows 7 machine, the issue doesn't replicate.
    Can anyone provide some pointers to look into this issue ?
    Regards
    Prashant Jain
    software developer

    Hi,
    This forum is mailly talk about the product use related issue and not the best place to talk about the develop issue, for the develop issue we can post in MSDN forum for the further help.
    MSDN forum
    https://social.msdn.microsoft.com/Forums/en-US/home
    Thanks for your understanding and support.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Office Web App 2013 : Compatibility issue after opening a word document with image from sharepoint 2013

    Hi,
    Uploaded a word doucment in sharepoint 2013 and When we open it in WebApp2013 then following compatibilty warning is reflecting.
    "Compatibility Mode Functionality is currently limited"
    how to supress this warning message ?
    Thanks.
    raj

    Hi,
    As I understand, you would like to insert document preview in Iframe, here is an article which describe about Document preview function for your reference:
    http://community.obilogic.co.uk/blogs/teamblog/archive/2014/01/23/sharepoint-2013-custom-callout-with-file-preview.aspx
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Opening Word documents with Appleworks

    I often receive Word documents as email attachments (though my hotmail account). I can download these Word documents to my desktop but when I click on them to open them I get an offer to purchase MS Word (which I do not have). I would like to be able to simply open the Word documents with Apple works--and I am hoping I can just click on them and have that happen automatically. But it doesn't. I have tried opening Appleworks and going into the wordprocessing program and then opening the Word document through that, but it only is successful part of the time. What can I do? I would like to have these Word douments open automatically in Appleworks but every time I click on them (i.e., their icon on my desktop) I get that advertisement from Microsoft asking me to buy Word. Is this ad blocking a normal function of Appleworks that would otherwise allow me to open Word documents with a click? And in any case, how can I proceed?

    The ad for Word is almost certainly being tacked on through or at Hotmail (taglines or adware from Hotmail? Hoodathunk .....) ; it sure isn't coming from AppleWorks or from anything on your own system, unless you have that demo copy of Office still lurking somewhere. I suppose it could come from that, somehow.
    Assuming you can get a clean attachment downloaded to your Desktop from Hotmail, the procedure for having what you want to happen automatically is fairly straightforward and, really, has nothing at all to do with Appleworks. Try the following:
    --> Select (highlight) one of those downloaded .doc files from Word, then
    --> use the Finder's Get Info command (⌘-I). In the window which appears,
    --> see the "Open with" section, and set it to AppleWorks.

  • Opening a word document in Java

    HI
    I am new to java. I am trying to open a word document when user press the button. I just want to open the document that exists on my computer. I have tried using exec() method of Runtime class. But I was not succeed. Here the code that I have used.
    public void actionPerformed(ActionEvent ae)     {
         String str = ae.getActionCommand();
         if(str.equals("Search")){
              Runtime r = Runtime.getRuntime();
              Process p = null;
              try{
                   p = r.exec("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe C:\\Resume\\coverletter.doc");
              }catch (IOException e){
                   System.out.println("Error");
    repaint();
    Here "Search" is th name of Button.
    So if anyone have a solution please help me regarding to this.
    Thank you

    Use java.awt.Desktop (available since Java 6), it provides a .open() method that will open any file with the users associated application (so no dangerous hardcoding of application paths necessary).
    If you insist on using Runtime.exec, then you must read [When Runtime.exec() wont|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html].

  • Can't open Project Server 2013 word documents with office 2010 installed

    hello forum members,
    we having issues opening a word document in a Project Server 2013 . we have Office 2010 on our computers installed. 
    when I click on a document link, i get a message "The webpage cannot be displayed".  the only way to open a document is to right click on link and select "Open". 
    Does Project Server 2013 require Office 2013 installed? If not, is there a way to open documents in Project Server 2013 without right clicking on links?
    tatiana
    tatiana

    Hi Tatiana,
    This is the know issue. I have experienced this issue with one of our client. The cause of issue as below -
    Scenario
    You have 2007 Microsoft Office installed on a computer.
    On the same computer, you also have a Microsoft Office 2013 application installed, such as Microsoft Lync 2013 or Microsoft Word 2013.
    SOLUTION
    To work around this issue, remove the Microsoft SharePoint Foundation Support program component from the Office 2013
    installation on the affected computer or computers. To do this, follow the “Install or remove individual Office program components” section of the following Microsoft Office website:
    Install or remove individual Office
    programs and components
    (http://office.microsoft.com/redir/HA010354261.aspx)
    After you complete these steps, repair 2007 Office. For more information about how to repair the installation, click
    the following article number to go to the article in the Microsoft Knowledge Base:
    924611
    (http://support.microsoft.com/kb/924611/ )
    How to install the individual 2007 Office features or to repair the installed 2007 Office programs
    Note When
    you follow these steps, set the Microsoft SharePoint Foundation Support
    component within Office Tools to Not Available.
    This solution doesn't apply to scenarios in which SharePoint Designer 2013 is installed on the affected computer.
    You can find further details here at Microsoft support site -
    http://support.microsoft.com/kb/2888015
    Hope this helps you.
    Cheers, Badal

  • I recently updated to the OSX 10.8.3 Operating Sistem.  I am writing a book and now cannot open any word document I've created.  Could not find a newer version of the Microsoft Word Processing Program.  Is Pages the next thing? Can I recover my documents?

    I recently updated to the OSX 10.8.3 Operating Sistem.  I am writing a book and now cannot open any word document I've created with the old system.  Could not find a newer version of the Microsoft Word Processing Program.  Is Pages the next thing? Can I recover my documents?  How?

    I'm in the same boat: new to OS X and Mac, and in the middle of a book. I switched because I heard about the the ease of using Mac, but so far, for me, it's been a nightmare. I bought 2011 Office Mac and hate everything about it, the most recent being the inability to open or cut or paste any of my original word files. I understand that this could have easily been done with earlier versions, but not Mountain Lion (which I learned is what OSX is.) Since I work with language, I am amazed at the assumptions of the Apple community. It helps to use common language and explain even the basics.  
    So all the helpful hints to use the latest version of Office Mac are to no avail. Now what?

  • I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    The template is a document in itself, it is not applied to an existing document whether it is a Pages document or a Word document converted to a Pages document.
    You would need to either copy and paste content, using existing styles, or apply the styles to the converted Word document.
    You can Import the Styles from an existing document and those imported Styles can be used to override the current document's styles:
    Menu > Format > Import Styles
    The process is simplified if the styles use the same names, otherwise you will need to delete the style you don't want and replace it with the one that you do want when asked, then the substitution is pretty straightforward.
    Peter

  • I saved a word file onto my imac.  when i go to open file in documents with pages the file is grey and unable to open.  the workable files are highlighted in bold.  is there a way to open this file????

    i saved a word file onto my imac.  when i go to open file in documents with pages the file is grey and unable to open.  the workable files are highlighted in bold.  is there a way to open this file????

    THis is safe for Mac's? Sorry, I have just never heard of this site before.
    And there are literally tens of thousands of sites of which I've not heard, too. Not this one.
    It's legit. There are lots of links in Apple Support Communities to the LibreOffice web site, as well as others that are legitimate open-source developers of options to buying MS Office, such as NeoOffice and OpenOffice. I have Open Office installed on one of my older Macs that can't run Office 2011 and it is rock-solid.
    I've been here too long to start posting bogus urls now.

  • Got errors when trying to open word document with Office Web App Server and customized WOPI host

    I am configuring the Office Web App Server with our ASP.NET MVC WOPI host based on this example. https://code.msdn.microsoft.com/office/Building-an-Office-Web-f98650d6. While both the OWA server and WOPI server has been set up and I can use Excel and PowerPoint
    app to open and edit xls and ppt file now, there are problems opening word documents no matter I enable or disable the editing function of OWA server.
    When I open a word document while enabling editing I got this error:
    If I disable editing I got this message:
    I have tried several file so I thought it is not the files' problem. Also I didn't find any exception in the log of OWA server. 

    Hi Gary Jiang,
    Thanks for posting in MSDN forum.
    This forum is for developers discussing issues about
    apps for Office.
    Based on the description, it seems that you got an issue when you deploy the code sample. If I understood clearly, I suggest that you contact the author of the code sample from the "Q and A" tab.
    Also if you have the question about WOPI, I suggest that you get more effective response from
    Office
    Protocols forum.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I open a word document in C++ with a CNiWordApplication object?

    Hello,
    For an application, i need to open a word document using VisualC++ and CNiWord classes (CNiWordApplication, CNiWordDocument...). I successed to create a new CNiWordDocument with the CNiWordApplication CreateDocument() function. But when using the OpenDocument() I have error message about violation error. Must I create another objet before calling the OpenDocument() function? Is it possible to have an example of code to open a word document?
    Thank you for your help.

    I tried the following code to open a doc file in an MFC application.
    CNiWordApplication word;
    CNiWordDocument doc = word.OpenDocument("c:\\books.doc");
    This worked fine for me. I tried this with Word 2003 and Measurement Studio 7.1
    Try running one of the shipping examples. You can find examples for this under ..\MeasurementStudio\VCNET\Examples\Office\
    Hope this helps.
    Bilal Durrani
    NI

  • Opening word document with linked PPT inside

    Hi everybody,
    this is an error occuring using KM functionality, which could also be cause by the local Microsoft environment, but perhaps anybody knows this ...
    We are using EP 6.0.2.4.8 with CM 6.0.2.4.6
    In several KM navigation iviews we have linked folders from a file system repository with word documents inside. Users have problems opening the word documents which have powerpoint files linked inside the document. The powerpoint files are not embedded, but linked and shown as object (not as symbol or hyperlink).
    This means: word document is openened via http://<portal>/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/<folder>/<file>.doc
    The PPT linked inside leads to
    <fileserver>\<share>\<file>.ppt
    In some user environments (depending on local security policies(?) and local user/word options) word tries to automatically refresh the linked objects and then word crashes with an exception.
    So far, a Microsoft problem, but:
    when I copy the same word document to a simple IIS webserver an open it, the file is opened properly ...
    Is this problem known somewhere? As it is a local application error, I do not get any error in the portal logs ...
    Best regards,
    Martin

    Hello,
    Thanks for your answer. Since I work at a customer's office, I couldn't reply before because it took me some times to perform the tests.
    I tried to embed the images in Word before importing the document into Robohelp 8. The problem remains. RH creates the images into a new folder (and names the images "image001", "image002", and so on). Therefore, the link with the original images is lost.
    So, if we modify the image linked to the Word document, we are obliged to apply the same changes in the images created by RH.
    The idea would be to have only one image folders used both by RH and Word so that if we change our images, the changes apply in all our files.
    This option was available in RH x5.
    Best Regards,
    Isabelle

  • Create Word document with Java

    I want to create a Word Document with Java. But I don't know how can I insert text in a Word document.

    I searched and found JXWord (probably limited to Windows): http://www.geocities.com/picmapicma/
    I'm interrested to know if it works fine...:)

Maybe you are looking for

  • XI Message Mapping - Old version gets picked up

    Hi All, I changed XI message mapping in my BPM. Sometimes changed mapping gets called and things work correctly. However, most of the times, older version of mapping gets called and program works the old way. I refreshed the cache in SXI_CACHE. But t

  • BEX Query Changes are not Reflecting in WAD

    Hello SDN Experts, I'm  Facing a Typical Weird Issue. We got an Requirement to Create a New Variable in a Exisitng BEX Query. Assume that we have already a Variable on 0VENDOR. So I have Removed that Variabale and Added new Variable which was created

  • ADF  Page Web service Data Control

    Hi, I am using JDeveloper 11.1.1.3 I am trying to create a WSDC from an URI using WSDC Wizard(File --> New --> Web Services --> Web Service Data Control) It lets me through the last page, When i click finish it is throwing the following error I am ge

  • Saved images do not appear in Photos app on iPad

    I saved some pictures (attached in mails) on my iPad. But when I opened Photos to view them, I could only see the thumbnails, the screen was totally blank as I tapped on them for larger view. Any advice please? It has just happened since 2 days ago.

  • My iphone 3gs turns off frequency by itself after i updated to 4.3.1

    My problem is after I updated my iphone 3gs to 4.3 version it turns off automatically within 2.3 minutes even with full battery and I have to press home and power key to turn it on. But weird thing is that if I use my iphone to play games or listen t