|
|
@@ -119,34 +119,15 @@ public class ExcelUtils {
|
|
|
cellValue = cell.toString();
|
|
|
break;
|
|
|
}
|
|
|
- //判断数据的类型
|
|
|
-// switch (cell.getCellType()) {
|
|
|
-// case Cell.CELL_TYPE_NUMERIC: //数字
|
|
|
-// cellValue = stringDateProcess(cell);
|
|
|
-// break;
|
|
|
-// case Cell.CELL_TYPE_STRING: //字符串
|
|
|
-// cellValue = String.valueOf(cell.getStringCellValue());
|
|
|
-// break;
|
|
|
-// case Cell.CELL_TYPE_BOOLEAN: //Boolean
|
|
|
-// cellValue = String.valueOf(cell.getBooleanCellValue());
|
|
|
-// break;
|
|
|
-// case Cell.CELL_TYPE_FORMULA: //公式
|
|
|
-// cellValue = String.valueOf(cell.getCellFormula());
|
|
|
-// break;
|
|
|
-// case Cell.CELL_TYPE_BLANK: //空值
|
|
|
-// cellValue = "";
|
|
|
-// break;
|
|
|
-// case Cell.CELL_TYPE_ERROR: //故障
|
|
|
-// cellValue = "非法字符";
|
|
|
-// break;
|
|
|
-// default:
|
|
|
-// cellValue = "未知类型";
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// cellValue = String.valueOf(cell.getStringCellValue());
|
|
|
return cellValue;
|
|
|
}
|
|
|
|
|
|
+ public static String getCellValueText(Cell cell) {
|
|
|
+ if (cell == null) return "";
|
|
|
+ DataFormatter formatter = new DataFormatter();
|
|
|
+ return formatter.formatCellValue(cell); // 返回视觉显示的文本
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 时间格式处理
|
|
|
*
|