Summary: | Incorrect value returned for FormulaError on evaluating formula cell | ||
---|---|---|---|
Product: | POI | Reporter: | Nishant Middha <MIDDHA.NISHANT173> |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | NEEDINFO --- | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: | Spreadsheet for above test case. |
Can you provide a complete test case? The code provided so far is so simple that I can't even recreate what you're trying to express. I try to write test cases based on this part of the code and file you provide, but I never get what I expect. |
Created attachment 37169 [details] Spreadsheet for above test case. 1. I am using below attached excel file. 2. In below excel cell A1 contains formula "=G2-G5" which evaluates to zero. 3. On evaluating this cell using FormulaEvaluator, value for formula error must be FormulaError._NO_ERROR but it is FormulaError.NULL 5. Apache POI version used is 3.17 4. Below mentioned is my code : // Java Code try { // cell is instance of Cell A1 CellValue cellValue = formulaEvaluator.evaluate(cell); formulaError = FormulaError.forInt(cellValue.getErrorValue()); System.out.println(formulaError); System.out.println(cell.getCachedFormulaResultTypeEnum()); } catch (NotImplementedException ex) { } catch (FormulaParseException ex) { } 5. The output of the above-mentioned code is NULL NUMERIC 6. There is an ambiguity here result type is NUMERIC and formula error is FormulaError.NULL but it should be FormulaError._NO_ERROR as formula successfully evaluates to zero.