Cells in a row with an index > 255 that contain formulas may be evaluated wrongly. The specific case can be seen in the attached Excel file (repro.xlsx). There are two rows. The first row simply contains the numbers 1 - 300. The second row simply refers to the cell value above in the first row by a simple formula. When evaluating the cell values (using the FormulaEvaluator) you get wrong cell values for cells in the second row if they have an index > 255. The following code demonstrates the problem: Workbook wb = WorkbookFactory.create(new FileInputStream("repro.xlsx")); FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); for(int i = 245; i < 265; i++) { Cell cell_noformula = wb.getSheetAt(0).getRow(0).getCell(i); Cell cell_formula = wb.getSheetAt(0).getRow(1).getCell(i); CellValue cv_noformula = evaluator.evaluate(cell_noformula); CellValue cv_formula = evaluator.evaluate(cell_formula); System.out.println("Cell " + i + ": no formula = " + cv_noformula.getNumberValue() + ", formula = " + cv_formula.getNumberValue()); } OS: Windows 7 POI: 3.7-beta3 Java: 1.6.0_20 64-bit
Created attachment 26177 [details] Excel file for bug reproduction
Fixed in r1033556, junit added. Yegor