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
@ -322,13 +322,13 @@ for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
|
|||||||
|
|
||||||
// open your file
|
// open your file
|
||||||
Workbook wb = new HSSFWorkbook(new FileInputStream("foobar.xls"));
|
Workbook wb = new HSSFWorkbook(new FileInputStream("foobar.xls"));
|
||||||
HSSFFormulaEvaluator fe = (HSSFFormulaEvaluator) wb.getCreationHelper().createFormulaEvaluator();
|
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
|
||||||
|
|
||||||
// get your cell
|
// get your cell
|
||||||
Cell cell = wb.getSheet(0).getRow(0).getCell(0); // just a dummy example
|
Cell cell = wb.getSheet(0).getRow(0).getCell(0); // just a dummy example
|
||||||
|
|
||||||
// perform debug output for the next evaluate-call only
|
// perform debug output for the next evaluate-call only
|
||||||
fe.setDebugEvaluationOutputForNextEval(true);
|
evaluator.setDebugEvaluationOutputForNextEval(true);
|
||||||
evaluator.evaluateFormulaCell(cell);
|
evaluator.evaluateFormulaCell(cell);
|
||||||
evaluator.evaluateFormulaCell(cell); // no logging performed for this next evaluate-call
|
evaluator.evaluateFormulaCell(cell); // no logging performed for this next evaluate-call
|
||||||
</source>
|
</source>
|
||||||
|
@ -389,14 +389,7 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator {
|
|||||||
_bookEvaluator.setIgnoreMissingWorkbooks(ignore);
|
_bookEvaluator.setIgnoreMissingWorkbooks(ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
public void setDebugEvaluationOutputForNextEval(boolean value){
|
public void setDebugEvaluationOutputForNextEval(boolean value){
|
||||||
_bookEvaluator.setDebugEvaluationOutputForNextEval(value);
|
_bookEvaluator.setDebugEvaluationOutputForNextEval(value);
|
||||||
}
|
}
|
||||||
|
@ -114,4 +114,15 @@ public interface FormulaEvaluator {
|
|||||||
* @param cell
|
* @param cell
|
||||||
*/
|
*/
|
||||||
Cell evaluateInCell(Cell 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 void notifyUpdateCell(Cell cell) {}
|
||||||
public CellValue evaluate(Cell cell) {return null; }
|
public CellValue evaluate(Cell cell) {return null; }
|
||||||
public Cell evaluateInCell(Cell cell) { return null; }
|
public Cell evaluateInCell(Cell cell) { return null; }
|
||||||
|
public void setDebugEvaluationOutputForNextEval(boolean value) {}
|
||||||
|
|
||||||
public void evaluateAll() {}
|
public void evaluateAll() {}
|
||||||
|
|
||||||
public int evaluateFormulaCell(Cell cell) {
|
public int evaluateFormulaCell(Cell cell) {
|
||||||
|
@ -279,4 +279,10 @@ public class XSSFFormulaEvaluator implements FormulaEvaluator {
|
|||||||
}
|
}
|
||||||
throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
|
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