开发者

POI heap space exception or any alternative java api for Excel 2007?

开发者 https://www.devze.com 2023-01-20 04:23 出处:网络
i\'ve been searching around for a solution for this problem and haven\'t found anything good =( so the problem is i need to create an excel file up to 50.000 registers and when i do this show me this

i've been searching around for a solution for this problem and haven't found anything good =(

so the problem is i need to create an excel file up to 50.000 registers and when i do this show me this error at 50.000 app register:

java heap space

as far as i'm looking on, one way to solve this is increasing the heap memory, but quite don't like me (first aids) because the problem persist if the file gets to bigger and the server freezes and comsume a lot of memory try开发者_StackOverflow中文版ing to do this and gets slow

i think a solution would be writte out the excel file instead of leaving the data in the heap memory, but i don't get it work

any ideas ?? or another framework for excel 2007 files ???????


Call the write() method on your HSSFWorkbook to persist your Excel workbook to a file:

FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();

But as this thread indicates there's no way to do streaming writes to file in POI. Alternatives to POI are jXLS (open source) or Aspose.Cells for Java (proprietary)

0

精彩评论

暂无评论...
验证码 换一张
取 消