Free Support Forum -

Access PowerPoint World Map Chart

I have a PowerPoint slide with a world map chart in it.

Usually I would try to cast the object as an IChart but this returns null in case of the world map.

So I see that it actually has to be casted as a PictureFrame object but I cannot figure out how to access the chart and its associated data.

This is the code so far:

Aspose.Slides.Presentation presentation = new Aspose.Slides.Presentation("map.pptx");
var slide = presentation.Slides[0];

var shapes = slide.Shapes;

// This returns null
//var chart = shapes.Where(s => s.Name == "MapChart").First() as Aspose.Slides.Charts.IChart;

var pictureFrame = shapes.Where(s => s.Name == "MapChart").First() as Aspose.Slides.PictureFrame;

Thanks for any help. (3.9 MB)

Welcome to our community! Thank you for the query. Could you share the “map.pptx” file to investigate the issue, please?

Yes, I attached it to the original question.

I have not managed to reproduce the incorrect casting of the shape to the chart. It works fine on my side with Aspose.Slides 21.5. Please check the issue with the latest version of Aspose.Slides.

We are using Aspose.Slides 19.8 so this may be the problem. Thank you.