|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.hssf.usermodel.HSSFFormulaEvaluator
public class HSSFFormulaEvaluator
| Nested Class Summary | |
|---|---|
static class |
HSSFFormulaEvaluator.CellValue
Mimics the 'data view' of a cell. |
| Field Summary | |
|---|---|
protected HSSFRow |
row
|
protected HSSFSheet |
sheet
|
protected HSSFWorkbook |
workbook
|
| Constructor Summary | |
|---|---|
HSSFFormulaEvaluator(HSSFSheet sheet,
HSSFWorkbook workbook)
|
|
| Method Summary | |
|---|---|
HSSFFormulaEvaluator.CellValue |
evaluate(HSSFCell cell)
If cell contains a formula, the formula is evaluated and returned, else the CellValue simply copies the appropriate cell value from the cell and also its cell type. |
int |
evaluateFormulaCell(HSSFCell cell)
If cell contains formula, it evaluates the formula, and saves the result of the formula. |
HSSFCell |
evaluateInCell(HSSFCell cell)
If cell contains formula, it evaluates the formula, and puts the formula result back into the cell, in place of the old formula. |
protected static HSSFFormulaEvaluator.CellValue |
getCellValueForEval(ValueEval eval)
Returns a CellValue wrapper around the supplied ValueEval instance. |
protected static ValueEval |
getEvalForCell(HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
Given a cell, find its type and from that create an appropriate ValueEval impl instance and return that. |
protected static Eval |
getEvalForPtg(Ptg ptg)
returns an appropriate Eval impl instance for the Ptg. |
protected static Eval |
getOperationEvalForPtg(OperationPtg ptg)
returns the OperationEval concrete impl instance corresponding to the suplied operationPtg |
static FormulaParser |
getUnderlyingParser(HSSFWorkbook workbook,
java.lang.String formula)
Returns an underlying FormulaParser, for the specified Formula String and HSSFWorkbook. |
protected static ValueEval |
internalEvaluate(HSSFCell srcCell,
HSSFRow srcRow,
HSSFSheet sheet,
HSSFWorkbook workbook)
Dev. |
protected static void |
pushRef2DEval(ReferencePtg ptg,
java.util.Stack stack,
HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
create a Ref2DEval for ReferencePtg and push it on the stack. |
protected static void |
pushRef3DEval(Ref3DPtg ptg,
java.util.Stack stack,
HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
create a Ref3DEval for Ref3DPtg and push it on the stack. |
void |
setCurrentRow(HSSFRow row)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HSSFRow row
protected HSSFSheet sheet
protected HSSFWorkbook workbook
| Constructor Detail |
|---|
public HSSFFormulaEvaluator(HSSFSheet sheet,
HSSFWorkbook workbook)
| Method Detail |
|---|
public void setCurrentRow(HSSFRow row)
public static FormulaParser getUnderlyingParser(HSSFWorkbook workbook,
java.lang.String formula)
public HSSFFormulaEvaluator.CellValue evaluate(HSSFCell cell)
cell - public int evaluateFormulaCell(HSSFCell cell)
int evaluatedCellType = evaluator.evaluateFormulaCell(cell);Be aware that your cell will hold both the formula, and the result. If you want the cell replaced with the result of the formula, use
evaluateInCell(HSSFCell)
cell - The cell to evaluate
public HSSFCell evaluateInCell(HSSFCell cell)
int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();Be aware that your cell value will be changed to hold the result of the formula. If you simply want the formula value computed for you, use
evaluateFormulaCell(HSSFCell)
cell - protected static HSSFFormulaEvaluator.CellValue getCellValueForEval(ValueEval eval)
eval -
protected static ValueEval internalEvaluate(HSSFCell srcCell,
HSSFRow srcRow,
HSSFSheet sheet,
HSSFWorkbook workbook)
srcCell - srcRow - sheet - workbook - protected static Eval getOperationEvalForPtg(OperationPtg ptg)
ptg - protected static Eval getEvalForPtg(Ptg ptg)
ptg -
protected static ValueEval getEvalForCell(HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
cell - sheet - workbook -
protected static void pushRef2DEval(ReferencePtg ptg,
java.util.Stack stack,
HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
ptg - stack - cell - sheet - workbook -
protected static void pushRef3DEval(Ref3DPtg ptg,
java.util.Stack stack,
HSSFCell cell,
HSSFRow row,
HSSFSheet sheet,
HSSFWorkbook workbook)
ptg - stack - cell - sheet - workbook -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||