I Tried like this,

I have table in 4 row .that small table have 2 cells.


                       Paragraph   tab=row.getParagraph(0);
                      Table t=row.getTable(tab);
                      System.out.println("number of rows "+t.NumRows());   

when i am try to print this it shows The end (80) must not be before the
start (106)

how to set paragraph value ,for second table


import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.poi.POIOLE2TextExtractor;
import org.apache.poi.extractor.ExtractorFactory;
import org.apache.poi.hpsf.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Table;
import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableRow;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import excel.Workbook;
 
public class readwordIMP
{
        public readwordIMP()
        {
                 Table table = null;
                 TableRow  row = null;
                 String filesname = "D:\\Akhil\\TEMP\\maths\\limits and 
contin\\Limits - 1
- Assignment Info\\IITPU1_M_11_1_M.doc";

                 ArrayList<String> al=new ArrayList<String>();
                try
                {
                  POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(filesname));                 
                  HWPFDocument doc = new HWPFDocument(fs);         
                  String character;     
                  Range range = doc.getRange();
                  
                  Paragraph tablePar;
                  tablePar = range.getParagraph(0);
                
               if (isInTable()) {
                     table = range.getTable(tablePar);
                 
                    for (int rowIdx=4; rowIdx<table.numRows(); rowIdx++)
                    {
                        row = table.getRow(rowIdx);         
                        System.out.println("row
"+(rowIdx+1)+"qwwq"+row.numCells());
                        
 ****               Paragraph   tab=row.getParagraph(0);
                      Table t=row.getTable(tab);
                      System.out.println("number of rows "+t.NumRows());        
  
**************


                  //      for (int colIdx=0; colIdx<row.numCells(); colIdx++) 
                    //    {
                      //       TableCell cell = row.getCell(colIdx);
                        //     character=cell.getParagraph(0).text();

                              
         
                          //   character=character.substring(0,
character.length()-1);                      

                            // al.add(character);
                            
                        //}
                      }         
                }
                
          } catch(Exception e) { 
                    e.printStackTrace();
                }
        }
        private Paragraph Paragraph(int i) {
                // TODO Auto-generated method stub
                return null;
        }
        private boolean isInTable() {
                // TODO Auto-generated method stub
                return true;
        }
        public static void main( String[] args )
        {
                readwordIMP t=new readwordIMP();                
    }
}


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/read-nested-tables-data-from-word-document-using-java-tp4826333p4829697.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to