From: Nick Burch
Date: Sat, 29 Mar 2008 22:50:44 +0000 (+0000)
Subject: Update formula eval docs for xssf support
X-Git-Tag: REL_3_5_BETA2~157
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=83ee6d319c7cb5a7ee377cd58d012284e579d64a;p=poi.git
Update formula eval docs for xssf support
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@642637 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/src/documentation/content/xdocs/spreadsheet/eval.xml b/src/documentation/content/xdocs/spreadsheet/eval.xml
index a0d7ae4a77..7f31017edd 100644
--- a/src/documentation/content/xdocs/spreadsheet/eval.xml
+++ b/src/documentation/content/xdocs/spreadsheet/eval.xml
@@ -48,57 +48,59 @@
functions in Excel. The framework however makes is easy to add
implementation of new functions. See the Formula
evaluation development guide for details.
+
Both HSSFWorkbook and XSSFWorkbook are supported, so you can
+ evaluate formulas on both .xls and .xlsx files.
Note that user-defined functions are not supported, and is not likely to done
any time soon... at least, not till there is a VB implementation in Java!
User API How-TO
-
The following code demonstrates how to use the HSSFFormulaEvaluator
+
The following code demonstrates how to use the FormulaEvaluator
in the context of other POI excel reading code.
-
There are several ways in which you can use the HSSFFormulaEvalutator API.
+
There are several ways in which you can use the FormulaEvalutator API.
- Using HSSFFormulaEvaluator.evaluate(HSSFCell cell)
+ Using FormulaEvaluator.evaluate(Cell cell)
This evaluates a given cell, and returns the new value,
without affecting the cell
Thus using the retrieved value (of type
- HSSFFormulaEvaluator.CellValue - a nested class) returned
- by HSSFFormulaEvaluator is similar to using a HSSFCell object
+ FormulaEvaluator.CellValue - a nested class) returned
+ by FormulaEvaluator is similar to using a Cell object
containing the value of the formula evaluation. CellValue is
a simple value object and does not maintain reference
to the original cell.
@@ -106,46 +108,46 @@ switch (cellValue.getCellType()) {
- Using HSSFFormulaEvaluator.evaluateFormulaCell(HSSFCell cell)
-
evaluateFormulaCell(HSSFCell cell)
+ Using FormulaEvaluator.evaluateFormulaCell(Cell cell)
+
evaluateFormulaCell(Cell cell)
will check to see if the supplied cell is a formula cell.
If it isn't, then no changes will be made to it. If it is,
then the formula is evaluated. The value for the formula
is saved alongside it, to be displayed in excel. The
formula remains in the cell, just with a new value
The return of the function is the type of the
- formula result, such as HSSFCell.CELL_TYPE_BOOLEAN
+ formula result, such as Cell.CELL_TYPE_BOOLEAN
- Using HSSFFormulaEvaluator.evaluateInCell(HSSFCell cell)
-
evaluateInCell(HSSFCell cell) will check to
+ Using FormulaEvaluator.evaluateInCell(Cell cell)
+
evaluateInCell(Cell cell) will check to
see if the supplied cell is a formula cell. If it isn't,
then no changes will be made to it. If it is, then the
formula is evaluated, and the new value saved into the cell,
in place of the old formula.