https://issues.apache.org/bugzilla/show_bug.cgi?id=47026
Summary: Problems with Cell Formula
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=23488)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23488)
test.xlsm
Problem 1
=========
Cell "A1" contains a simple formula, following code assign a string value "456"
to cell "A1". But the cell type is still Cell.CELL_TYPE_FORMULA after the
assignment.
--
Workbook source = new XSSFWorkbook("test.xlsm");
Sheet sheet = source.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
System.out.println("cell.getCellType() = " + cell.getCellType());
cell.setCellValue("456");
System.out.println("cell.getCellType() = " + cell.getCellType());
--
Problem 2
=========
NullPointerException is thrown if I explicit change the cell type to
Cell.CELL_TYPE_STRING.
--
Workbook source = new XSSFWorkbook("test.xlsm");
Sheet sheet = source.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
cell.setCellType(Cell.CELL_TYPE_STRING);
cell.setCellValue("456");
--
java.lang.NullPointerException
at org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:693)
Problem 3
=========
NullPointerException is thrown if I explicit set the cell formula to null.
--
Workbook source = new XSSFWorkbook("test.xlsm");
Sheet sheet = source.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
cell.setCellFormula(null);
cell.setCellValue("456");
--
java.lang.NullPointerException
at org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:693)
--
(If I change the cell value from "456" to 456, no exception will be thrown and
cell type will be changed to Cell.CELL_TYPE_NUMERIC)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]