org.apache.poi.hssf.model
Class HSSFFormulaParser

java.lang.Object
  extended by org.apache.poi.hssf.model.HSSFFormulaParser

public final class HSSFFormulaParser
extends java.lang.Object

HSSF wrapper for the FormulaParser and FormulaRenderer

Author:
Josh Micich

Method Summary
static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook)
          Convenience method for parsing cell formulas.
static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, int formulaType)
           
static Ptg[] parse(java.lang.String formula, HSSFWorkbook workbook, int formulaType, int sheetIndex)
           
static java.lang.String toFormulaString(HSSFWorkbook book, Ptg[] ptgs)
          Static method to convert an array of Ptgs in RPN order to a human readable string format in infix mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static Ptg[] parse(java.lang.String formula,
                          HSSFWorkbook workbook)
                   throws FormulaParseException
Convenience method for parsing cell formulas. see parse(String, HSSFWorkbook, int, int)

Throws:
FormulaParseException

parse

public static Ptg[] parse(java.lang.String formula,
                          HSSFWorkbook workbook,
                          int formulaType)
                   throws FormulaParseException
Parameters:
formulaType - a constant from FormulaType
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,
                          int formulaType,
                          int sheetIndex)
                   throws FormulaParseException
Parameters:
formula - the formula to parse
workbook - the parent workbook
formulaType - a constant from FormulaType
sheetIndex - 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 of Ptgs in RPN order to a human readable string format in infix mode.

Parameters:
book - used for defined names and 3D references
ptgs - must not be null
Returns:
a human readable String


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