Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xssf.usermodel
Class XSSFFormulaEvaluator

    java.lang.Object
      org.apache.poi.ss.formula.BaseFormulaEvaluator
          org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator
              org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator

All Implemented Interfaces:
  WorkbookEvaluatorProvider, FormulaEvaluator

    public final class XSSFFormulaEvaluator

extends BaseXSSFFormulaEvaluator

Evaluates formula cells.

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.

Field Summary

Fields inherited from class org.apache.poi.ss.formula.BaseFormulaEvaluator
`_bookEvaluator`

Constructor Summary
`` | `XSSFFormulaEvaluator(XSSFWorkbook workbook)`
`protected` | `XSSFFormulaEvaluator(XSSFWorkbook workbook, WorkbookEvaluator bookEvaluator)`

Method Summary
`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.
`protected EvaluationCell` | `toEvaluationCell(Cell cell)` Turns a XSSFCell into a XSSFEvaluationCell

Methods inherited from class org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator
`createRichTextString, evaluateFormulaCellValue, notifyDeleteCell, notifySetFormula, notifyUpdateCell`

Methods inherited from class org.apache.poi.ss.formula.BaseFormulaEvaluator
`_getWorkbookEvaluator, clearAllCachedResultValues, evaluate, evaluateAllFormulaCells, evaluateAllFormulaCells, evaluateFormulaCell, evaluateFormulaCellEnum, setCellType, setCellValue, setDebugEvaluationOutputForNextEval, setIgnoreMissingWorkbooks, setupEnvironment, setupReferencedWorkbooks`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XSSFFormulaEvaluator

    public XSSFFormulaEvaluator(XSSFWorkbook workbook)

### XSSFFormulaEvaluator

    protected XSSFFormulaEvaluator(XSSFWorkbook workbook,
                                   WorkbookEvaluator bookEvaluator)

Method Detail

### create

    public static XSSFFormulaEvaluator create(XSSFWorkbook workbook,
                                              IStabilityClassifier stabilityClassifier,
                                              UDFFinder udfFinder)

  Parameters:
    `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)

### evaluateAllFormulaCells

    public static void evaluateAllFormulaCells(XSSFWorkbook wb)

  Loops over all cells in all sheets of the supplied workbook. For cells that contain formulas, their formulas are evaluated, and the results are saved. These cells remain as formula cells. For cells that do not contain formulas, no changes are made. This is a helpful wrapper around looping over all cells, and calling evaluateFormulaCell on each one.

### evaluateInCell

    public XSSFCell evaluateInCell(Cell cell)

  Description copied from class: `BaseFormulaEvaluator`
  If cell contains formula, it evaluates the formula, and puts the formula result back into the cell, in place of the old formula. Else if cell does not contain formula, this method leaves the cell unchanged. Note that the same instance of HSSFCell 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.evaluateFormulaCellEnum(Cell)`}

  Specified by:
    `evaluateInCell` in interface `FormulaEvaluator`
  Overrides:
    `evaluateInCell` in class `BaseFormulaEvaluator`
  Returns:
    the `cell` that was passed in, allowing for chained calls

### evaluateAll

    public void evaluateAll()

  Loops over all cells in all sheets of the supplied workbook. For cells that contain formulas, their formulas are evaluated, and the results are saved. These cells remain as formula cells. For cells that do not contain formulas, no changes are made. This is a helpful wrapper around looping over all cells, and calling evaluateFormulaCell on each one.

### toEvaluationCell

    protected EvaluationCell toEvaluationCell(Cell cell)

  Turns a XSSFCell into a XSSFEvaluationCell

  Specified by:
    `toEvaluationCell` in class `BaseXSSFFormulaEvaluator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.