I use following codes to read the formula in attached Excel: formula.xlsx. I found that except the first row, "c.getCellFormula()" return an empty string. In fact, other rows do contain formula. -- XSSFWorkbook wb = new XSSFWorkbook("formula.xlsx"); FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { Sheet sheet = wb.getSheetAt(sheetNum); for(Row r : sheet) { for(Cell c : r) { if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { System.out.println("c.getCellFormula():" + c.getCellFormula()); } } } } -- Please help. Thanks a lot!
Created attachment 23046 [details] formula.xlsx
Fixed in r728749. In some cases Excel attempts to optimize pervasive formulas. Instead of storing similar formula value in each cell, Excel stores a "master" formula and use it as a template. Other cells refer to the master formula by index and convert it to non-shared formula on the fly. This support was missing and you got an empty string instead. Yegor