back_recharge
gaojie 2019-01-15 15:55:08 +08:00
parent 33657a69e7
commit 62b82fe8e3
1 changed files with 5 additions and 3 deletions

View File

@ -47,7 +47,7 @@ public class ExcelUtils {
sheet = wb.getSheetAt(0); sheet = wb.getSheetAt(0);
String sheetName = sheet.getSheetName(); String sheetName = sheet.getSheetName();
System.out.println("bulidMapInfo => collection name="+sheetName); System.out.println("bulidMapInfo => collection name="+sheetName);
int rownum = sheet.getPhysicalNumberOfRows(); int rownum = sheet.getLastRowNum();
FileWriter fw = new FileWriter(path + sheetName + ".txt"); FileWriter fw = new FileWriter(path + sheetName + ".txt");
PrintWriter out = new PrintWriter(fw); PrintWriter out = new PrintWriter(fw);
for (int i = 0; i < rownum; i++) { for (int i = 0; i < rownum; i++) {
@ -57,14 +57,14 @@ public class ExcelUtils {
Row row1 = sheet.getRow(2); Row row1 = sheet.getRow(2);
Row row2 = sheet.getRow(1); Row row2 = sheet.getRow(1);
Row row4 = sheet.getRow(4); Row row4 = sheet.getRow(4);
int colnum = row1.getPhysicalNumberOfCells();
row = sheet.getRow(i); row = sheet.getRow(i);
// for (Cell c :row){ // for (Cell c :row){
// System.out.println(c.getColumnIndex() +"==="+row.getCell(c.getColumnIndex())); // System.out.println(c.getColumnIndex() +"==="+row.getCell(c.getColumnIndex()));
// } // }
if (row != null) { if (row != null) {
StringBuilder info = new StringBuilder(); 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)); int cellFormatValue = (int) getCellFormatValue(row1.getCell(j));
if (cellFormatValue == 3){ if (cellFormatValue == 3){
continue; continue;
@ -116,6 +116,8 @@ public class ExcelUtils {
case "int": case "int":
str = "0"; str = "0";
break; break;
case "string":
break;
default: default:
str = null; str = null;
} }