简体   繁体   English

使用XSSF SAX读取并使用SXSSF-POI传输数据

[英]Read using XSSF SAX and stream out data with SXSSF - POI

I have to read large sized xlsm with low memory footprint and since apache POI provides XSSF SAX, I should prefer using it. 我必须阅读具有低内存占用量的大型xlsm,并且由于apache POI提供了XSSF SAX,因此我更喜欢使用它。 In the first sheet from existing xlsm parsed with SAX, i need to append some data from db and write it out as another xlsm. 在现有的用SAX解析的xlsm的第一张表中,我需要从db附加一些数据并将其作为另一个xlsm写出。 SXSSF provides streaming write and hence should combine both SAX read and SXSSF write. SXSSF提供流式写入,因此应结合使用SAX读取和SXSSF写入。 By this way i think heap size problem can be avoided for large size. 通过这种方式,我认为对于大尺寸可以避免堆大小问题。

Is this possible using POI or are there any other approach ? 是否可以使用POI或有其他方法?
Kindly suggest me on this approach with any example ! 请通过任何示例向我推荐这种方法!

Based on the POI Spreadsheet Feature table , you cannot read files with SXSSF buffered streaming, although SXSSF buffered streaming does have the ability to write files. 基于POI电子表格功能表 ,尽管SXSSF缓冲的流确实具有写入文件的能力,但是您无法使用SXSSF缓冲的流读取文件。

My suggestion would be to read, parsing with SAX, using the XSSF eventmodel, and then write out using SXSSF buffered streaming to write the new file. 我的建议是使用XSSF事件模型读取,解析SAX,然后使用SXSSF缓冲流写出新文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM