@Internal public final class FormulaParser extends java.lang.Object
<expression> ::= <term> [<addop> <term>]*
<term> ::= <factor> [ <mulop> <factor> ]*
<factor> ::= <number> | (<expression>) | <cellRef> | <function>
<function> ::= <functionName> ([expression [, expression]*])
For POI internal use only
Modifier and Type | Method and Description |
---|---|
static Ptg[] |
parse(java.lang.String formula,
FormulaParsingWorkbook workbook,
FormulaType formulaType,
int sheetIndex)
Parse a formula into an array of tokens
Side effect: creates name (
Workbook.createName() )
if formula contains unrecognized names (names are likely UDFs) |
static Ptg[] |
parse(java.lang.String formula,
FormulaParsingWorkbook workbook,
FormulaType formulaType,
int sheetIndex,
int rowIndex)
Parse a formula into an array of tokens
Side effect: creates name (
Workbook.createName() )
if formula contains unrecognized names (names are likely UDFs) |
static Area3DPxg |
parseStructuredReference(java.lang.String tableText,
FormulaParsingWorkbook workbook,
int rowIndex)
Parse a structured reference.
|
public static Ptg[] parse(java.lang.String formula, FormulaParsingWorkbook workbook, FormulaType formulaType, int sheetIndex, int rowIndex)
Workbook.createName()
)
if formula contains unrecognized names (names are likely UDFs)formula
- the formula to parseworkbook
- the parent workbookformulaType
- the type of the 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 names only by namerowIndex
- - the related cell's row index in 0-based form (-1 if the formula is not cell related)
used to handle structured references that have the "#This Row" quantifier.
Use rowIndex=-1 or parseStructuredReference(String, FormulaParsingWorkbook, int)
if formula
does not contain structured references.FormulaParseException
- if the formula has incorrect syntax or is otherwise invalidpublic static Ptg[] parse(java.lang.String formula, FormulaParsingWorkbook workbook, FormulaType formulaType, int sheetIndex)
Workbook.createName()
)
if formula contains unrecognized names (names are likely UDFs)formula
- the formula to parseworkbook
- the parent workbookformulaType
- the type of the 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 names only by nameFormulaParseException
- if the formula has incorrect syntax or is otherwise invalidpublic static Area3DPxg parseStructuredReference(java.lang.String tableText, FormulaParsingWorkbook workbook, int rowIndex)
tableText
- - The structured reference textworkbook
- - the parent workbookrowIndex
- - the 0-based cell's row index ( used to handle "#This Row" quantifiers )Copyright 2022 The Apache Software Foundation or its licensors, as applicable.