All is in the title.
How can I check if a CELL_TYPE_NUMERIC
is empty with POI ?
With strings i can use the isEmpty()
method but with int
I have no ideas (null is not allowed and zero just wont do it).
Thank you in advance.
All is in the title.
How can I check if a CELL_TYPE_NUMERIC
is empty with POI ?
With strings i can use the isEmpty()
method but with int
I have no ideas (null is not allowed and zero just wont do it).
Thank you in advance.
Empty cells should not have format in POI since there is already a type for empty cells.
To check if the cell is empty you should test if the cell type is Cell.CELL_TYPE_BLANK
. Sometimes empty cells do not exist in a Row
; they will be null
in this case.
You can check the raw value of the cell
public BigDecimal determinePorpertyValue(XSSFCell cell) {
String rawValue = cell.getRawValue();
return rawValue == null ? null : BigDecimal.valueOf(cell.getNumericCellValue());
}