diff options
Diffstat (limited to 'src/documentation/content/xdocs/spreadsheet/eval.xml')
-rw-r--r-- | src/documentation/content/xdocs/spreadsheet/eval.xml | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/documentation/content/xdocs/spreadsheet/eval.xml b/src/documentation/content/xdocs/spreadsheet/eval.xml index 5ff76effb5..7cb6700196 100644 --- a/src/documentation/content/xdocs/spreadsheet/eval.xml +++ b/src/documentation/content/xdocs/spreadsheet/eval.xml @@ -42,7 +42,7 @@ <section><title>Status</title> <p> The code currently provides implementations for all the arithmatic operators. It also provides implementations for approx. 140 built in - functions in Excel. The framework however makes is easy to add + functions in Excel. The framework however makes it easy to add implementation of new functions. See the <link href="eval-devguide.html"> Formula evaluation development guide</link> and <link href="../apidocs/org/apache/poi/hssf/record/formula/functions/package-summary.html">javadocs</link> for details. </p> @@ -249,7 +249,7 @@ for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { existing workbooks with formulas. This can be done in two ways: </p> <p> - 1. Re-evaluate formuals with POI's FormulaEvaluator: + 1. Re-evaluate formulas with POI's FormulaEvaluator: </p> <source> Workbook wb = WorkbookFactory.create(new FileInputStream("workbook.xls")); @@ -308,5 +308,33 @@ for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { </li> </ul> </section> + <section><title>Formula Evaluation Debugging</title> + <p>POI is not perfect and you may stumble across formula evaluation problems (Java exceptions + or just different results) in your special use case. To support an easy detailed analysis, a special + logging of the full evaluation is provided.</p> + <p>The output of this logging may be very large (depends on your EXCEL), so this logging has to be explicitly enabled + for each single formula evaluation. Should not be used in production - only for specific development use.</p> + <p>Example use:</p> + <source> + // activate logging to console + System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger"); + System.setProperty("poi.log.level", POILogger.INFO + ""); + + // open your file + Workbook wb = new HSSFWorkbook(new FileInputStream("foobar.xls")); + HSSFFormulaEvaluator fe = (HSSFFormulaEvaluator) wb.getCreationHelper().createFormulaEvaluator(); + + // get your cell + Cell cell = wb.getSheet(0).getRow(0).getCell(0); // just a dummy example + + // perform debug output for the next evaluate-call only + fe.setDebugEvaluationOutputForNextEval(true); + evaluator.evaluateFormulaCell(cell); + evaluator.evaluateFormulaCell(cell); // no logging performed for this next evaluate-call + </source> + <p>The special Logger called "POI.FormulaEval" is used (useful if you use the CommonsLogger and a detailed logging configuration). + The used log levels are WARN and INFO (for detailed parameter info and results) - the level are so high to allow this + special logging without beeing disturbed by the bunch of DEBUG log entries from other classes.</p> + </section> </body> </document> |