Want to read a word file

can any one let me know how to read a .doc file through my java io.
Regards
Naresh Waswani

Jakarta POI / HWPF is mentioned in the list above. While there isn't a lot of activity on the project, and lots of warnings that it is in its infancy, it is certainly capable of extracting the text contained in the document (including that within tables etc) with no problems.
I've used it several times for this purpose and have been very impressed with how simple it is to use.
~D

Similar Messages

  • How to read MS Word file

    Hi,
    How can i read MS word file in java ? My problem is that want to read .doc file and convert this .doc file into .txt tile . I was try with Jakarata POI , but i m not found out POI ?
    How to use Jakarata POI for reading .doc file ?
    Thanks in advance
    madhu
    [email protected]

    I believe your looking for the <input type="file" tag to read a file from the user's browser to the servlet. There are examples of this on line. POI is used after the file is read into the servlet to extract its information.

  • I want to read th attached file ther i explain what i want to do exactly

    i attached the file wich i want read
    Attachments:
    file1.doc ‏1 KB

    As Dave said, the file is empty, so we cannot get your explanation.
    If you want to read from Word into a LabVIEW string, you will first need to convert the Word file to simple text.
    You can also use ActiveX to read entire or specific parts of the document. You can also read tables and graphs this way.
    One very useful tool in communicating between LabVIEW and Word is the Report Generation Toolkit. It is based on activeX technology, but the activex calls are wrapped in easy to use VI.
    LabVIEW Report Generation Toolkit for Microsoft Office
    Here is another thread that talks about reading the Word documents
    Read Word Document
    Zvezdana S.
    National Instruments

  • From an Oracle form, I want to read a text file.

    From an Oracle form, I want to read a text file. In the form on a button press I have:
    declare
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    filename VARCHAR2(30);
    BEGIN
    filename:=GET_FILE_NAME('U:\ora_devl\pps\work\a.txt', File_Filter=>'Text Files (*.txt)|*.txt|');
    in_file := Text_IO.Fopen(filename, 'r');
    LOOP
    Text_IO.Get_Line(in_file, linebuf);
    -- :text_item5:=:text_item5||linebuf||chr(10);
    Text_IO.New_Line;
    END LOOP;
    EXCEPTION
    WHEN no_data_found THEN
    Text_IO.Put_Line('Closing the file...');
    Text_IO.Fclose(in_file);
    END;
    It gets an ORA-302000. I suspect the problem starts with the GET_FILE_NAME because when I comment out everything but that, It processes endlessly never ending.
    Forms [32 Bit] Version 11.1.1.3.0 (Production)
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    What can you tell me? Thanks

    GET_FILE_NAME will try to open an "Open File" dialog on the server, which obviously can't happen. If you want to use that type of behavior you need to use WebUtil and the function CLIENT_GET_FILE_NAME. Example:
         filename := CLIENT_GET_FILE_NAME('C:\', File_Filter=> 'Text Files (*.txt)|*.txt|All Files (*.*)|*.*|', dialog_type=> OPEN_FILE);Refer to the Builder Online help for more details. You can also refer to the demo which is available here:
    http://www.oracle.com/technetwork/developer-tools/forms/downloads/index.html
    More information here:
    http://www.oracle.com/technetwork/developer-tools/forms/webutil-090641.html
    Also, it appears that you are attempting to use a mapped drive ("U"). Although this can be made to work, it is not recommended and in some cases will not be supported. If you need access to remote files, you should use some other mechanism to bring the file to the local machine before manipulating it.

  • I want to convert a word file to a PDF

    I want to convert a Word file to a PDF file. I can't get past the page that states choose the file I want to convert. Nothing happens when I select the word file I want to convert

    Hi larryjohn,
    I'm sorry that you're having trouble converting your Word file to PDF. Does it happen with just one particular Word file, or are you running into the same issue with any Word file?
    For starters, please try the following:
    Clear your browser cache (steps to do this vary by browser)
    If you're using a work computer, check with your IT team to confirm if you have firewall/proxy settings that restrict the ability to upload files to the internet.
    Lastly, if the issue persists after the steps above, please try another web browser.  A list of supported browsers for accessing the ExportPDF service is available here: http://www.adobe.com/acom/systemreqs/
    Please let us know how that goes, and if we can be of further assistance.
    Best,
    Sara

  • Re: want to read in from file and write to components like textfield

    I have a file that has been written using PrintWriter
    The file is written with only the escape character '\t'
    formating and not '\n'
    here is 'file.txt':
    s a     Alan     Credit Account     333333     55555     3     March     1972     20000.0     mmilo
    I now want to read this and write to various components eg. Textfield
    textfield.setText(readinText);
    The file is written with these commands:
    myprint.print(initials);
    myprint.print('\t');
    myprint.print(surname);
    myprint.print('\t');
    so basicly initials '\t' surname '\t' card type '\t' etc
    How can I read this file and write to the components?
    I am thinking of using BufferedReader
    is this o.k?
    String str;
    try
    { BufferedReader myinp;
    myinp = new BufferedReader( new FileReader("file.txt"));
    while ((str = myinp.readLine()) !=null)
    { //this is where I need help, given that i have
    // just read in a line how can I seperate it
    // i.e initials, surname, card type etc?
    // please help
    myinp.close();
    catch(IOException e)
    { System.err.println("Exception: " + e.getMessage());
    System.exit(1);
    }

    Hi,
    1. read in the whole file in a string
    2. then do the following - lets say s is your readin string
    StringTokenizer st = new StringTokenizer(s,"\t");
    the StringTokenizer separates that automatically for you - every call to st.nextToken() returns a string with one "value", the "\t" is not returned. Let's say you have 4 JTextFields called tf1 to tf4 and you want to fill in the 4 values from the StringTokenizer
    tf1.setText(st.nextToken());
    tf2.setText(st.nextToken());
    tf3.setText(st.nextToken());
    tf4.setText(st.nextToken());
    how many values are readable by nextToken()-calls are returned by st.getTokenCount() and you can ask if there are more to read by st.hasMoreTokens() which return a boolean.
    greetings Marsian

  • Possible to read/ write word files using Java?

    I'm planning to write a Java application that can read an MS word document, extract something (including mathematics equations created with the equation editor) from the document and write it to another word document.
    Is it possible to do this?
    Can anyone give me some idea?
    Any idea is much appreciated :)

    I think I may have misunderstood your question, but in case I didn't and you find this helpful, following is the code to read a word doc, replace certain strings, then write it out as a new doc.
    import java.io.*;
    public class Copy {
         public static String endResult;
         public static void main(String[] args) {
              String oldAuthor = "Samuel Foote";
              String newAuthor = "New Author";
              String oldDate = "1720-1777";
              String newDate = "1975 -- ";
          try {
              File inputFile = new File("C:\\document.doc");
              BufferedReader input = null;
              input = new BufferedReader(new FileReader(inputFile));
              StringBuffer contents = new StringBuffer();
              String line = null;
              while ((line = input.readLine()) != null){
                   contents.append(line);
                   contents.append(System.getProperty("line.separator"));          
              String text = contents.toString();
    //     Replace the author and the dates
              Copy y = new Copy();
              y.replace(text, oldAuthor, newAuthor);
              text = endResult;
              y.replace(text, oldDate, newDate);
    //     Copy the new, improved text to another file     //
              Copy z = new Copy();
              z.finalReplace(text);
              input.close();
         catch (FileNotFoundException ex) {
              ex.printStackTrace();
         catch (IOException ex){
              ex.printStackTrace();
         String replace(String text, String oldSubstring, String newSubstring) {
    //          Search the text for a string, then replace it //
              int fromIndex = 0;
              int e = 0;
              StringBuffer sb = new StringBuffer();
              while ((e = text.indexOf(oldSubstring, fromIndex)) >= 0) {
                   sb.append(text.substring(fromIndex, e));
                   sb.append(newSubstring);
                   fromIndex = e + oldSubstring.length();
              sb.append(text.substring(fromIndex));
              endResult = sb.toString();
              System.out.println("final string = " + sb);
              return sb.toString();
         String finalReplace (String args) throws IOException {
    //          Move the altered text to a new file  //
              File outputFile = new File("C:\\copied document.doc");
              FileWriter out = new FileWriter(outputFile);
              Writer output = null;
              try {
                   output = new BufferedWriter(new FileWriter(outputFile));
                   output.write(endResult);
              finally {
                   if (output != null) output.close();
                 return endResult;

  • Can't open Read-Only Word Files

    Hi,
    I can't open word files that windoze has arked as Read-Only with pages 08. I get the error message, "the document FILENAME couldnt be opened."
    Anyone got ideas..

    Hi folks,
    I've solved the problem, so if anyone else is having the problem, I solved it this way. The files were on a memory stick, so when I read this: http://docs.info.apple.com/article.html?artnum=106712 it became obvious that if a dragged the files into my Documents folder OS X should give the correct file permissions automatically and it did. Well done Apple.
    The link also gives info on how to do this manually if you need help.
    Dave.

  • How do I read a word file with Report Generation and Labview?

    Hello All:
    I have Labview 2010.
    How do I Read a Microsoft Word File1.doc with Labview and Report Generation Kit?
    File1.doc is a simple file with a few lines and a Table.
    thank you very much.
    \\diego2000

    I don't think that toolkit will help you.  Remember, it's the Report GENERATION Toolkit.  It's designed to create reports not read existing DOCs.
    You can use the standard file VIs to read a Word Doc but you'll have to strip out the formatting information to get at the raw text.
    There may be some other tools or ActiveX techniques that will help.  Hopefully someone more knowledgable on that subject will chime in to help you out...
    Using LabVIEW: 7.1.1, 8.5.1 & 2013

  • I want to read lines from file, count it and extract numbers from a first line.

    i must do un loop?

    HI,
    i try to explain how to use to LABVIEW TOOLS...
    1. USE a for next loop
    2. here you must open the file with the VI. read lines from file.
    you can choos how many lines you read at same time.
    3. the string you can convert into an number.
    4. in the loop is the literal counter... this is you line couter....
    iun schrieb:
    > i must do un loop?

  • I want to read the attached file from the second line to the last line befor the first NCOUNT

    after i want put it in a array but just the 1.2.3.6.and the 7 column
    ex: TIMET 0 1 1 0
    after to count how much NCOUNT i have and put the values of every one in long vector or array with one element
    Attachments:
    file2.txt ‏204 KB

    Here's a VI I wrote that should help you out. Since you are wanting to place a string in that array, it will need to be an array of all string. Hope this helps.
    J.R. Allen
    Attachments:
    File_Parser.vi ‏41 KB

  • I have a PDF file I want converted to a WORD file.

    How do I do that?

    Hi Mogens,
    Welcome!
    Here is a quick 'getting started' guide you may find helpful.
    Let me know!
    Kind regards, Stacy

  • How to open up Word files in Vista?

    Just bought my new laptop with Vista already installed. Set up was good and loaded up security. Checked my emails but could not open up a simple Word attachment. Can anyone help? It would be greatly appreciated.
    Thanks,
    Jay Cee,
    "Keep The Faith"

    Just a question: Do you have MS Office? If yes, then try to save your word file from that E-Mail and to open it separately with Word.
    If not then you know now whats the problem: You just dont have Word and you should buy a Office software if you want to read your word files. :)
    Greetings

  • Read one word at a time from a text file

    I want to read one word at a time from a text file as it is done by "scanf &s" function in text based programme. It is not possible by " read from text"  function. Suggest me  function or method to solve this.

    The simplest way is to use the spreadsheet string to array function with the space character as the delimiter.
    Note that this won't work unless there is a space character between the words - it won't work with line feeds / carriage returns between the words but you could always split the string into lines first. You may also want to trim whitespace to remove any other non-visible characters (e.g. tab, line feeds) from around the word.
    If you need something more sophisticated that splits based on whitespace (e.g. tab, new line) then you'll probably need to do something with searching the string for these characters (e.g. using a regular expression) and then splitting them yourself into an array.
    Of course...if you actually want to just read one word at a time from the file rather than just split the file into words (I assumed you meant this), you will need to read the file byte by byte using the low level file IO functions, build a buffer of the bytes and check the character you've read to see if it a space.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • I want to read the contents of a file to a text item line by line dynamical

    I have created a timer
    tm_id := FIND_TIMER('LOG_READING_TIMER');
    If Id_Null(tm_id)
    then
    tm_id := create_timer('LOG_READING_TIMER', 1000, REPEAT);
    else
    set_timer (tm_id, 1000, REPEAT);
    end if;
    /* executed the shell script on application server */
    host(v_command,no_screen);
    and used below code for reading a file in when timer expired
    DECLARE
    v_file_name := '/home/log.txt' /* log created during running shell script */
    BEGIN
    v_infile := Text_IO.Fopen(v_file_name , 'r');
    loop
    Text_IO.Get_Line(v_infile,v_linebuf);
    :CONTROL.item:= :CONTROL.item||v_linebuf||chr(10);
    end loop;           
    WHEN no_data_found THEN
         Text_IO.Fclose(v_infile);
         delete_timer('LOG_TIMER');
    END
    I want to read a log file which is created while runnning shell script line by line
    dynamically
    Above code is reading the log filebut all the lines are shown at once.
    I have to display
    each line on the text item
    and the next line line by line
    Can anyone help me how to achieve this.
    Thanks,
    in advance

    In when-button-pressed trigger
    I have called a shell script on application server using host command
    HOST('Path of script',NO_SCREEN);
    Shell script writes some set of statements to log file on application server
    Problem is to read the log file on to the multiline text item each line simultaneosly
    while running the script.
    Below is the procedure i have written to achieve this but below code is writing all the lines at once
    after entire complete execution of shell script.
    for example
    shell script writes tolog file:
    1. 'Loading of tables';
    then loads the data
    2. 'emailing data';
    3. ...
    4. ...
    Below code writes
    all the 4 lines at once
    I want to see in frontend what is going on while running the script
    by reading the log file data line by line
    WHEN-BUTTON-PRESSED
    tm_id := FIND_TIMER('LOG_READING_TIMER');
    If Id_Null(tm_id)
    then
    tm_id := create_timer('LOG_READING_TIMER', 1000, REPEAT);
    else
    set_timer (tm_id, 1000, REPEAT);
    end if;
    /* executed the shell script on application server */
    host(v_command,no_screen);
    WHEN-TIMER-EXPIRED
    and used below code for reading a file in when timer expired
    DECLARE
    v_file_name := '/home/log.txt' /* log created during running shell script */
    BEGIN
    v_infile := Text_IO.Fopen(v_file_name , 'r');
    loop
    Text_IO.Get_Line(v_infile,v_linebuf);
    :CONTROL.item:= :CONTROL.item||v_linebuf||chr(10);
    end loop;
    WHEN no_data_found THEN
    Text_IO.Fclose(v_infile);
    delete_timer('LOG_TIMER');
    END
    While running the script on application server
    I want to see the data from log file simulataneously on to the form when the data is written on to the log file
    Please let me know if you need more details.
    Thanks,
    in advance

Maybe you are looking for