Reputation:
How can i replace HSSFCell.CELL_TYPE_STRING in POI 4.1.
if (row.getCell(0).getCellType() == HSSFCell.CELL_TYPE_STRING) {
System.out.println(row.getCell(0).getStringCellValue());
}
Upvotes: 1
Views: 4579
Reputation: 61852
HSSFCell.getCellType returns a CellType now. So it needs to be compared to CellType.STRING
now instead to HSSFCell.CELL_TYPE_STRING
.
Cell cell = row.getCell(0);
if (cell != null) {
if (cell.getCellType() == CellType.STRING) {
System.out.println(cell.getStringCellValue());
}
}
Upvotes: 1