I have a problem about formula evaluation and the code causing this problem
looks like the following one:

String formula = "IF(F2<>\"\",CONCATENATE(F2,\" \",G2),G2)";
cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
cell.setCellFormula(formula);

In detail, when both F2 and G2 cells are filled with some text, the problem
occurs but when F2 contains empty string, the problem does not occur.

I add a text into F2 cell with a code like in the following:

String str = "foo";
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue(str);

Excel complains about it (#VALUE!) when the workbook is first opened. However,
it is enough just to press F2, Enter on a cell for the function to start
evaluating properly. Interestingly, this problem does not appear in OpenOffice.

PS: all cell variables have the type of HSSFCell.


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

Reply via email to