You are probably still running a very old version of POI. In those
versions it was best practice to check the cell type of the
evaluation result (rather than just assume CELL_TYPE_NUMERIC). You
are probably getting CELL_TYPE_ERROR due to INDIRECT not being
implemented in your version of POI. Make a small change to your test
code to see:
----------------
public static void main(String[] args) throws IOException {
HSSFWorkbook wbA = new HSSFWorkbook(new
FileInputStream("c:/josh/temp/Book1.xls"));
wbA.getSheetAt(0).getRow(1).getCell(0).setCellValue("Sheet2");
HSSFFormulaEvaluator evalA = new HSSFFormulaEvaluator(wbA);
CellValue cv = evalA.evaluate(wbA.getSheetAt(0).getRow(3).getCell(0));
if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
System.err.println("Wrong result type - got " +
cv.getCellType());
return;
}
System.err.println("Cell A4=" + cv.getNumberValue());
}
--------------
This change is not required if you are running anything newer than
version 3.5-beta4. Since then unimplemented functions cause
NotImplementedException to be thrown
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]