]> source.dussan.org Git - poi.git/commitdiff
bugzilla ticket 53642: added detailed logging for formula evaluation in both HSSF...
authorEvgeniy Berlog <berlog@apache.org>
Wed, 5 Sep 2012 17:03:55 +0000 (17:03 +0000)
committerEvgeniy Berlog <berlog@apache.org>
Wed, 5 Sep 2012 17:03:55 +0000 (17:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1381249 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/spreadsheet/eval.xml
src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
src/java/org/apache/poi/ss/util/SheetUtil.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java

index 7cb6700196f11eb330934a8970b021d7f2c7953a..42d481035aabfa6bc15f404f4ee8e51af071834c 100644 (file)
@@ -319,16 +319,16 @@ for(int sheetNum = 0; sheetNum &lt; wb.getNumberOfSheets(); sheetNum++) {
        // 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();
+    FormulaEvaluator evaluator = 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.setDebugEvaluationOutputForNextEval(true);
        evaluator.evaluateFormulaCell(cell);
        evaluator.evaluateFormulaCell(cell);            // no logging performed for this next evaluate-call
                </source>
index ba27d82445f8992031ecaa31fc1a31b1ccf658ff..d301c7388b92b4e357dfbf773a222ba25ab0faf5 100644 (file)
@@ -389,14 +389,7 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator  {
         _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 adbb685ffbd60a699b6050692f3eb32c3e830ba7..17bb3bd579f00a4caa6641c102ccfe555e744fd3 100644 (file)
@@ -114,4 +114,15 @@ public interface FormulaEvaluator {
      * @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 a0430a76a9ac2f38130c2740ffac1dd7f9500cf4..a5c1fb736db792ef67b6863a3c9b4fe384dcb56f 100644 (file)
@@ -61,6 +61,8 @@ public class SheetUtil {
         public void notifyUpdateCell(Cell cell) {}
         public CellValue evaluate(Cell cell) {return null;  }
         public Cell evaluateInCell(Cell cell) { return null; }
+        public void setDebugEvaluationOutputForNextEval(boolean value) {}
+
         public void evaluateAll() {}
 
         public int evaluateFormulaCell(Cell cell) {
index 77981db30188cda481ce18cd371fc138db07c43d..4a429f4b429145b7b22c3a4a23848441d3425b8c 100644 (file)
@@ -279,4 +279,10 @@ public class XSSFFormulaEvaluator implements FormulaEvaluator {
                }
                throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
        }
+       
+    /** {@inheritDoc} */
+    public void setDebugEvaluationOutputForNextEval(boolean value){
+        _bookEvaluator.setDebugEvaluationOutputForNextEval(value);
+    }
+
 }