Hi,

you should look at the HSSFFormulaEvaluator class.

Pierre

Thanks Pierre. Unfortunately, the HSSFFormulaEvaluator causes problems too:

public String getStringFromCell(HSSFCell cell)
{
        String val = cell.toString();
        if(cell.getCellType()==HSSFCell.CELL_TYPE_NUMERIC) {
                //some stuff
        }
        else if(cell.getCellType()==HSSFCell.CELL_TYPE_FORMULA) {
                val = getStringFromCell(fe.evaluateInCell(cell));
        }

        return val;
}

Exception in thread "main" java.lang.RuntimeException: Error Value can only be 0
,7,15,23,29,36 or 42. It cannot be -60
at org.apache.poi.hssf.record.BoolErrRecord.setValue(BoolErrRecord.java:124) at org.apache.poi.hssf.usermodel.HSSFCell.setCellErrorValue(HSSFCell.java:755) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.setCellValue(HSSFFormulaEvaluator.java:267) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:239)

HSSFFormulaEvaluator doesn't like circular references; I don't blame it.

The alternate: HSSFFormulaEvaluator.CellValue v = fe.evaluate(cell).
This is ugly, I think, as I have to (re)check the type of the CellValue before I can get the value.

On a related note, when is a non-formula cell an error cell?

-Skye

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to