/** * 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, FormulaParsingWorkbook book, int sheetIndex) { formulaString = formula; pointer = 0; this.book = book; _ssVersion = book == null ? SpreadsheetVersion.EXCEL97 : book.GetSpreadsheetVersion(); formulaLength = formulaString.Length; _sheetIndex = sheetIndex; }
public static Ptg[] Parse(String formula, FormulaParsingWorkbook workbook, FormulaType formulaType) { return Parse(formula, workbook, formulaType, -1); }
public static Ptg[] Parse(String formula, FormulaParsingWorkbook book) { return Parse(formula, book, FormulaType.CELL); }
/** * Parse a formula into a array of tokens * * @param formula the formula to parse * @param workbook the parent workbook * @param formulaType the type of the formula, see {@link FormulaType} * @param sheetIndex the 0-based index of the sheet this formula belongs to. * The sheet index is required to resolve sheet-level names. <code>-1</code> means that * the scope of the name will be ignored and the parser will match names only by name * * @return array of parsed tokens * @throws FormulaParseException if the formula is unparsable */ public static Ptg[] Parse(String formula, FormulaParsingWorkbook workbook, FormulaType formulaType, int sheetIndex) { FormulaParser fp = new FormulaParser(formula, workbook, sheetIndex); fp.Parse(); return fp.GetRPNPtg(formulaType); }
/** * 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, FormulaParsingWorkbook book) { formulaString = formula; pointer = 0; this.book = book; formulaLength = formulaString.Length; }