//解决时间是数字的代码块
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
Date theDate = cell.getDateCellValue();
return simpleDateFormat.format(theDate);
} else {
return NumberToTextConverter.toText(cell.getNumericCellValue());
}
//完整方法代码块
private String getCellStringVal(Cell cell) {
CellType cellType = cell.getCellTypeEnum();
switch (cellType) {
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
Date theDate = cell.getDateCellValue();
return simpleDateFormat.format(theDate);
} else {
return NumberToTextConverter.toText(cell.getNumericCellValue());
}
case STRING:
return cell.getStringCellValue();
case BOOLEAN:
return String.valueOf(cell.getBooleanCellValue());
case FORMULA:
return cell.getCellFormula();
case BLANK:
return “”;
case ERROR:
return String.valueOf(cell.getErrorCellValue());
default:
return StringUtils.EMPTY;
}
}