正在显示
1 个修改的文件
包含
5 行增加
和
2 行删除
@@ -22,6 +22,9 @@ import java.util.ArrayList; | @@ -22,6 +22,9 @@ 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; | ||
27 | + | ||
25 | /** | 28 | /** |
26 | * shenhailong | 29 | * shenhailong |
27 | * 2020/4/27/14:29 | 30 | * 2020/4/27/14:29 |
@@ -147,7 +150,7 @@ public class ExcelUtils { | @@ -147,7 +150,7 @@ public class ExcelUtils { | ||
147 | } else { | 150 | } else { |
148 | // System.out.println(hssfCell.getCellType()); | 151 | // System.out.println(hssfCell.getCellType()); |
149 | 152 | ||
150 | - if(0==hssfCell.getCellType()){ | 153 | + if(BLANK==hssfCell.getCellType()){ |
151 | if(DateUtil.isCellDateFormatted(hssfCell)){ | 154 | if(DateUtil.isCellDateFormatted(hssfCell)){ |
152 | //用于转化为日期格式 | 155 | //用于转化为日期格式 |
153 | Date d = hssfCell.getDateCellValue(); | 156 | Date d = hssfCell.getDateCellValue(); |
@@ -155,7 +158,7 @@ public class ExcelUtils { | @@ -155,7 +158,7 @@ public class ExcelUtils { | ||
155 | rowList.add(formater.format(d)); | 158 | rowList.add(formater.format(d)); |
156 | } | 159 | } |
157 | } | 160 | } |
158 | - hssfCell.setCellType(Cell.CELL_TYPE_STRING); | 161 | + hssfCell.setCellType(STRING); |
159 | rowList.add(String.valueOf(hssfCell.getStringCellValue())); | 162 | rowList.add(String.valueOf(hssfCell.getStringCellValue())); |
160 | } | 163 | } |
161 | } | 164 | } |
-
请 注册 或 登录 后发表评论