From 62b82fe8e3076942c32c5c9cfa5bdea4848ff31b Mon Sep 17 00:00:00 2001 From: gaojie Date: Tue, 15 Jan 2019 15:55:08 +0800 Subject: [PATCH] fix --- test/src/main/java/ExcelUtils.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/src/main/java/ExcelUtils.java b/test/src/main/java/ExcelUtils.java index 73028c2a8..5d5a78961 100644 --- a/test/src/main/java/ExcelUtils.java +++ b/test/src/main/java/ExcelUtils.java @@ -47,7 +47,7 @@ public class ExcelUtils { sheet = wb.getSheetAt(0); String sheetName = sheet.getSheetName(); System.out.println("bulidMapInfo => collection name="+sheetName); - int rownum = sheet.getPhysicalNumberOfRows(); + int rownum = sheet.getLastRowNum(); FileWriter fw = new FileWriter(path + sheetName + ".txt"); PrintWriter out = new PrintWriter(fw); for (int i = 0; i < rownum; i++) { @@ -57,14 +57,14 @@ public class ExcelUtils { Row row1 = sheet.getRow(2); Row row2 = sheet.getRow(1); Row row4 = sheet.getRow(4); - int colnum = row1.getPhysicalNumberOfCells(); row = sheet.getRow(i); // for (Cell c :row){ // System.out.println(c.getColumnIndex() +"==="+row.getCell(c.getColumnIndex())); // } if (row != null) { StringBuilder info = new StringBuilder(); - for (int j = 1; j <= colnum; j++) { + int colnum = row.getLastCellNum(); + for (int j = 1; j < colnum; j++) { int cellFormatValue = (int) getCellFormatValue(row1.getCell(j)); if (cellFormatValue == 3){ continue; @@ -116,6 +116,8 @@ public class ExcelUtils { case "int": str = "0"; break; + case "string": + break; default: str = null; }