Hi. I want to check different formula cell. Therefore I looped over a row and
check the cells whether they are formula-cells or not. In case they are I
evaluate them to get information about their errorstatus. Now the question:
how can I find out, what kind of error it is (#DIV/0 or #VALUE or #NAME...).
I treid it with the following code without success.
if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA)
{
cellRefernce = (new
CellReference(row.getRowNum(),
cell.getCellNum())).formatAsString().replace("$", "");
esheet.addFormCell(cellRefernce, cell);
System.out.println((new
CellReference(row.getRowNum(),
cell.getCellNum()))
.formatAsString().replace("$", "") + " - " + cell.toString());
int errCode;
switch(errCode =
evaluator.evaluateFormulaCell(cell))
{
case HSSFCell.CELL_TYPE_ERROR:
if(errCode ==
HSSFCell.ERROR_DIV0.getType())
System.out.println(cellRefernce + " is div/0-error-cell");
if(errCode ==
HSSFCell.ERROR_VALUE.getType())
System.out.println(cellRefernce + " is value-error-cell");
if(errCode ==
HSSFCell.ERROR_NAME.getType())
System.out.println(cellRefernce + " is name-error-cell");
if(errCode ==
HSSFCell.ERROR_REF.getType())
System.out.println(cellRefernce + " is ref-error-cell");
if(errCode ==
HSSFCell.ERROR_NUM.getType())
System.out.println(cellRefernce + " is num-error-cell");
if(errCode ==
HSSFCell.ERROR_NULL.getType())
System.out.println(cellRefernce + " is null-error-cell");
if(errCode ==
HSSFCell.ERROR_NA.getType())
System.out.println(cellRefernce + " is na-error-cell");
break;
}
}
Has anyone a solution how i get this information?
Hardie
--
View this message in context:
http://www.nabble.com/Wich-error-by-formula-evaluation--tp19972882p19972882.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]