From e96b0d2ac2d14a1035e91cf221f5ecd764980e16 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期日, 08 十月 2023 11:41:37 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/java/com/hx/util/ExcelUtil.java | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hx/util/ExcelUtil.java b/src/main/java/com/hx/util/ExcelUtil.java index 923a569..ee0af02 100644 --- a/src/main/java/com/hx/util/ExcelUtil.java +++ b/src/main/java/com/hx/util/ExcelUtil.java @@ -955,18 +955,29 @@ Date d; DateFormat formater; Sheet sheet; + Cell cell; //閬嶅巻鎵�鏈夌殑sheet for(int i=0;i<book.getNumberOfSheets();i++) { sheet = book.getSheetAt(i); + //鍒楁暟 + Integer arrange = null; //閬嶅巻鎵�鏈夌殑琛� for (Row row : sheet) { + if(row == null){ + continue; + } isData = false; arrayString = new ArrayList<>(); + if(arrange == null){ + arrange = row.getPhysicalNumberOfCells(); + } //閬嶅巻鎵�鏈夌殑鍒� - for (Cell cell : row) { + for (int j = 0;j<arrange;j++) { + cell = row.getCell(j); if (cell == null) { arrayString.add(""); - } else if (cell.getCellType() == CellType.NUMERIC) { + } + if (cell.getCellType() == CellType.NUMERIC) { isData = true; format = cell.getCellStyle().getDataFormat(); if (format == 14 || format == 31 || format == 57 || format == 58) { -- Gitblit v1.8.0