Commit 7c0a00a570d7161d7da2eed9ebfe0f0a1106585c
1 parent
d029ffde
Exists in
master
优化excel读取时间
Showing
2 changed files
with
4 additions
and
6 deletions
Show diff stats
build.gradle
src/main/java/com/taover/util/UtilExcel.java
... | ... | @@ -449,14 +449,12 @@ public class UtilExcel { |
449 | 449 | */ |
450 | 450 | System.out.println(cell.getCellStyle().getDataFormat()); |
451 | 451 | short format = cell.getCellStyle().getDataFormat(); |
452 | - if (cell.getCellStyle().getDataFormat()==28 || cell.getCellStyle().getDataFormat()==22||cell.getCellStyle().getDataFormat()==31 | |
453 | - || cell.getCellStyle().getDataFormat() == 58 || cell.getCellStyle().getDataFormat()==14 | |
454 | - || cell.getCellStyle().getDataFormat()==57 || cell.getCellStyle().getDataFormat()==32 || cell.getCellStyle().getDataFormat()==20 || cell.getCellStyle().getDataFormat()==176) { | |
452 | + if (format==28 || format==22||format==31 || format == 58 || format==14 || format==57 || format==32 || format==20 || format==176 || format==177 ) { | |
455 | 453 | |
456 | 454 | // 如果是date类型则 ,获取该cell的date值 |
457 | 455 | //return new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getJavaDate(cell.getNumericCellValue())); |
458 | 456 | SimpleDateFormat sdf = null; |
459 | - if(format == 14 || format == 31 || format == 57 || format == 58){ | |
457 | + if(format == 14 || format == 31 || format == 57 || format == 58 || format == 177){ | |
460 | 458 | //日期 |
461 | 459 | sdf = new SimpleDateFormat("yyyy-MM-dd"); |
462 | 460 | }else if (format == 20 || format == 32) { |
... | ... | @@ -515,7 +513,7 @@ public class UtilExcel { |
515 | 513 | System.out.println(df.format(3.3300)); |
516 | 514 | |
517 | 515 | |
518 | - String filepath = "C:\\Users\\EDZ\\Desktop\\ttt.xlsx"; | |
516 | + String filepath = "C:\\Users\\EDZ\\Desktop\\date.xlsx"; | |
519 | 517 | List<List<Object>> data = null; |
520 | 518 | |
521 | 519 | try { | ... | ... |