From 8b3e27cbc244bc5e09ea1acd8a0a0546927e063d Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期日, 08 十月 2023 11:43:20 +0800
Subject: [PATCH] 新版excel优化

---
 src/main/java/com/hx/util/ExcelUtil.java |   55 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/src/main/java/com/hx/util/ExcelUtil.java b/src/main/java/com/hx/util/ExcelUtil.java
index fbc5df6..9c789f8 100644
--- a/src/main/java/com/hx/util/ExcelUtil.java
+++ b/src/main/java/com/hx/util/ExcelUtil.java
@@ -975,34 +975,35 @@
 				for (int j = 0;j<arrange;j++) {
 					cell = row.getCell(j);
 					if (cell == null) {
-						continue;
-					}
-					if (cell.getCellType() == CellType.NUMERIC) {
-						isData = true;
-						format = cell.getCellStyle().getDataFormat();
-						if (format == 14 || format == 31 || format == 57 || format == 58) {
-							//鏃ユ湡锛堜腑鏂囨椂闂存牸寮忕殑锛�
-							d = cell.getDateCellValue();
-							formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-							arrayString.add(formater.format(d));
-						} else if (HSSFDateUtil.isCellDateFormatted(cell)) {
-							d = cell.getDateCellValue();
-							formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-							arrayString.add(formater.format(d));
-						} else {
-							if (CellType.STRING == cell.getCellType()) {
-								arrayString.add(cell.getStringCellValue());
-							} else if (CellType.FORMULA == cell.getCellType()) {
-								arrayString.add(cell.getCellFormula());
-							} else {
-								arrayString.add(cell.getStringCellValue().trim());
-							}
-						}
-					} else if (cell.getCellType() == CellType.BLANK) {
 						arrayString.add("");
-					} else { // 濡傛灉EXCEL琛ㄦ牸涓殑鏁版嵁绫诲瀷涓哄瓧绗︿覆鍨�
-						isData = true;
-						arrayString.add(cell.getStringCellValue().trim());
+					}else{
+						if (cell.getCellType() == CellType.NUMERIC) {
+							isData = true;
+							format = cell.getCellStyle().getDataFormat();
+							if (format == 14 || format == 31 || format == 57 || format == 58) {
+								//鏃ユ湡锛堜腑鏂囨椂闂存牸寮忕殑锛�
+								d = cell.getDateCellValue();
+								formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+								arrayString.add(formater.format(d));
+							} else if (HSSFDateUtil.isCellDateFormatted(cell)) {
+								d = cell.getDateCellValue();
+								formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+								arrayString.add(formater.format(d));
+							} else {
+								if (CellType.STRING == cell.getCellType()) {
+									arrayString.add(cell.getStringCellValue());
+								} else if (CellType.FORMULA == cell.getCellType()) {
+									arrayString.add(cell.getCellFormula());
+								} else {
+									arrayString.add(cell.getStringCellValue().trim());
+								}
+							}
+						} else if (cell.getCellType() == CellType.BLANK) {
+							arrayString.add("");
+						} else { // 濡傛灉EXCEL琛ㄦ牸涓殑鏁版嵁绫诲瀷涓哄瓧绗︿覆鍨�
+							isData = true;
+							arrayString.add(cell.getStringCellValue().trim());
+						}
 					}
 				}
 				if (isData) {

--
Gitblit v1.8.0