public final class XSSFFormulaEvaluator extends BaseXSSFFormulaEvaluator
For performance reasons, this class keeps a cache of all previously calculated intermediate
cell values. Be sure to call BaseFormulaEvaluator.clearAllCachedResultValues()
if any workbook cells are changed between
calls to evaluate~ methods on this class.
_bookEvaluator
Modifier | Constructor and Description |
---|---|
|
XSSFFormulaEvaluator(XSSFWorkbook workbook) |
protected |
XSSFFormulaEvaluator(XSSFWorkbook workbook,
WorkbookEvaluator bookEvaluator) |
Modifier and Type | Method and Description |
---|---|
static XSSFFormulaEvaluator |
create(XSSFWorkbook workbook,
IStabilityClassifier stabilityClassifier,
UDFFinder udfFinder) |
void |
evaluateAll()
Loops over all cells in all sheets of the supplied
workbook.
|
static void |
evaluateAllFormulaCells(XSSFWorkbook wb)
Loops over all cells in all sheets of the supplied
workbook.
|
XSSFCell |
evaluateInCell(Cell cell)
If cell contains formula, it evaluates the formula, and
puts the formula result back into the cell, in place
of the old formula.
|
void |
notifyDeleteCell(Cell cell)
Should be called to tell the cell value cache that the specified cell has just become a
formula cell, or the formula text has changed
|
void |
notifySetFormula(Cell cell)
Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.
|
void |
notifyUpdateCell(Cell cell)
Should be called to tell the cell value cache that the specified (value or formula) cell
has changed.
|
protected EvaluationCell |
toEvaluationCell(Cell cell)
Turns a XSSFCell into a XSSFEvaluationCell
|
createRichTextString, evaluateFormulaCellValue, setCellType
_getWorkbookEvaluator, clearAllCachedResultValues, evaluate, evaluateAllFormulaCells, evaluateAllFormulaCells, evaluateFormulaCell, getEvaluationWorkbook, setCellType, setCellValue, setDebugEvaluationOutputForNextEval, setIgnoreMissingWorkbooks, setupEnvironment, setupReferencedWorkbooks
public XSSFFormulaEvaluator(XSSFWorkbook workbook)
protected XSSFFormulaEvaluator(XSSFWorkbook workbook, WorkbookEvaluator bookEvaluator)
public static XSSFFormulaEvaluator create(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
stabilityClassifier
- used to optimise caching performance. Pass null
for the (conservative) assumption that any cell may have its definition changed after
evaluation begins.udfFinder
- pass null
for default (AnalysisToolPak only)public void notifySetFormula(Cell cell)
FormulaEvaluator
public void notifyDeleteCell(Cell cell)
FormulaEvaluator
public void notifyUpdateCell(Cell cell)
FormulaEvaluator
public static void evaluateAllFormulaCells(XSSFWorkbook wb)
public XSSFCell evaluateInCell(Cell cell)
BaseFormulaEvaluator
Cell
is returned to
allow chained calls like:
int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();Be aware that your cell value will be changed to hold the result of the formula. If you simply want the formula value computed for you, use
BaseFormulaEvaluator.evaluateFormulaCell(Cell)
}evaluateInCell
in interface FormulaEvaluator
evaluateInCell
in class BaseFormulaEvaluator
cell
- The Cell
to evaluate and modify.cell
that was passed in, allowing for chained callspublic void evaluateAll()
protected EvaluationCell toEvaluationCell(Cell cell)
toEvaluationCell
in class BaseXSSFFormulaEvaluator
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.