Hi Andrew.

You've to ignore nulls (continue). 

I've also discovered such a behaviour on row level. My experience is
that when a lot of manipulations happened such cells not necessarily are
null cells. When it's a new file I always discovered empty cells/rows to
be null.

MfG 
Karl-Heinz Zengerle
___________________________________________________
 More than competence in Document Management 
___________________________________________________
SAW AG
Waldm�nchenerstr. 12
81549 M�nchen
Tel.: ++49-89-68088368
Fax: ++49-89-68088389
www.sawag.com

___________________________________________________

-----Urspr�ngliche Nachricht-----
Von: Andrew Kharchuk [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 28. November 2003 17:22
An: POI Users List
Betreff: reading empty cells 

Hi.

I have been using the following code without any problems with poi 1.5:

     HSSFRow row;HSSFCell cell;
     int i=0;
     while((row=sheet.getRow(i++))!=null) {
      short fcol=row.getFirstCellNum();
      short lcol=row.getLastCellNum();
      for(short j=fcol;j<=lcol;j++){ 
       cell=row.getCell(j);
        ...........
       }
      }
     }

Using it with poi 2.0 I get exception at "cell=row.getCell(j);":
java.lang.IndexOutOfBoundsException
        at org.apache.poi.util.IntList.get(IntList.java:387)
        at
org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.constructRec
ord(ValueRecordsAggregate.java:312)
        at
org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.getCell(Valu
eRecordsAggregate.java:98)
        at
org.apache.poi.hssf.model.Sheet.getValueRecord(Sheet.java:557)
        at
org.apache.poi.hssf.usermodel.HSSFRow.getCell(HSSFRow.java:325)

Excel file was generated with the use of poi 2.0. Exception is thrown at
second cell of the row.
It has just first cell with a filled value. Before throwing exception
fcol=0,lcol=12.

What should I do? Thanks.

Andrew Kharchuk




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to