作者 RuoYi

升级poi到最新版本4.1.2

@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <jna.version>5.6.0</jna.version> 28 <jna.version>5.6.0</jna.version>
29 <commons.io.version>2.5</commons.io.version> 29 <commons.io.version>2.5</commons.io.version>
30 <commons.fileupload.version>1.3.3</commons.fileupload.version> 30 <commons.fileupload.version>1.3.3</commons.fileupload.version>
31 - <poi.version>3.17</poi.version> 31 + <poi.version>4.1.2</poi.version>
32 <velocity.version>1.7</velocity.version> 32 <velocity.version>1.7</velocity.version>
33 <jwt.version>0.9.1</jwt.version> 33 <jwt.version>0.9.1</jwt.version>
34 </properties> 34 </properties>
@@ -18,7 +18,6 @@ import java.util.Map; @@ -18,7 +18,6 @@ import java.util.Map;
18 import java.util.Set; 18 import java.util.Set;
19 import java.util.UUID; 19 import java.util.UUID;
20 import java.util.stream.Collectors; 20 import java.util.stream.Collectors;
21 -import org.apache.poi.hssf.usermodel.HSSFDateUtil;  
22 import org.apache.poi.ss.usermodel.BorderStyle; 21 import org.apache.poi.ss.usermodel.BorderStyle;
23 import org.apache.poi.ss.usermodel.Cell; 22 import org.apache.poi.ss.usermodel.Cell;
24 import org.apache.poi.ss.usermodel.CellStyle; 23 import org.apache.poi.ss.usermodel.CellStyle;
@@ -516,12 +515,10 @@ public class ExcelUtil<T> @@ -516,12 +515,10 @@ public class ExcelUtil<T>
516 { 515 {
517 if (ColumnType.STRING == attr.cellType()) 516 if (ColumnType.STRING == attr.cellType())
518 { 517 {
519 - cell.setCellType(CellType.STRING);  
520 cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); 518 cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
521 } 519 }
522 else if (ColumnType.NUMERIC == attr.cellType()) 520 else if (ColumnType.NUMERIC == attr.cellType())
523 { 521 {
524 - cell.setCellType(CellType.NUMERIC);  
525 cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); 522 cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
526 } 523 }
527 } 524 }
@@ -980,10 +977,10 @@ public class ExcelUtil<T> @@ -980,10 +977,10 @@ public class ExcelUtil<T>
980 Cell cell = row.getCell(column); 977 Cell cell = row.getCell(column);
981 if (StringUtils.isNotNull(cell)) 978 if (StringUtils.isNotNull(cell))
982 { 979 {
983 - if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) 980 + if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
984 { 981 {
985 val = cell.getNumericCellValue(); 982 val = cell.getNumericCellValue();
986 - if (HSSFDateUtil.isCellDateFormatted(cell)) 983 + if (DateUtil.isCellDateFormatted(cell))
987 { 984 {
988 val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 985 val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
989 } 986 }
@@ -999,15 +996,15 @@ public class ExcelUtil<T> @@ -999,15 +996,15 @@ public class ExcelUtil<T>
999 } 996 }
1000 } 997 }
1001 } 998 }
1002 - else if (cell.getCellTypeEnum() == CellType.STRING) 999 + else if (cell.getCellType() == CellType.STRING)
1003 { 1000 {
1004 val = cell.getStringCellValue(); 1001 val = cell.getStringCellValue();
1005 } 1002 }
1006 - else if (cell.getCellTypeEnum() == CellType.BOOLEAN) 1003 + else if (cell.getCellType() == CellType.BOOLEAN)
1007 { 1004 {
1008 val = cell.getBooleanCellValue(); 1005 val = cell.getBooleanCellValue();
1009 } 1006 }
1010 - else if (cell.getCellTypeEnum() == CellType.ERROR) 1007 + else if (cell.getCellType() == CellType.ERROR)
1011 { 1008 {
1012 val = cell.getErrorCellValue(); 1009 val = cell.getErrorCellValue();
1013 } 1010 }