|
@@ -22,8 +22,7 @@ import java.util.ArrayList; |
|
@@ -22,8 +22,7 @@ import java.util.ArrayList; |
22
|
import java.util.Date;
|
22
|
import java.util.Date;
|
23
|
import java.util.List;
|
23
|
import java.util.List;
|
24
|
|
24
|
|
25
|
-import static org.apache.poi.ss.usermodel.CellType.BLANK;
|
|
|
26
|
-import static org.apache.poi.ss.usermodel.CellType.STRING;
|
25
|
+import static org.apache.poi.ss.usermodel.CellType.*;
|
27
|
|
26
|
|
28
|
/**
|
27
|
/**
|
29
|
* shenhailong
|
28
|
* shenhailong
|
|
@@ -59,7 +58,7 @@ public class ExcelUtils { |
|
@@ -59,7 +58,7 @@ public class ExcelUtils { |
59
|
}
|
58
|
}
|
60
|
totoalRows = xssfSheet.getLastRowNum();
|
59
|
totoalRows = xssfSheet.getLastRowNum();
|
61
|
//读取row
|
60
|
//读取row
|
62
|
- for (int rowIndex = 2; rowIndex <= totoalRows; rowIndex++) {
|
61
|
+ for (int rowIndex = 1; rowIndex <= totoalRows; rowIndex++) {
|
63
|
XSSFRow xssfRow = xssfSheet.getRow(rowIndex);
|
62
|
XSSFRow xssfRow = xssfSheet.getRow(rowIndex);
|
64
|
|
63
|
|
65
|
if (xssfRow == null) {
|
64
|
if (xssfRow == null) {
|
|
@@ -145,12 +144,12 @@ public class ExcelUtils { |
|
@@ -145,12 +144,12 @@ public class ExcelUtils { |
145
|
//读取列
|
144
|
//读取列
|
146
|
for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) {
|
145
|
for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) {
|
147
|
HSSFCell hssfCell = hssfRow.getCell(cellIndex);
|
146
|
HSSFCell hssfCell = hssfRow.getCell(cellIndex);
|
148
|
- if (hssfCell == null) {
|
147
|
+ if (hssfCell == null || String.valueOf(hssfCell)=="") {
|
149
|
rowList.add("");
|
148
|
rowList.add("");
|
150
|
} else {
|
149
|
} else {
|
151
|
// System.out.println(hssfCell.getCellType());
|
150
|
// System.out.println(hssfCell.getCellType());
|
152
|
|
151
|
|
153
|
- if(BLANK==hssfCell.getCellType()){
|
152
|
+ if(NUMERIC==hssfCell.getCellType()){
|
154
|
if(DateUtil.isCellDateFormatted(hssfCell)){
|
153
|
if(DateUtil.isCellDateFormatted(hssfCell)){
|
155
|
//用于转化为日期格式
|
154
|
//用于转化为日期格式
|
156
|
Date d = hssfCell.getDateCellValue();
|
155
|
Date d = hssfCell.getDateCellValue();
|