Chart.ToImage() hangs the application



Our application hangs when it Execute Chart.ToImage() function, and the memory consumption goes above 10 GB. Attached is the sample file. The code hangs on multiple functions when a sheet has a chart like this. It hangs on Worksheet.Copy() and Chart.ToImage().

The following a code snippet.

        byte[] lFileBytes = File.ReadAllBytes(@"T:\Chart_ToImage()_Hang.xls");
        Stream lMemoryStream = new MemoryStream(lFileBytes);



        Aspose.Cells.Rendering.ImageOrPrintOptions iOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
        iOptions.ImageType = Aspose.Cells.Drawing.ImageType.Png;
        iOptions.Quality = 50;
        iOptions.HorizontalResolution = 96;
        iOptions.VerticalResolution = 96;
        iOptions.Transparent = true;

        Aspose.Cells.Workbook lAsposeWB = new Aspose.Cells.Workbook(lMemoryStream);

        Aspose.Cells.Workbook lAsposeWBNew = new Aspose.Cells.Workbook();
        Aspose.Cells.Worksheet lAsposeWS = lAsposeWB.Worksheets[0];

        //The following statement hangs the application

        //The following statement hangs the application

Chart_ToImage() (7.6 KB)




Thanks for the template file and sample code.

After an initial test, I am able to observe the issues as the user has mentioned by using his sample code with his template file. I found that Chart.ToImage() and Worksheet.Copy() hang the application. Also, the memory consumption goes above 10 GB. I have logged the following tickets for your issues:

  • CELLSNET-46730 - Chart.ToImage() hangs the application
  • CELLSNET-46731 - Worksheet.Copy() hangs the application

We will look into your issues to figure these out soon.

Once we have an update on it, we will let you know.


Do you have any update on this?



I am afraid your issues are not resolved yet. I have logged your concerns against your issues into our database. Hopefully these will be addressed in the next 3-5 days or so.

Once we have any new information, we will share it with you.

Thank you.


Any update?

At least if we can identify the charts that can take fore ever to convert to an image than we can skip those files from the processing. Is it possible to identify such images?


It seems quite difficult to identify such hanging charts prior to processing them. Please spare us little time to investigate this issue in detail so that we may provide you our feedback properly.

We are sorry for the inconvenience caused to you.


Any update on this? This keeps dragging forever and we don’t know how to get past it.


I have checked the status of these tickets and observed that still there is no ETA available due to the complexity involved in these issues. These issues will be resolved on their turn and we will notify you immediately once any feedback is ready to share.



Please try our latest version/fix: Aspose.Cells for .NET v19.5.5 (attached)

Your issues should be fixed in it.

Let us know your feedback.
Aspose.Cells19.5.5 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.5.5 For .Net4.0.Zip (4.9 MB)


The update worked.

Thank you!



Good to know that your issues are sorted out by the new fix/version. Feel free to contact us any if you need further help or have some other issue or queries, we will be happy to assist you soon.


The issues you have found earlier (filed as CELLSNET-46731,CELLSNET-46730) have been fixed in Aspose.Cells for .NET v19.6. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi