瀏覽代碼

优化导出Excel日期格式双击离开后与设定的格式不一致问题

RuoYi 1 年之前
父節點
當前提交
fc8069a250

+ 1 - 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java

@@ -1000,6 +1000,7 @@ public class ExcelUtil<T>
1000 1000
                 String separator = attr.separator();
1001 1001
                 if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
1002 1002
                 {
1003
+                    cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat));
1003 1004
                     cell.setCellValue(parseDateToStr(dateFormat, value));
1004 1005
                 }
1005 1006
                 else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))