From 34acfe6bbc98162cd8c9bb726aae0fd94c465544 Mon Sep 17 00:00:00 2001 From: 林致杰 <1003392067@qq.com> Date: 星期一, 01 八月 2022 21:56:38 +0800 Subject: [PATCH] 优化 --- src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java b/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java index 0dd7306..a2e2179 100644 --- a/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java +++ b/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java @@ -36,7 +36,7 @@ OutputStream os = new FileOutputStream("C:\\Users\\澶уご\\Desktop\\MAQ缁勫埆鎶ュ憡\\鏋梍PAQ_IA_CN2.docx"); XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("C:\\Users\\澶уご\\Desktop\\MAQ缁勫埆鎶ュ憡\\缁堢銆�0607涓枃鐗堛�慚AQ缁勫埆瀵规瘮鎶ュ憡.docx")); - String fileName = "C:\\Users\\澶уご\\Desktop\\MAQ缁勫埆鎶ュ憡\\缁勫埆瀵规瘮鎶ュ憡娴嬭瘯鏁版嵁.xlsx"; + String fileName = "C:\\Users\\澶уご\\Desktop\\MAQ缁勫埆鎶ュ憡\\MAQ缁勫埆瀵煎叆鏁版嵁妯℃澘 (2).xlsx"; //鍙樻洿鍥捐〃鏁版嵁 changeMAQTRChart(document,fileName); document.write(os); @@ -65,9 +65,15 @@ //琛� for (int j = 1; j <= sheet.getLastRowNum(); j++) { XSSFRow row = sheet.getRow(j); + if(row == null){ + continue; + } //鍒� for (int k = 1; k < row.getLastCellNum(); k++) { XSSFCell cell = row.getCell(k); + if(cell == null){ + continue; + } /* if (CellType.NUMERIC == cell.getCellType()) { System.out.println(cell.getNumericCellValue()); @@ -75,6 +81,10 @@ System.out.println(cell.getStringCellValue()); } */ + switch (cell.getCellType()) { + case STRING: + continue; + } //table1 澶氫釜绛旈缁撴灉澶勭悊 if(map.get(k) != null){ map.get(k).add(cell.getNumericCellValue()); -- Gitblit v1.9.1