Using Apache POI, I want to produce an Excel spreadsheet. A formula should appear in one cell. Sadly, it is ineffective. In the Excel sheet, I receive a mistake.
Code
public static void main(String[] args) throws FileNotFoundException, IOException {
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Test");
Row row = sheet.createRow(2);
Cell cell = row.createCell(0);
cell.setCellFormula("ZÄHLENWENN(A1:A2, \"X\")");
workbook.write(new FileOutputStream(new File("d:\\tmp\\test.xlsx")));
}
Excel
The Excel sheet is created, but I see an error in the cell:
Although, I see the right formula in the input field (with converted separator):
Environment
It is a legacy application, therefore I can't update libraries' major versions.
- Java 8
- Apache 3.17
- Microsoft Excel 2016
- German localization
Research
If I press enter in the input field, the error disappears and the value is calculated, but I don't want to do that manually.