学校网站模板 dede,广州seo推广系统,教做面点的网站,wordpress 文章卡片这两天在使用easyexcel导出excel的时候日期格式全都是字符串导致导出的excel列无法筛选 后来调整了一下终于弄好了#xff0c;看一下最终效果 这里涉及到easyexcel和poi版本冲突的问题#xff0c;一直没搞定#xff0c;最后狠下心来把所有的都升级到了最新版#xff0c;然…这两天在使用easyexcel导出excel的时候日期格式全都是字符串导致导出的excel列无法筛选 后来调整了一下终于弄好了看一下最终效果 这里涉及到easyexcel和poi版本冲突的问题一直没搞定最后狠下心来把所有的都升级到了最新版然后把程序里的报错都处理了一遍神奇的是最新版的没出问题可以导出日期格式参考了很多博客记录一下。
最终要调整的地方有三个一个是poi的版本一个是easyexcel的版本另一个是commons-io的版本
commons-io.version2.18.0/commons-io.version
poi.version5.4.0/poi.version
easy-excel.version4.0.3/easy-excel.versiondependencygroupIdcommons-io/groupIdartifactIdcommons-io/artifactIdversion${commons-io.version}/version
/dependency
dependencygroupIdorg.apache.poi/groupIdartifactIdpoi/artifactIdversion${poi.version}/version/dependencydependencygroupIdorg.apache.poi/groupIdartifactIdpoi-ooxml/artifactIdversion${poi.version}/version/dependencydependencygroupIdcom.alibaba/groupIdartifactIdeasyexcel/artifactIdversion${easy-excel.version}/version/dependency注意事项
poi的版本对commons-io的版本有要求 https://blog.csdn.net/weixin_48524970/article/details/134379243 https://poi.apache.org/changes.html#5.4.0 日期格式使用 ContentStyle(dataFormat 14) https://blog.csdn.net/tanghuan0827/article/details/126180146 日期格式不要进行Converter转换否则都是字符串
下面是我的实体类的字段
ContentStyle(dataFormat 14)ExcelProperty(value {购入日期}, index 9)private Date buyDate;ContentStyle(dataFormat 14)ExcelProperty(value {报废日期}, index 10)private LocalDate scrapDate;
这种Date和LocalDate导出的数据都是日期格式关键的设置是ContentStyle(dataFormat 14)
参考文献 https://blog.csdn.net/tanghuan0827/article/details/126180146 https://blog.csdn.net/weixin_48524970/article/details/134379243 https://poi.apache.org/changes.html#5.4.0