Processing MS-Word Dosument in Java

Hi all,
Is there is any APIs available in java for processing and extracting the content from a MicroSoft Word Document ?

POI http://jakarta.apache.org/poi/index.html
OOo http://www.openoffice.org (no idea where, never used)
Or get your users to save as RTF and use javax.swing.text.rtf.RTFEditorKit.
Search the forums for more info, this question has been asked twice today!

Similar Messages

  • Read and Process Microsoft Word's Form

    Hi,
    Is there any WDP API or open source Java API to read and process Ms Word's Form, such as input field, pull down list etc.? I know of POI's HWPF, but it can only do some basic Word processing.
    Thanks.
    - julius

    JAWIN or NEWJAWIN!!!!
    newjawin consists of a java-com-codegenerator, which generates Java-Proxy-classes for COM-components like MS Word, Excel, ...
    1. download newjawin
    2,. start codegenerator (exe)
    3. choose COM-Component (f..e. winword.exe)
    4. press "generate"-Button
    5. Use Javaproxyclasses to access full MS Word
    Or you can use a commercial software like J-Integra that provides ready-to-use Java API to access Word. The benefit of using this tool  is that it exposes all the formatting tools Word provides like adding header, footer, page numbers, tables, etc. Also, if you require user interaction to manipulate the Word document, you can listen to Word events from your Java program and implement event handlers accordingly.

  • 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...:)

  • Writing to word document using java

    hi,
    i want to retrieve the values from database and then write to .doc file. how can i write to a word document using java?
    thanks in advance

    Google for "java write to word file"
    and behold the magic results

  • Uplod word file from java

    how we upload word file from java web page?? pls is urgent.

    > i not understand. pls explain?
    Ok. Take a look at the Fundamentals-forum where your post is in. If you look at the 30 most recent threads there are more tthen 10 thread about uploading files. A couple of those have some usefull answers which you probably can use.
    It's always a good habit to search a forum first before you post your question.
    Good luck.

  • Api POI read and replace my word document with java

    Hi
    Everyone
    I�d like to know if someone has a piece of code reading a word document with api POI to send me?
    I need read replace the word document wiht java j2ee.
    Thanks

    Hello,
    You have to use the Office Integration Library. Please, follow the documentation below:
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/32853febec3c17e10000000a114084/frameset.htm
    I hope this helps you.
    Regards,
    Blanca

  • How To Create MS-Word Document in JAVA ?

    I want to create a MS-Word Document using JAVA.
    then i want to create table in that document.
    is there any way through which i can create a Object of MS-Word in JAVA.

    As far as I know. There is no support. And you can't get the file format specification for MS Word documents.
    My advice is to look in to RTF, the spec is out there, although its not very nice.
    I think you can do tables in RTF, and you just need to write your output as text and MS word will load it.
    One thing to do is create a table in Word and save it as RTF, then look at the text and try to see whats going on. Although it won't be pretty !! Good luck

  • Word Files in Java

    Hi everybody,
    I know this question has probably been asked a zillion and one times before, but I think I might be putting a bit of a new spin on it.
    Anyway, I was looking at the Jakarta API's to read and write Microsoft Word Files in Java, and I couldn't make heads or tails of them. Since they have packages you import, though, that means that there must be some Java solution to the problem. So, my question is this--does anyone here know of any Java stream classes, depreciated or otherwise, that can read Microsoft Word's encoding? I've heard rumors that some depreciated classes might be able to do the job; if I'm just completely wrong I'd appreciate it if someone would correct me so I'm not clinging to false hope. Failing an answer to that question, does anyone know if it's possible to get source code of the Jakarta packages?
    Thanks,
    Jezzica85

    Thanks TuringPest,
    I feel a bit stupid for saying this, but I can't make any sense of their source code either or tell which files are supposed to be for Microsoft Word; maybe it's just because of how it's written.
    What exactly does a proprietary format mean? I think I've heard the term, but I'm not sure.
    I'm starting to think my idea of writing some of my own code is too ambitious, but I thought this might be simple. All I want to do is get text out of a Word file, I don't want to open a file to edit it, and I don't care about formatting. Maybe if I understood the file format I could get myself started, I hope I don't sound like a broken record.
    Actually, I've written a macro into Microsoft Word that saves as a text file, so I can do it that way, I was just hoping there might be an easier way so I wouldn't need to deal with the extra file--is this probably the best way to go anyway?
    Thanks again,
    Jezzica85
    Message was edited by:
    jezzica85

  • Reading Microsoft Word Document in JAVA

    Hi friends,
    im using follwing code to read word document in java using apache poi package..
    import org.apache.poi.poifs.filesystem.*;
    import org.apache.poi.hwpf.*;
    import org.apache.poi.hwpf.extractor.*;
    import java.io.*;
    public class readDoc
    public static void main( String[] args )
    String filesname = "Hello.doc";
    POIFSFileSystem fs = null;
    try
    fs = new POIFSFileSystem(new FileInputStream(filesname;
    //Couldn't close the braces at the end as my site did not allow it to close
    HWPFDocument doc = new HWPFDocument(fs);
    WordExtractor we = new WordExtractor(doc);
    String[] paragraphs = we.getParagraphText();
    System.out.println( "Word Document has " + paragraphs.length + " paragraphs" );
    for( int i=0; i<paragraphs .length; i++ ) {
    paragraphs[i] = paragraphs.replaceAll("\\cM?\r?\n","");
    System.out.println( "Length:"+paragraphs[ i ].length());
    catch(Exception e) {
    e.printStackTrace();
    but im getting exception that
    java.io.IOException: Unable to read entire header; -1 bytes read; expected 512 bytes
    at org.apache.poi.poifs.storage.HeaderBlockReader.<in it>(HeaderBlockReader.java:78)
    at org.apache.poi.poifs.filesystem.POIFSFileSystem.<i nit>(POIFSFileSystem.java:83)
    how to solve this issue.. please suggest me .. its urgent..
    Add to satheeshtech's Reputation

    You might do better consulting [http://www.nabble.com/Apache-POI-f298.html|http://www.nabble.com/Apache-POI-f298.html] .

  • HOW TO OPEN WORD DOCUMENT FROM JAVA???

    hi everyone! Can you please help me to come with this problem? Let me to set my main target I want to achieve:
    1) In my program user should first press a button;
    2) Then already created Word Document should be opened (I DO NOT NEED to open that Word Document in Java or something like JField). Just simply it should be opened as a Microsoft Word Document.
    I DO NEED YOUR HELP! PLEASE HELP ME....!

    Running cmd using the exec is also a windows only solution, there is no "more" or "less" it that solution compared to the rundll.
    Since word is a windows format its pretty obvious that the application is ran under windows platform.
    If you are running on a different platform (maybe using open office you can open word documents, i'm not sure) you might want to use the JDIC library (https://jdic.dev.java.net/) which enables you to open/edit/browse such files using the default viewer/editor/browser of the system you are working on.
    Look at the org.jdesktop.jdic.desktop.Desktop object for these methods.
    You can also find the Desktop object in J2SE6 but its still in beta.

  • How to do exact word search using Java API

    Hi,
    Can someone tell me how can I write a search query using Ultra Search Java API to return data containing a full word that is sent as a search
    parameter. e.g. If I want to search for a word 'Dictionary' I need to get all the results conatining full word Dictionary for example if I
    have following 4 records
    1. Dictionary
    2. English Dictionary
    3. French Dictionary
    4. AllDictionary
    How can I write a query that returns me first 3 records only as they contain the word 'Dictionary' and not the fourth record as it's not a word.
    Here is what I need to get back and ordered in that way as the 'Dictionary' needs to be first record because the search is on Dictionary.
    1. Dictionary
    2. English Dictionary
    3. French Dictionary
    Any help is appreciated.
    Thanks

    Looks like we can not do an exact word search using Java API.

  • How to parse a MS word file from JAVA

    How do i read the contents of MS word file in java? I know that FileInputStream can be used to read the contents in bytes but i need to parse the content of the file also so any pointers on this would be helpful for me.
    I have tried out the API given out by POI by apache but i am not able to figure any thing out of that so it would be very helpful if some posts a sample code for the above problem.

    but i am not able to figure any thing out of thatUse XML, as DrLJ just proposed. But be warned that if you are going to be dealing with Word documents you will have to spend some time learning how they are formatted, even the XML versions. Don't expect to just throw down a FileInputStream and have things happen automagically. It's a complicated format.

  • Using word/excel from java (client or weblogic server)

    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

    Sven, This is a really bad idea. Why don't you tell me
    what your trying to do and I wil surely give you a better alternative
    JRadecki
    "Sven Roesner" <[email protected]> wrote:
    >
    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

  • Generating reports in .doc format (Word Document) using Java POI - HWPF

    Hi
    Can anybody help me how to generate the report in .doc format using POI API?
    Please share the sample code, if you have.
    Thanks in Advance
    Dhilip

    Hi,
    I dont think that your requirement has to do with ADF capabilities.
    You want to edit a word document with JAVA. For that reason, you will need an API, as the suggestions above.
    You can do it without ADF and by using standard JAVA and the API of your choice. a static void main will do for that matter.
    ADF comes into the game when you want to handle the document with your ADF application.
    This means that you either want to get your new data to be placed on your doc from BC or any other DataControl or you want to do something else with ADF..
    My guess is that you want to get data from ADF into your Doc.
    You could create an API on handling your Doc and then use it into your ADF application.
    Regards,
    Dimitris.

  • 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].

Maybe you are looking for

  • IPod Touch 2nd gen no longer syncs with itunes?

    I just recently upgraded to Snow Leopard. Now my ipod touch won't sync to itunes. It syncs with iphoto, although I can't put new albums on it. It doesn't allow me to 'sync ipod' in the itunes menu. And it doesn't automatically sync like it used to. I

  • Create Launcher and how to find the address bar

    Hi Guys, I am new to linux and wonder if there is an option to turn on the address bar for folder such as this is possible in windows. [see here.|http://metalray.redio.de/dokumente/abar.jpg] Moreover, I noticed oracle enterprise red hat linux allows

  • Windows will not detect my ipod mini

    i am haveing a problem with my ipod mini 4gb. I deleted the iPod_Control hidden folder and since then windows will not detect my ipod, i have tried this on sereral pcs. using wxp. Really need asistance!

  • Widget is missing it's scroll bar

    After publishing my project and viewing the project in Chrome, the tabs within a widget that have more content then the widget frame can hold are not accessible because the scroll bar has dissapeared.  Please advise on how to fix this. Thank you in a

  • Lion download Question

    Is the Lion download a one time only download from apple, or can you download it again if needed?