天天看点

java excel 透视,Java开源库生成数据透视表excel

java excel 透视,Java开源库生成数据透视表excel

Given an excel file I want to generate a pivot table programmatically. I have heard of Aspose.Cells but it is paid version. Can someone suggest some open source libraries similar to Aspose.Cells or atleast any tutorial link where I can get some help to generate pivot table programmatically.

解决方案

Please try https://github.com/jbaliuka/x4j-analytic, it is open source and it is designed for pivot reports with huge details sheet.

There are several other open source libraries to achieve the same thing but we developed this library to workaround performance issues, we use temp file to avoid unreasonable memory consumption and write XML to stream as raw bytes to avoid overhead caused by XML API.

See samples https://github.com/jbaliuka/x4j-analytic/blob/master/samples/src/test/java/x4j/samples/X4JEngineTest.java, it needs XLSX template, XML descriptor and several lines of code to implement basic pivot report.