i have an excel sheet (xslx) where I have defined an array formula (https://support.office.com/en-us/article/Guidelines-and-examples-of-array-formulas-7D94A64E-3FF3-4686-9372-ECFD5CAA57C7). That works like a charme in excel itselt. I use apache poi to manipulate some values in that excel sheet programmaticly. After that manipulation I want to recalculate the result of that array formula but I don't know how to do it. With "normal" formula I do it as following:
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
XSSFRow row = sheet.getRow(i);
Cell cell = row.getCell(j);
evaluator.evaluateCell(cell);
double value = cell.getNumericValue();
For using array formula there is the method
void setCellArrayFormula(String formula, CellRangeAddress range)
in the class XSSFCell and
public CellRange<XSSFCell> setArrayFormula(String formula, CellRangeAddress range)
in the class XSSFSheet.
After setting the formula with a call like cell.setCellArrayFormula("SUM(ABS(H2:H5))", new CellRangeAddress(2,5,7,7));
i don't know how to get the result of that formula (but i am also not sure whether this is the correct way to use the array formula in apache poi. In Excel i have to do it like this {=SUM(ABS(H2:H5))}
)
Does anyone know how to use the array formula in apache poi? Thank you!