Java write Excel files with POI event model

2019-05-13 14:16发布

Is it possible to create and write to a (new) excel file using the event driven API from POI? I've found examples on how to read with that API, but not how to write.

thanks, Jeff

4条回答
beautiful°
2楼-- · 2019-05-13 14:30

You could use the SXSSF from Apache POI

https://poi.apache.org/spreadsheet/how-to.html#sxssf

查看更多
地球回转人心会变
3楼-- · 2019-05-13 14:33

Here is one possibility, not very well written, though:

http://www.docjar.org/html/api/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java.html

I'm using a modified version of that, which does not require temporary files and is overall more efficient

查看更多
Juvenile、少年°
4楼-- · 2019-05-13 14:45

I'vr worked with SXSSF from Apache POI. It is really good for writing huge files of data since it keeps only a small part of data in memory and flushes the remaining to disk, as opposed to HSSF or XSSF which keep all data in memory till finally writing at once. But unfortunately, SXSSF is that it is meant only for writing, not for reading.

查看更多
甜甜的少女心
5楼-- · 2019-05-13 14:47

Yes. Absolutely. Look at POI-XSSF and POI-HSSF

http://poi.apache.org/spreadsheet/how-to.html#user_api

查看更多
登录 后发表回答