Java: Workbook.save() throws OutOfMemoryError

Hello,

I am using Aspose.Cells for Java now to open an existing Excel file which will act as a template where I need to insert data into - then save as a new file.

I am basically doing:

Workbook workbook = new Workbook();
FileInputStream fin = new FileInputStream( – file path – );
workbook.open(fin);
fin.close();

Cell cell = workbook.getWorksheets().getSheet(0).getCells().getCell(0,0 );

cell.setValue(“test”);

FileOutputStream fout = new FileOutputStream(“C:\test.xls”);
workbook.save(fout); <= OutofMemoryError thrown here
fout.close();

The excel file I am opening is just under 7 megs.

Any insight into this would be greatly appreciated.

Hi,

Please try the attached latest version v2.1.2.11.

If you still find the issue, kindly post your template file here.

Note:
Since you are manipulating large Excel file, please make sure that you have sufficient memory assigned/allotted to JVM to process the file. Kindly make sure that you have provided and extended the JVM memory appropriately to process/save the file. 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.