Index: src/documentation/content/xdocs/spreadsheet/eval.xml =================================================================== --- src/documentation/content/xdocs/spreadsheet/eval.xml (revision 1381157) +++ src/documentation/content/xdocs/spreadsheet/eval.xml (working copy) @@ -309,32 +309,33 @@
Formula Evaluation Debugging -

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.

-

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.

-

Example use:

- - // 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(); +

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.

+

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.

+

Example use:

+ + // 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")); + FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); + + // get your cell + Cell cell = wb.getSheet(0).getRow(0).getCell(0); // just a dummy example - // 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 + evaluator.setDebugEvaluationOutputForNextEval(true); + evaluator.evaluateFormulaCell(cell); + evaluator.evaluateFormulaCell(cell); // no logging performed for this next evaluate-call + +

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.

+
- // 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 - -

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.

- Index: src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java (revision 1381157) +++ src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java (working copy) @@ -114,4 +114,15 @@ * @param cell */ Cell evaluateInCell(Cell cell); + + /** + * Perform detailed output of formula evaluation for next evaluation only? + * Is for developer use only (also developers using POI for their XLS files). + * Log-Level WARN is for basic info, INFO for detailed information. These quite + * high levels are used because you have to explicitly enable this specific logging. + + * @param value whether to perform detailed output + */ + void setDebugEvaluationOutputForNextEval(boolean value); + } Index: src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java (revision 1381157) +++ src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java (working copy) @@ -389,14 +389,7 @@ _bookEvaluator.setIgnoreMissingWorkbooks(ignore); } - /** - * @param value whether perform detailed output - * - * Perform detailed output of formula evaluation for next evaluation only? - * Is for developer use only (also developers using POI for their XLS files). - * Log-Level WARN is for basic info, INFO for detailed information. These quite - * high levels are used because you have to explicitly enable this specific logging. - */ + /** {@inheritDoc} */ public void setDebugEvaluationOutputForNextEval(boolean value){ _bookEvaluator.setDebugEvaluationOutputForNextEval(value); } Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java (revision 1381157) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java (working copy) @@ -279,4 +279,10 @@ } throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")"); } + + /** {@inheritDoc} */ + public void setDebugEvaluationOutputForNextEval(boolean value){ + _bookEvaluator.setDebugEvaluationOutputForNextEval(value); + } + }