bugzilla ticket 53642: added detailed logging for formula evaluation in both HSSF and XSSF modules
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1381249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0db6f31a0
commit
ddbbd7ba32
@ -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
|
||||
</source>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user