https://issues.apache.org/bugzilla/show_bug.cgi?id=47358
Josh Micich <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #2 from Josh Micich <[email protected]> 2009-06-11 13:18:06 PST --- You need to tell POI about all workbooks involved in the evaluation. This is done with the method HSSFFormulaEvaluator.setupEnvironment() You can get away with not doing this if the cell you are evaluation does not depend on the other workbook(s). However, in your case the other workbook is required (hence the error). ---- ---- Here is some sample code: String dirName = "c:/somedir/"; String bookNameA = "test.xls"; String bookNameB = "rm0509.xls"; HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(dirName + bookNameA)); HSSFWorkbook wbB = new HSSFWorkbook(new FileInputStream(dirName + bookNameB)); HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb); HSSFFormulaEvaluator feB = new HSSFFormulaEvaluator(wbB); // Set up the workbook environment for evaluation String[] workbookNames = { bookNameA, bookNameB, }; HSSFFormulaEvaluator[] evaluators = { evaluator, feB, }; HSSFFormulaEvaluator.setupEnvironment(workbookNames, evaluators); // do an evaluation HSSFCell cell = wb.getSheetAt(0).getRow(0).getCell(0); evaluator.evaluateFormulaCell(cell); ---- ---- This feature is currently only implemented for HSSF. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
