I have Java code that uses Apache POI 5.2.2. The program works fine, except that Apache POI does not evaluate Excel Boolean functions correctly. For example, I have an Excel file called “eje.xlsm” that looks like this:

It only has the formula AND(A1="a";B1=0) in cell C1 and the values "a" in A1 and 1 in B1. The main function of my Java program reads this information and changes the value in B1 to 0, so that C1 should change to TRUE:
public static void main(String[] args){
try{
FileInputStream file = new FileInputStream(new File("./eje.xlsm"));
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheetAt(0);
System.out.println(sheet.getRow(0).getCell(2).getBooleanCellValue());
sheet.getRow(0).getCell(1).setCellValue(0);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateFormulaCell(sheet.getRow(0).getCell(2));
System.out.println(sheet.getRow(0).getCell(2).getBooleanCellValue());
FileOutputStream out = new FileOutputStream("./eje.xlsm");
workbook.write(out);
out.close();
workbook.close();
file.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
I was expecting this output on the console:
false
true
But, instead, I get:
false
false
I do not know why. I have tried to reconfigure Apache POI in Eclipse, which I use for Java coding, but the problem persists. It only happens with Boolean functions, so with other functions it works fine.