Summary: | HSSFRow.getLastCellNum() works incorrectly. | ||
---|---|---|---|
Product: | POI | Reporter: | Bina Prieto <Bina> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED DUPLICATE | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 3.0-FINAL | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Bina Prieto
2007-08-02 04:34:49 UTC
I think that this bug becomes only when we create and save new Excel file. When we read file that was saved by Excel evrything works good.(In reply to comment #0) > Performs test: > 1. > HSSFWorkbook workbook = new HSSFWorkbook(); > HSSFSheet sheet = workbook.createSheet(); > HSSFRow row = sheet.createRow((short) 0); > row.createCell((short) 0); > System.out.println("FIRST CELL NUM: " + row.getFirstCellNum() > + "; " + " LAST CELL NUM: " + row.getLastCellNum()); > Console results: > EXPECTED: FIRST CELL NUM: 0; LAST CELL NUM: 1 > OBSERVED: FIRST CELL NUM: 0; LAST CELL NUM: 0 > > Java-doc says: > /** > * gets the number of the last cell contained in this row <b>PLUS ONE</ b>. > * @return short representing the last logical cell in the row <b>PLUS ONE</ > b>, or -1 if the row does not contain any cells. > */ > > public short getLastCellNum() > > If we performs this test for sheet that read from file all is ok. (In reply to comment #0) > Performs test: > 1. > HSSFWorkbook workbook = new HSSFWorkbook(); > HSSFSheet sheet = workbook.createSheet(); > HSSFRow row = sheet.createRow((short) 0); > row.createCell((short) 0); > System.out.println("FIRST CELL NUM: " + row.getFirstCellNum() > + "; " + " LAST CELL NUM: " + row.getLastCellNum()); > Console results: > EXPECTED: FIRST CELL NUM: 0; LAST CELL NUM: 1 > OBSERVED: FIRST CELL NUM: 0; LAST CELL NUM: 0 > > Java-doc says: > /** > * gets the number of the last cell contained in this row <b>PLUS ONE</ b>. > * @return short representing the last logical cell in the row <b>PLUS ONE</ > b>, or -1 if the row does not contain any cells. > */ > > public short getLastCellNum() > > If we performs this test for sheet that read from file all is ok. I think that this bug becomes only when we create and save new Excel file by POI. When we read file that was saved by Excel evrything works good. |