diff --git a/src/documentation/content/xdocs/spreadsheet/eval.xml b/src/documentation/content/xdocs/spreadsheet/eval.xml index 7cb670019..42d481035 100644 --- a/src/documentation/content/xdocs/spreadsheet/eval.xml +++ b/src/documentation/content/xdocs/spreadsheet/eval.xml @@ -319,16 +319,16 @@ for(int sheetNum = 0; sheetNum < 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 diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java index ba27d8244..d301c7388 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java @@ -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); } diff --git a/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java b/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java index adbb685ff..17bb3bd57 100644 --- a/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java +++ b/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java @@ -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); + } diff --git a/src/java/org/apache/poi/ss/util/SheetUtil.java b/src/java/org/apache/poi/ss/util/SheetUtil.java index a0430a76a..a5c1fb736 100644 --- a/src/java/org/apache/poi/ss/util/SheetUtil.java +++ b/src/java/org/apache/poi/ss/util/SheetUtil.java @@ -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) { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java index 77981db30..4a429f4b4 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java @@ -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); + } + }