Free Support Forum -

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.