The following code snippet works fine with 3.5-beta4:
Workbook wb = new XSSFWorkbook();
Sheet sh = wb.createSheet();
Cell cell = sh.createRow(0).createCell(0);
cell.setCellType(Cell.CELL_TYPE_FORMULA);
cell.setCellFormula("1");
Post full sample code to reproduce the behavior.
Yegor
I encountered this fun little problem while creating an XSSFWorkbook.
Calling cell.setCellType(CELL_TYPE_FORMULA) before
cell.setCellFormula() caused the following exception:
java.lang.IndexOutOfBoundsException
at org.apache.xmlbeans.impl.store.Xobj.remove_attribute(Xobj.java:2269)
at
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTCellImpl.unsetT(Unknown
Source)
at org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:650)
Moving the setCellType() call after the setCellFormula() call resolved
the problem.
Cheers,
Karim
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]