We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

GetThumbnail and WriteAsSvg methods throw NullReferenceException

Hello,
I’m trying to get image from any Pie Chart. However, I got an error with NullReference exception on IShape.GetThumbnail method calling. As result it’s empty image. The same behavior with WriteAsSvg method.

If change chart type to another type (line, for example) all will be ok. Aspose.Slides.NET v21.5.0
Pie chart.zip (132.9 KB)

Code example:

        foreach (Slide slide in presentation.Slides)
        {
            var pieCharts = slide.Shapes.Where(_ => _ is Chart chart && chart.Type == ChartType.Pie).Select(_ => (Chart)_);
            var i = 0;

            foreach (var pieChart in pieCharts)
            {
                using (var bmp = pieChart.GetThumbnail()) //  NullReference Exception there
                {
                    bmp.Save(string.Format(@"C:\temp\pie-chart{0}.jpeg", i), System.Drawing.Imaging.ImageFormat.Jpeg);
                    i++;
                }
            }
        }

@Viktors,
Welcome to our community! Thank you for the issue description. I reproduced the error and logged the issue in our tracking system with ID SLIDESNET-42597. Our development team will investigate this case. You will be notified when it is fixed.

Hello, @Andrey_Potapov!

Thank you for your response! It would be nice to get fix for the issue as soon as possible)

@Viktors,
An estimated time to start the investigation of the issue has been scheduled for 2021/25 week.

The issues you have found earlier (filed as SLIDESNET-42597) have been fixed in this update.

1 Like