From dca24adb8ee2fcde5e59c6eaf28555d6cc451496 Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期日, 08 十月 2023 18:04:37 +0800 Subject: [PATCH] 1.修改 --- 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