I have tried the following code with 20,000 lines, but i got the exception : Java heap space.
I there any way to overcome this…???
Workbook workbook = new Workbook();
Worksheets worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.getSheet(0);
sheet.setName(“Export Test”);
Cells cells = sheet.getCells();
int k=0; int j=0;
Cell cell;
for(int i=0;i<20000;i++){
for(j=0;j<100;j++){
k++;
cell = cells.getCell(i, j);
cell.setValue(k)
}
}
workbook.save(“D:\tmpp\tempmmk.xls”);
got exception after executing the code
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at com.aspose.cells.Row.getCell(Unknown Source)
at com.aspose.cells.Cells.getCell(Unknown Source)
at ReadWriteExcel.(ReadWriteExcel.java:109)
at ReadWriteExcel.main(ReadWriteExcel.java:205)
Hi,
Well, I tried your code, it works fine on my “Core 2 Duo” processor (2.00Ghz) with 2GB RAM. The generated file is about 12GB in size. I used the attached latest version 3.2.1.4, please try it.
Furthermore, while rendering larger reports, you should have sufficient memory assigned/allotted to JVM to process the reports. Kindly make sure that you have provided and extended the JVM memory appropriately to process the file if you got lower configuration pc/system.
Following is the command line you may use on the Windows XP command prompt to extend the JVM memory accordingly:
e.g
java -Xms1024m -Xmx1024m MyTestProgram
Thank you.