Commit e647c58ddce43e26fba38c917f8c12319397b675
1 parent
987306da
Exists in
master
.
Showing
2 changed files
with
9 additions
and
2 deletions
Show diff stats
build.gradle
src/main/java/com/taover/util/UtilExcel.java
... | ... | @@ -402,7 +402,14 @@ public class UtilExcel { |
402 | 402 | if(currCellType.compareTo(CellType.STRING) == 0){ |
403 | 403 | dataRow.add(UtilString.trimCodePage(cell.getRichStringCellValue().getString())); |
404 | 404 | }else if(currCellType.compareTo(CellType.NUMERIC) == 0){ |
405 | - dataRow.add(df.format(cell.getNumericCellValue())); | |
405 | + //if (DateUtil.isCellDateFormatted(cell)) { | |
406 | + if (cell.getCellStyle().getDataFormat()==28||cell.getCellStyle().getDataFormat()==31 || cell.getCellStyle().getDataFormat() == 58) { | |
407 | + // 如果是date类型则 ,获取该cell的date值 | |
408 | + dataRow.add( new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getJavaDate(cell.getNumericCellValue()))); | |
409 | + } else { // 纯数字 | |
410 | + // return String.valueOf(cell.getNumericCellValue()); | |
411 | + dataRow.add( df.format(cell.getNumericCellValue())); | |
412 | + } | |
406 | 413 | |
407 | 414 | }else if(currCellType.compareTo(CellType.BOOLEAN) == 0){ |
408 | 415 | dataRow.add(cell.getBooleanCellValue()); | ... | ... |