Hi Ulf,
Thanks for your reply. I have tested it using latest POI version 3.7 as well as 3.8 beta release.
Below is the code snippet
InputStream fis = new FileInputStream(fileName);
POIFSFileSystem fs = new POIFSFileSystem(fis);
HWPFDocument
doc = new HWPFDocument(fs);
Range range = doc.getRange();
for (int i=0; i<range.numParagraphs(); i++){
Paragraph tablePar = range.getParagraph(i);
//Here i am getting exception
if (tablePar.isInTable()) {
Table table;
try{
table = range.getTable(tablePar);
}catch(Exception e){
continue;
}
for (int rowIdx=0; rowIdx><table.numRows(); rowIdx++) {
TableRow row = table.getRow(rowIdx);
for (int colIdx=0; colIdx><row.numCells(); colIdx++) {
TableCell cell = row.getCell(colIdx);
}
}
}
I am getting following exception
Exception in
thread "main" java.lang.ArrayIndexOutOfBoundsException: 16
at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:46)
at org.apache.poi.hwpf.sprm.SprmOperation.getOperand(SprmOperation.java:98)
at org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor.unCompressPAPOperation(ParagraphSprmUncompressor.java:87)
at org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor.uncompressPAP(ParagraphSprmUncompressor.java:63)
at org.apache.poi.hwpf.model.PAPX.getParagraphProperties(PAPX.java:136)
at org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:828)
at com.jp.processor.Docfile_Reading.main(Docfile_Reading.java:62)
Sometimes it is nullpointer exception while uncompressing.
>