JAVA - Out Of Memory Error while writing Excel Cells in jxl

前端 未结 2 1473
遥遥无期
遥遥无期 2021-01-16 06:04

I am using JXL to write an excel file of 50000 rows and 30 columns. My code looks like this:

for (int j = 0; j < countOfRows; j++) {

myWritableShe         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-16 06:24

    The JExcel FAQ has a couple of suggestions including Curtis' idea above.

    If you don't mind the performance hit, you could use a temporary file instead of doing it all in memory.

    WorkbookSettings s = new WorkbookSettings();  
    s.setUseTemporaryFileDuringWrite(true);  
    WritableWorkbook ws = Workbook.createWorkbook(new File("someFile.xls"),s); 
    

提交回复
热议问题