Thanks for the explanation.
I will try to reproduce the problem and send a simple example.

Adrian

Josh Micich schreef:
It is not very clear now for me what to use: evaluateFormulaCell or
notifyUpdateCell?

For example if CellA receives new input and CellB  = Cell A+CellC  , CellC =
CellA + CellD and Cell E = CellA + CellB + CellC.
Which functions should I use to obtain the correct value of CellE?
The HSSFFormulaEvaluator.notify~() methods are only needed when
modifying spreadsheets *during* evaluation.  They are not needed if
all input values remain unchanged after calling any evaluate~()
method.

// one off evaluation:
cellA.setCellValue(5.0);  // CellA receives new input
CellValue result = evaluatorE.evaluate(cellE);

// for repeated re-calculations:
cellA.setCellValue(5.0);  // changing input value
evaluatorA.notifyUpdateCell(cellA);   // clear all cached result
values that depend on this
result = evaluatorE.evaluate(cellE);


About the error message I just can reconfirm that both evaluated cells are
in the same workbook and it should not give this error:

java.lang.RuntimeException: Specified sheet from a different book
If you are sure of this (i.e. that the evaluated cell is in the same
workbook as that of the evaluator), then you probably have found a
bug. Please upload a simple example based on the following (fill in
the '...' bits:

HSSFWorkbook wbA = ...
int sheetIndex = ...
int rowIndex = ...
int columnIndex = ...

HSSFFormulaEvaluator evaluatorA = new HSSFFormulaEvaluator(wbA);
// set up rest of multiple workbook environment
...

// evaluate cell
HSSFCell cellA =
wbA..getSheetAt(sheetIndex).getRow(rowIndex).getCell(columnIndex);
evaluatorA.evaluate(cellA); // unexpected crash "Specified sheet from
a different book"

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to