private Workbook book;
- /** create the parser with the string that is to be parsed
- * later call the parse() method to return ptg list in rpn order
- * then call the getRPNPtg() to retrive the parse results
- * This class is recommended only for single threaded use
+ /**
+ * Create the formula parser, with the string that is to be
+ * parsed against the supplied workbook.
+ * A later call the parse() method to return ptg list in
+ * rpn order, then call the getRPNPtg() to retrive the
+ * parse results.
+ * This class is recommended only for single threaded use.
+ *
+ * If you only have a usermodel.HSSFWorkbook, and not a
+ * model.Workbook, then use the convenience method on
+ * usermodel.HSSFFormulaEvaluator
*/
public FormulaParser(String formula, Workbook book){
formulaString = formula;
}
+ /**
+ * Returns an underlying FormulaParser, for the specified
+ * Formula String and HSSFWorkbook.
+ * This will allow you to generate the Ptgs yourself, if
+ * your needs are more complex than just having the
+ * formula evaluated.
+ */
+ public static FormulaParser getUnderlyingParser(HSSFWorkbook workbook, String formula) {
+ return new FormulaParser(formula, workbook.getWorkbook());
+ }
+
/**
* If cell contains a formula, the formula is evaluated and returned,
* else the CellValue simply copies the appropriate cell value from