Results 1 to 3 of 3
  1. #1
    Giacomo is offline Member
    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Default Error while reading table into a doc file

    Hi all, i'm new here and with Apache POI.

    I would like to read a .doc file line by line and create a .pdf with text, table and image retrieved by the doc file. Now I managed to do it but not in order: I have written some code that extract text, table data, and image but I can't determine where those object are in the document.

    All this because of if I try to run this code, who allow me to read the document paragraph by paragraph, I obtain a error.

    that code follow:

    Java Code:
            InputStream fis = new FileInputStream(input);  
            POIFSFileSystem fs = new POIFSFileSystem(fis);  
            HWPFDocument doc = new HWPFDocument(fs); 
            Range range = doc.getRange();
    
            for (int i=0;i<range.numParagraphs();i++) {
            	org.apache.poi.hwpf.usermodel.Paragraph par = range.getParagraph(i);
            	if(!par.isInTable()) {
            		.......
            	} else if (par.isInTable()) {
                            Table table = range.getTable(par);/**/
            		for (int rowId=0;rowId<table.numRows();rowId++) {
            			TableRow tRow = table.getRow(rowId);
            			for (int cellId=0;cellId<tRow.numCells();cellId++) {
            				TableCell tCell = tRow.getCell(cellId);
            				tCell.text();
            			}
            		}
                     }
            }
    The exception is:
    Java Code:
    ........... The paragraph is not the first one in a table.
    How can i Solve this??

    Thanks a lot and sorry for my english.
    Last edited by Giacomo; 05-13-2013 at 03:10 PM.

  2. #2
    Giacomo is offline Member
    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Default Re: Error while reading table into a doc file

    No Idea..??

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,304
    Rep Power
    20

    Default Re: Error while reading table into a doc file

    Member Giacomo is banned for a year for violation of forum rules (use of obscenities). One post be the member has been removed from public view.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Error reading file
    By KevinNguyen in forum New To Java
    Replies: 1
    Last Post: 11-10-2012, 04:29 PM
  2. Replies: 8
    Last Post: 06-30-2011, 01:20 PM
  3. Error reading file
    By sehudson in forum New To Java
    Replies: 3
    Last Post: 03-01-2011, 04:44 AM
  4. error in reading data from table in pidgree database
    By chethan_kc in forum Java Servlet
    Replies: 17
    Last Post: 02-18-2011, 02:11 PM
  5. reading from a zip file, error
    By Mr tuition in forum AWT / Swing
    Replies: 1
    Last Post: 01-16-2008, 12:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •