阿帕奇浦二慢上生成XLSX文件 [英] Apache Poi slow on generate xlsx file

查看:139
本文介绍了阿帕奇浦二慢上生成XLSX文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的 HSSFWorkbook 的到的 XssFWorkbook 的切换,上创建Excel的性能正在下降。我搜索和搜索,我发现表现不佳,上创建 XLSX ,是一个已知的问题。如果我尝试创建一个文件约1000行需要3-4分钟,实在是太多了。

I switched from HSSFWorkbook to XssFWorkbook and the performance on create Excel are going down. I search and search and I find that the bad performance, on create xlsx, is a known problem. If i try to create a file with about 1000 rows takes 3-4 minutes, is too much.

有没有提高速度的解决方案?

Is there a solution to improve speed?

谢谢!

推荐答案

您使用autoSizeColumn?如果是的话这可能会导致一个极端的瓶颈,如果你尝试每个单元插入后去做。穿上它后,所有数据都在表中,然后做这样的事情:

Are you using "autoSizeColumn"? If so this can cause an extreme bottleneck if you try to do it after each cell insertion. Put it after all the data is in the table, then do something like this:

for(int i=0;i<numberOfRows; i++){
        workbook.getSheetAt(0).autoSizeColumn(i);
    }

这篇关于阿帕奇浦二慢上生成XLSX文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆