@Internal public final class HSSFFormulaParser extends java.lang.Object
FormulaParser
and FormulaRenderer
Modifier and Type | Method and Description |
---|---|
static Ptg[] |
parse(java.lang.String formula,
HSSFWorkbook workbook)
Convenience method for parsing cell formulas.
|
static Ptg[] |
parse(java.lang.String formula,
HSSFWorkbook workbook,
FormulaType formulaType) |
static Ptg[] |
parse(java.lang.String formula,
HSSFWorkbook workbook,
FormulaType formulaType,
int sheetIndex) |
static java.lang.String |
toFormulaString(HSSFWorkbook book,
Ptg[] ptgs)
Static method to convert an array of
Ptg s in RPN order
to a human readable string format in infix mode. |
public static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook) throws FormulaParseException
parse(String, HSSFWorkbook, FormulaType, int)
formula
- The formula to parse, excluding the leading equals signworkbook
- The parent workbookFormulaParseException
- if the formula has incorrect syntax or is otherwise invalidpublic static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, FormulaType formulaType) throws FormulaParseException
formula
- The formula to parse, excluding the leading equals signworkbook
- The parent workbookformulaType
- The type of formulaFormulaParseException
- if the formula has incorrect syntax or is otherwise invalidpublic static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, FormulaType formulaType, int sheetIndex) throws FormulaParseException
formula
- The formula to parseworkbook
- The parent workbookformulaType
- The type of formulasheetIndex
- The 0-based index of the sheet this formula belongs to.
The sheet index is required to resolve sheet-level names. -1
means that
the scope of the name will be ignored and the parser will match named ranges only by nameFormulaParseException
- if the formula has incorrect syntax or is otherwise invalidpublic static java.lang.String toFormulaString(HSSFWorkbook book, Ptg[] ptgs)
Ptg
s in RPN order
to a human readable string format in infix mode.book
- used for defined names and 3D referencesptgs
- must not be null
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.