org.apache.poi.xssf.streaming

## Class SXSSFFormulaEvaluator

- java.lang.Object
- - org.apache.poi.ss.formula.BaseFormulaEvaluator
  - - org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator
    - - org.apache.poi.xssf.streaming.SXSSFFormulaEvaluator

- All Implemented Interfaces:
    WorkbookEvaluatorProvider, FormulaEvaluator

      public final class SXSSFFormulaEvaluator
      extends BaseXSSFFormulaEvaluator

  Streaming-specific Formula Evaluator, which is able to lookup cells within the current Window.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SXSSFFormulaEvaluator.RowFlushedException`
    `static class` | `SXSSFFormulaEvaluator.SheetsFlushedException`

  - ### Field Summary

    - ### Fields inherited from class org.apache.poi.ss.formula.BaseFormulaEvaluator

      `_bookEvaluator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SXSSFFormulaEvaluator(SXSSFWorkbook workbook)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SXSSFFormulaEvaluator` | `create(SXSSFWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)`
    `void` | `evaluateAll()` Loops over rows and cells, evaluating formula cells there.
    `static void` | `evaluateAllFormulaCells(SXSSFWorkbook wb, boolean skipOutOfWindow)` For active worksheets only, will loop over rows and cells, evaluating formula cells there.
    `SXSSFCell` | `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 SXSSFCell into a SXSSFEvaluationCell

    - ### Methods inherited from class org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator

      `createRichTextString, evaluateFormulaCellValue, setCellType`

    - ### Methods inherited from class org.apache.poi.ss.formula.BaseFormulaEvaluator

      `_getWorkbookEvaluator, clearAllCachedResultValues, evaluate, evaluateAllFormulaCells, evaluateAllFormulaCells, evaluateFormulaCell, evaluateFormulaCellEnum, getEvaluationWorkbook, 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

    - #### SXSSFFormulaEvaluator

          public SXSSFFormulaEvaluator(SXSSFWorkbook workbook)

  - ### Method Detail

    - #### create

          public static SXSSFFormulaEvaluator create(SXSSFWorkbook 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)

    - #### notifySetFormula

          public void notifySetFormula(Cell cell)

      Description copied from interface: `FormulaEvaluator`
      Should be called to tell the cell value cache that the specified (value or formula) cell has changed. Failure to call this method after changing cell values will cause incorrect behaviour of the evaluate~ methods of this class

    - #### notifyDeleteCell

          public void notifyDeleteCell(Cell cell)

      Description copied from interface: `FormulaEvaluator`
      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

    - #### notifyUpdateCell

          public void notifyUpdateCell(Cell cell)

      Description copied from interface: `FormulaEvaluator`
      Should be called to tell the cell value cache that the specified (value or formula) cell has changed. Failure to call this method after changing cell values will cause incorrect behaviour of the evaluate~ methods of this class

    - #### toEvaluationCell

          protected EvaluationCell toEvaluationCell(Cell cell)

      Turns a SXSSFCell into a SXSSFEvaluationCell
      Specified by:
        `toEvaluationCell` in class `BaseXSSFFormulaEvaluator`

    - #### evaluateInCell

          public SXSSFCell 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 `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)`}
      Specified by:
        `evaluateInCell` in interface `FormulaEvaluator`
      Overrides:
        `evaluateInCell` in class `BaseFormulaEvaluator`
      Parameters:
        `cell` - The `Cell` to evaluate and modify.
      Returns:
        the `cell` that was passed in, allowing for chained calls

    - #### evaluateAllFormulaCells

          public static void evaluateAllFormulaCells(SXSSFWorkbook wb,
                                                     boolean skipOutOfWindow)

      For active worksheets only, will loop over rows and cells, evaluating formula cells there. If formula cells are outside the window for that sheet, it can either skip them silently, or give an exception

    - #### evaluateAll

          public void evaluateAll()

      Loops over rows and cells, evaluating formula cells there. If any sheets are inactive, or any cells outside of the window, will give an Exception. For SXSSF, you generally don't want to use this method, instead evaluate your formulas as you go before they leave the window.

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