Allow users to get a FormulaParser armed only with a HSSFWorkbook, through a convenience method on HSSFFormulaEvaluator
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@584721 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7774616a7d
commit
c7476faf25
@ -74,10 +74,17 @@ public class FormulaParser {
|
||||
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;
|
||||
|
@ -1019,7 +1019,7 @@ public class HSSFWorkbook extends POIDocument
|
||||
return workbook.getSSTString(index).getString();
|
||||
}
|
||||
|
||||
Workbook getWorkbook()
|
||||
protected Workbook getWorkbook()
|
||||
{
|
||||
return workbook;
|
||||
}
|
||||
|
@ -165,6 +165,17 @@ public class HSSFFormulaEvaluator {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user