OutOfMemory Error occurs on generating PNG image of large excel tables

Hello,

I am using Aspose.Cells v19.5 to generate PNG of table - “TestResults_0” in the attached excel file. Following error occurs when generating the PNG:

java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.(Unknown Source)
at java.awt.image.Raster.createPackedRaster(Unknown Source)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.awt.image.BufferedImage.(Unknown Source)
at com.aspose.cells.b.a.b.za.(Unknown Source)
at com.aspose.cells.a.d.zcd.a(Unknown Source)
at com.aspose.cells.zcdl.a(Unknown Source)
at com.aspose.cells.zcdl.a(Unknown Source)
at com.aspose.cells.zcdl.a(Unknown Source)
at com.aspose.cells.SheetRender.toImage(Unknown Source)

PFA below the source excel and sample code to generate the PNG:
attachments.zip (49.5 KB)

Can you please analyze this issue.

Thanks,
Neha

@Neha_Gautam,

Thanks for the sample code and template file.

I tested your scenario/ case a bit. Well, since the data table is large which cannot be rendered in a single page/image, so you may remove the line of code from the code segment and try to render multiple images for the bigger List object/table. You got to do that as this process may consume more and more resources (RAM, CPU) and you finally got “OutOfMemoryError” exception.
e.g
Sample code:

.........
imgOptionsForTable.setOnePagePerSheet(true); 
........

Secondly, I found in your file, you have external reference linked to the data table. I am afraid, Aspose.Cells does not support to extract data from external data source/database when copying data b/w workbooks or rendering to image.