Problem with the event driven XLS reader in HSSF. I believe the value returned by the RowRecord object for the last column used (indexed on 0) is incorrect. The value actually returned is the correct value + 1. Snippet of code below (basically the simple event example in the docs): public void processRecord(Record record) { switch (record.getSid()) { case RowRecord.sid : RowRecord rowrec = (RowRecord) record; System.out.println("Row number [" + rowrec.getRowNumber() + "], first col [" + rowrec.getFirstCol() + "] last col [" + rowrec.getLastCol() + "]"); } }
This bug actually refers to poi-2.5-final-20040302.jar - was not able to select that from the version drop-down above.
Its actually not a bug. This is what is in the Excel Record. its supposed to be LastCol+1. Why? Dunno, ask Microsoft :-) This is actually mentioned in the Excel 97 Dev guide too.