>From your second posting:
> The printed value is always the same even if in Excel
> file if I do the recalculation I receive different values.

This sounds like a potential bug. Can you reduce your java code and
XLS file(s) to a simple example that still demonstrates the problem?

BTW
> evaluator.clearAllCachedResultValues();
This is a performance hit (but should not cause a bug).  You should
only need to call this when making major changes to the spreadsheet -
like shifting rows or adding/deleting sheets.  Typically you're
setting single input cells before evaluation and methods like
notifyUpdateCell(), notifySetFormula() are all you need to call.



Your most recent problem:
> java.lang.RuntimeException: Specified sheet from a different book

This means that you have passed a cell from one workbook to an
evaluator of a different workbook.  It has nothing to do with the
actual formula in any cell.  Here is some sample code which shows this
problem:

HSSFWorkbook wbA = ... ;
HSSFWorkbook wbB = ... ;
HSSFFormulaEvaluator evaluatorA = new HSSFFormulaEvaluator(wbA);
HSSFFormulaEvaluator evaluatorB = new HSSFFormulaEvaluator(wbB);

// Hook up the workbook evaluators to enable evaluation of formulas across books
String[] bookNames = { "multibookFormulaA.xls", "multibookFormulaB.xls", };
HSSFFormulaEvaluator[] evaluators = { evaluatorA, evaluatorB, };
HSSFFormulaEvaluator.setupEnvironment(bookNames, evaluators);

HSSFCell cellA = wbA..getSheetAt(0).getRow(0).getCell(0);
evaluatorA.evaluate(cellA); // OK
evaluatorB.evaluate(cellA); // error: "Specified sheet from a different book"

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

Reply via email to