https://bz.apache.org/bugzilla/show_bug.cgi?id=63054
Bug ID: 63054
Summary: An error in a calculational "thread" of an array
function shouldn't affect other "threads"
Product: POI
Version: 4.0.x-dev
Hardware: PC
OS: All
Status: NEW
Severity: major
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Whenever in array mode,
a) operands are collected for an array function or
b) array function is evaluated,
and an ErrorEval is encountered, an EvaluationException is thrown, and the
whole result is set to ErrorEval. This doesn't correspond to Excel behavior,
where calculations fall into separate "threads", so that an error in a "thread"
doens't affect other ones.
Example:
A | B | C | D | E | F |
1 | #N/A! | 2 | {=A1:C1*A1:C1} |
=======================================
expected | 1 | #N/A! | 4 |
actual | #N/A! | #N/A! | #N/A! |
A testcase:
@Test
public void elementwiseEvaluation() {
Workbook workbook = new XSSFWorkbook();
Row row = workbook.createSheet().createRow(0);
row.createCell(0).setCellValue(1);
row.createCell(1).setCellErrorValue(FormulaError.NUM.getCode());
row.createCell(2).setCellValue(2);
row.getSheet().setArrayFormula("A1:C1*A1:C1",
CellRangeAddress.valueOf("D1:F1"));
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
assertEquals(CellType.NUMERIC,
row.getCell(3).getCachedFormulaResultType());
assertEquals(1, row.getCell(3).getNumericCellValue(), 0);
assertEquals(CellType.ERROR, row.getCell(4).getCachedFormulaResultType());
assertEquals(FormulaError.NUM.getCode(),
row.getCell(4).getErrorCellValue());
assertEquals(CellType.NUMERIC,
row.getCell(5).getCachedFormulaResultType());
assertEquals(4, row.getCell(5).getNumericCellValue(), 0);
}
--
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]