Package org.apache.poi.hssf.model
Class HSSFFormulaParser
- java.lang.Object
-
- org.apache.poi.hssf.model.HSSFFormulaParser
-
@Internal public final class HSSFFormulaParser extends java.lang.Object
HSSF wrapper for theFormulaParser
andFormulaRenderer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 ofPtg
s in RPN order to a human readable string format in infix mode.
-
-
-
Method Detail
-
parse
public static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook) throws FormulaParseException
Convenience method for parsing cell formulas. seeparse(String, HSSFWorkbook, FormulaType, int)
- Parameters:
formula
- The formula to parse, excluding the leading equals signworkbook
- The parent workbook- Returns:
- the parsed formula tokens
- Throws:
FormulaParseException
- if the formula has incorrect syntax or is otherwise invalid
-
parse
public static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, FormulaType formulaType) throws FormulaParseException
- Parameters:
formula
- The formula to parse, excluding the leading equals signworkbook
- The parent workbookformulaType
- The type of formula- Returns:
- The parsed formula tokens
- Throws:
FormulaParseException
- if the formula has incorrect syntax or is otherwise invalid
-
parse
public static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, FormulaType formulaType, int sheetIndex) throws FormulaParseException
- Parameters:
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 name- Returns:
- the parsed formula tokens
- Throws:
FormulaParseException
- if the formula has incorrect syntax or is otherwise invalid
-
toFormulaString
public static java.lang.String toFormulaString(HSSFWorkbook book, Ptg[] ptgs)
Static method to convert an array ofPtg
s in RPN order to a human readable string format in infix mode.- Parameters:
book
- used for defined names and 3D referencesptgs
- must not benull
- Returns:
- a human readable String
-
-