https://bz.apache.org/bugzilla/show_bug.cgi?id=62834
Bug ID: 62834
Summary: Regression: FormulaEvaluator.evaluateInCell() throws
exception
Product: POI
Version: 4.0.0-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 36199
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36199&action=edit
xslx file having a problem in the A3 cell
Hi,
we have an xlsx file for which the FormulaEvaluator.evaluateInCell() throws an
exception for one particular cell. This used to work with Apache POI v3.17 and
now fails after upgrading to v4.0.0.
The file is attached (problem.xlsx), the problematic cell is A3, the other
cells are ok. The issue can be reproduced with the following code:
Workbook wb = WorkbookFactory.create(new File(/path/to/problem.xlsx));
Sheet sheet = wb.getSheet("problem");
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateInCell(sheet.getRow(1).getCell(0)); // A2 -> OK
evaluator.evaluateInCell(sheet.getRow(2).getCell(0)); // A3 -> FAIL
The stacktrace is:
Exception in thread "main" java.lang.IllegalStateException: Cannot get a
FORMULA value from a STRING cell
at
org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:1075)
at
org.apache.poi.xssf.usermodel.XSSFCell.getCellFormula(XSSFCell.java:483)
at
org.apache.poi.xssf.usermodel.XSSFCell.getCellFormula(XSSFCell.java:470)
at
org.apache.poi.xssf.usermodel.XSSFSheet.onDeleteFormula(XSSFSheet.java:4639)
at
org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:969)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.setCellType(BaseFormulaEvaluator.java:218)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:140)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:85)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:34)
kind regards,
Maarten Coene
--
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]