Calling Microsoft Word in Java

I am new to Java. I would like to know is there any way that I can invoke Word or Excel application in my Java program? If yes, how? Thank you in advance for your help.

Use Runtime.getRuntime().exec("..."), where the string could be word.exe etc.

Similar Messages

  • Invoking Microsoft Word from Java code

    I want to invoke Microsoft word from Java code. How can i do this plz ............... Help

    do something along these lines.... here is an example with notepad
    create a .bat file with the commmand in to run notepad for example
    notpad c:\test.txtthis command calls notepad and passes it the argument C:\test.txt which is the file and it's location, that I want to open.
    The Java program
    import java.util.*;
    import java.io.*;
    public class Run
    public static void main(String args[])
        try
           //the name of the batch file with your commands in
           String command ="runprog.bat";
           //get the runtime 
           Runtime rt  = Runtime.getRuntime();
           //run the bat file  
           Process proc = rt.exec(command);
          //wait for the program to exit i.e notepad then get the return code
          int exitVal = proc.waitFor();
          //print out the exit value
          System.out.println(2THe Process exit value is: " + exitVal);
      catch(Throwable t)
         t.printStackTrace();
    }have a look at this
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    and this
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html

  • Interaction with Microsoft Word using Java Programming

    writing Text ON TO MICROSOFT WORD USING java Programming Urgently required

    Go throuh jakarta POI(hssf) to do..No! HSSF which stands for Horrible SpreadSheet Format can be used for Excel (spreadsheets as the name suggests). For Word, you would need to lok at HPSF.

  • Embedding Microsoft Word in Java

    Hi,
    i want to embed Microsoft word in my java application. Can anyone one tell me how to embed word in java. By embedding, I don't mean to invoke word from java. I want to use word as an editor in java.
    Thanks,
    Ashu

    COM-JAVA bi-directional bridge can be used to transfer calls between Java-COM-Java. Almost all the MS products come as COM Components which by COM specifications can be reused or upgraded with out any need for recompilation.
    By using bi-directionaly bridge we can make such a way that Word is extended from Canvas and add to any java component. All the connection points (In COM Tech, Connection points are used for event firing) can be converted as events and methods calls can be directed thru bridge.
    I checked out JIntegra. Its good and working fine. They give u a limited time evaluation version and after that you have to pay. Check out JIntegra at linar.com
    Check this thread for a sample code. It shows how I can use IE in panel.
    http://forum.java.sun.com/thread.jsp?forum=57&thread=143800
    Good luck,
    Mohan

  • Calling Microsoft word speech in LabVIEW through ActiveX

    hi
    Yesterday i had posted 1 question , how to get the output of some other programme in LabVIEW. Well. i have found out the answer. This can be done by using ActiveX. For this the programme also must be ActiveX enabled.
    I wanted to use the microsoft Word Speech in labVIEW through ActiveX.Since microsoft word is also ActiveX enabled, this can be called.
    But the question is HOW????????
    Help me out of this
    Somil Gautam
    Think Weird

    If you want to give voice commands to LabVIEW, you might want to read this blog
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Webutil failed to call microsoft word

    I have installed webutil and it works fine.I can run the
    webutil_demo except failed to write something to word.
    please help.
    console shows:
    at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    Thanks Andres!
    I have confirmed that the following instructions does allow you to use Word 2010 32-bit running on Windows 7 64-bit or Windows Server 2008 R2 to edit company
    knowledge...
    1. Go to the directory where the OpsMgr console is installed (example: C:\Program Files\System Center\Operations Manager 2012\Console )
    2. Make a copy of Microsoft.EnterpriseManagement.Monitoring.Console.exe.config
    3. Edit Microsoft.EnterpriseManagement.Monitoring.Console.exe.config using Administrator rights
    4. Search for “</dependentAssembly>” and remove the “<publisherPolicy apply="no" />” line immediately following the “</dependentAssembly>” line
    Hope this helps!
    Regards,
    JJ
    Well, firstly I have to agree with other people's comments along the lines of "It shouldn't be this hard!", but I can happily say that the solution above (by IM5FOOTNOTHIN)
    worked for me...once I noticed this crucial footnote: "Do this for
    ALL instances of the
    <publisherPolicy apply="no" /> line that immediately follow the </dependentAssembly> line"

  • Microsoft Word to Java

    Yes I checked Google, yes I checked these forums and so on. Basically, what I'm trying to do is read in a word file, check for certain words (its a code that users will write in the word document) and then check those codes to see if they match a code in a text file (most likely another word document) and then append to that code the description that follows the matching code from the database to the existing word document.
    I found the POI project, which seems to be feasible, but I was just wondering if you guys are aware of this (because I need to give an answer to work to see if it's possible soon) and if it is possible, how long is it going to take me to do it.
    So what I'm looking for essentially is :
    -Read Word file
    -search through it for specific words
    -run those words through the database to find the corresponding one
    -append the description from the database to the code inside the word file
    -the database is most likely another word file.
    So do you think it would work with POI? J-Integra costs money so that is a no dice.
    And it isn't a one time thing, people will be using it later on.
    I'm thinking executable jar, but I can take care of that.
    Comments/experience/suggestions are welcome, thanks.

    Actually I need something that can be distributed to
    alot of computers, and right now for POI to work I
    need ANT and forrest. Things that I am not too
    familiar with and don't have time to either. This has
    to be user friendly and editable.
    I wrote a Macro that saved the doc file into xml to a
    specific location with a specific name. I'm going to
    have an executable jar and the user just has to click
    it and enter the keyword they are looking for. ( I
    made an applet due to userfriendly-ness). Afterwards,
    I'm going to make it convert back to doc (I'm still
    working on that, probably another macro.). All in
    all, this is my solution since the exporting to xml
    is clean (the interface, not the code).
    And since converting back to doc from xml is almost
    flawless (with the type of documents I'm using) it
    works perfectly for MY needs.
    Anyways, that's all I did. POI looks like a hassle
    and a half to go through.Well, it all depends on the circumstances. I've seen this kind of thing come up before, where a circuitous route is taken to convert from one format to the other. If you know it's not going to change in the future, and you can conrol the environment, it may make sense.
    The danger is that if there's a lot of users, you now have to support the code itself, the macro, hope that there aren't MS Word version issues, JVM issues with MS vs. Sun, JVM version issues, etc. Personally, I'd either use WebStart or a web app so you can control the environment, and then I'd wire in POI. It's more development up front, but can potentially save you a lot of headache down the road.
    But as I said, your mileage may vary, consult a doctor if itching persists, etc. Good luck!

  • OLE2: Calling Microsoft Word from Forms

    I am writing an Forms application which requires me to be able to open a Word template file; then replace the bookmarks in the template with data from an oracle database; then to save and print the Word document.
    I know I can do this using the OLE2 package, but I don't know how to. Does anyone know where I can find a good source of information showing actually how to do it, the standard Oracle documentation is syntax only, I could do with some example code, etc.
    Thanks
    Nik

    Hi there,
    You can take a look at the samples-forms. When you install Forms you can install demos too. One of those demo-forms shows how to use Forms and Word through OLE2. For ths source you can take a look within the FMB file.

  • Access microsoft word doc using java

    how can i access microsoft word using java .
    I want to select text from the word in the same format as it is.
    if possible can u all help me

    By using an appropriate library. JText, whatever.
    Google, man.I think Rene meant iText!Whatever. :) Never used it, I just remembered there was something named like that. Thanks.

  • How do I Launch a Microsoft WORD Document using AciveX from testStand

    Hello All:
    I would like to launch a Word document from within Teststand. I would also like to have the ability to search the document for particular sections of the document. I can not find any sequence file examples that even comes close to demonstrating any of this.
    Thanks...

    Hello Craig,
    I have attached an example that will demonstrate this for you. You may need to change the Word Server to match the version of Word that you have installed. This can be done by right clicking on each ActiveX step and select Specify Module. Under Automation Server, scroll down the list to Microsoft Word... and select it.
    This is primarily an example to demostrate calling Microsoft Word from TestStand. If you require additional functionality from the Microsoft Word ActiveX server then you should refer to the API reference help for Microsoft Word.
    Hope this helps!
    Bob
    Attachments:
    TSWord.zip ‏7 KB

  • HELP : Microsoft word on mac

    Dear all,
    i need to work on microsoft word, and i use imac working on mac os 10.6
    is there any microsoft word application for it ??

    is there any microsoft word application for it ??
    Yes.. It's called Microsoft Word.
    If you have further questions regarding Word, please post them on Microsoft's Mac forums:
    http://www.officeformac.com/productforums

  • Searching a string in Microsoft word from a Jav Application

    Would appreciate if you could provide me with an example/ suggestion to search for a string in Microsoft Word document from a java aplication. Thanks

    Short and rude answer: STFW.
    Long and polite answer: If you use "java apache word excel" as the criterium to search the web with Google, the first hit is what we are looking for:
    http://jakarta.apache.org/poi/
    Good luck anyway!

  • Printing a microsoft word doc using Java Print API

    Hi,
    I have to print a microsoft word doc.I am using Java Print API, but the code is printing only Hashcodes instead of the actual document.
    Here is the code. Please let me know whats wrong in it.
    CODE:::
    public String print() throws Exception {
    String realPath = getRealPath("/images/formLibrary/csaAddressContactRequestForm100.doc");
    PrintRequestAttributeSet pras1 = new HashPrintRequestAttributeSet();
    DocFlavor flavor1 = DocFlavor.INPUT_STREAM.AUTOSENSE;
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    DocPrintJob job = defaultService.createPrintJob();
    FileInputStream fis1 = new FileInputStream(realPath);
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc1 = new SimpleDoc(fis1, flavor1, das);
    job.print(doc1, pras1);
    Thread.sleep(10000);
    System.exit(0);
    return "";
    }

    By using an appropriate library. JText, whatever.
    Google, man.I think Rene meant iText!Whatever. :) Never used it, I just remembered there was something named like that. Thanks.

  • Connecting Java Application with Microsoft Word Toolbar

    My project involves designing a GUI with which I will use Java for. And I also have to create a Microsoft Word Toolbar that will open the Java GUI. There will be other interactions between both the GUI and the toolbar.
    Is that possible? Or shall I use Visual Basic or .NET for the GUI?
    Advice appreciated please!

    hi
    check this
    http://help.sap.com/javadocs/NW04/current/bi/docs/connectors/sapq_howto.html
    let me know am i reached ur  point
    bvr

  • Can JAVA read Microsoft word document?

    Hi
    I am trying to make a program that read a word document, and split the document in to each pages and save each pages with file as it's footer of each pages.
    --- example-----
    test.doc
    Page 1 |
    |
    |
    |
    |
    |
    footer - hi |
    Page 2 |
    |
    |
    |
    |
    |
    footer - test |
    Page 3 |
    |
    |
    |
    |
    |
    footer - still |
    Page 4 |
    |
    |
    |
    |
    |
    footer - hahaha |
    Page 5 |
    |
    |
    |
    |
    |
    footer - lastpage |
    -----------------------> Out put of the program
    hi.doc , test.doc, still.doc, hahaha.doc, lastpage.doc
    Is there any way to import word document and process like that above?
    I have searched about this, and found out 'Jakarta POI' can access to word document but with many restrictions. (I heard it doesn't support word version 2003 and 97)
    Can any one please answer this?
    Thankx

    I'm not really sure that java is the best language to use for this particular project. I haven't looked into writing a standalone application to do this sort of thing, but Microsoft Word has a built in VB editor that allows you to write scripts that will do this very simply, using Word's Document Object Model.
    I would imagine the same sort of the thing could be done from a Stand-alone aplication as well, but you might need some libraries for reading the document and obtaining the object with the same model. I would look into Microsoft's .net solutions for this one. You might even be able to work out a solution in C++, C#, or even J# (which I understand is "similar" to java), if you don't know visual basic.
    It is possible that there is a library out there that will read a Word Document, and create the appropriate Java object with the same object model, but I don't know where it can be found.
    Anyway, if the option is available to you, take a look at Microsoft's .Net. You'll probably have more luck that way. Good Luck!

Maybe you are looking for

  • How to remove Built-in-Fields from Report builder report

    I have create SSRS report which is sending email to recipient but at the bottom of report email I am also getting  report accessible address. I don't want to send that address to recipient. How should I remove from report builder? The report is acces

  • How can I erase text from a PDF?

    how to erase text from a pdf

  • BEA-010051 EJB Exception occurred during invocation from home:

    Hi, I am getting this exception (below)in the production env. the process is every night my application would load the data which is present in a perticular folder in to the database. After this process has continued for some days this error comes. T

  • App crashing at launch after update... (app store bug?)

    okay this might be it ... I read a couple of articles earlier today reporting app store issues like here: http://www.pcmag.com/article2/0,2817,2406710,00.asp ... so a couple of minutes ago I updated an

  • Organisation data determination

    hai guys,           can any one help me how to get both the sales and service organizational data in a service transaction through org data determination.                       thanks in advance krishna prasad