Hi,
I'm very new to POI API. I can not able to print the Date Values and Boolan Values when I read the excel sheet. I have written the following code:-
cell = row.getCell((short)colIndex);
if (cell != null) {
System.out.println("Cell Type >>> " + cell.getCellType());
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC :
System.out.println("Numeric : " + cell.getNumericCellValue());
break;
case HSSFCell.CELL_TYPE_STRING :
System.out.println("String : " + cell.getStringCellValue());
break;
case HSSFCell.CELL_TYPE_BLANK :
System.out.println("Blank : " + cell.getStringCellValue());
break;
case HSSFCell.CELL_TYPE_BOOLEAN :
System.out.println("Boolean : " + cell.getBooleanCellValue());
break;
case HSSFCell.CELL_TYPE_ERROR :
System.out.println("Error : " + cell.getErrorCellValue());
break;
case HSSFCell.CELL_TYPE_FORMULA :
System.out.println("Formula : " + cell.getCellFormula());
break;
default :
//Date
if(HSSFDateUtil.isCellDateFormatted(cell)) {
System.out.println("Date : " + cell.getDateCellValue());
}
}
}
cell.getCellType() returns NUMERIC or FORMULA or STRING, how can I check for DATE, BOOLEAN and BLANK SPACE?
Any one can help me to solve this issue?
Thanks..