Apache POI evaluate formula

后端 未结 4 695
逝去的感伤
逝去的感伤 2020-12-01 21:41

I have some formulas in cells of my sheet, and I want to evaluate them after I insert some values. Ex :

My formula is =SUM(B1,B2)

Before values

4条回答
  •  甜味超标
    2020-12-01 22:33

    Perhaps XSSFFormulaEvaluator.evaluateAllFormulaCells(XSSFWorkbook wb) ?

    (or more specifically: evaluateFormulaCell(Cell cell).)

    If it doesn't work: what version of POI are you using? Formulas in XSSF are supported from v3.5.

    Also, try to use XSSFCreationHelper to instantiate your Formula Evaluator as suggested by the POI docs.

提交回复
热议问题