Free Support Forum - aspose.com

Possible to extract a Chart/Graph From Powerpoint File?

We need the ability to programatically open a powerpoint presentation, navigate to a particular slide (slide 6) in the document and extract text and a chart. If not, could we do so if the chart was a picture?

Dear Steven,

Chart on a slide available as OleObjectFrame.
1. OleObjectFrame inherited from PictureFrame so you can get image of a chart saved in a ppt.
2. Also you can read OLE object as stream. For Excel Charts it will be normal Excel document which can be opened with Aspose.Excel.

Can you show me an example code snippet? I can get the slide by position as shown below, but it is unclear how to continue.

Dim pres As Presentation
Dim slide As Slide
pres = New Aspose.PowerPoint.Presentation(“C:\data\SInsight\AK2004.ppt”)
slide = pres.GetSlideByPosition(6)

slide.???




Dear Steven,

For i = 0 To slide.Shapes.Count - 1
If TypeOf slide.Shapes(i) Is OleObjectFrame Then
Dim ole As OleObjectFrame
ole = CType(slide.Shapes(i), OleObjectFrame)
ole.PictureId ’ Id of a picture in Presentation.Pictures collection
ole.ObjectData ’ byte array which is embedded document
End If
Next