zl程序教程

您现在的位置是:首页 >  Java

当前栏目

【已解决】easypoi在导出后Excel中数字不能直接求和。是文本格式。无法求和。怎么解决

2023-02-18 16:31:16 时间

在使用EasyPoi导出Excel的时候,数字是文本格式。不能直接使用Excel的sum函数。需要手动转换成数字。

解决方案:

在对应字段的Excel注解中添加type=10。就可以了。

使用的版本是:4.3.0。如下:

<dependency>
    <groupId>cn.afterturn</groupId>
    <artifactId>easypoi-web</artifactId>
    <version>4.3.0</version>
</dependency>
<dependency>
    <groupId>cn.afterturn</groupId>
    <artifactId>easypoi-base</artifactId>
    <version>4.3.0</version>

</dependency>
<dependency>
    <groupId>cn.afterturn</groupId>
    <artifactId>easypoi-annotation</artifactId>
     <version>4.3.0</version>
</dependency>

参考:

https://blog.csdn.net/enthan809882/article/details/106529620/?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-1&spm=1001.2101.3001.4242