I was wondering how the code in the following forum be translated into PPTX namespace? Because I noticed that FindShape doesn't exist in PPTX namespace. Can you translate the code below into PPTX namespace?
It is not possible to set alternative text for OLE objects in PowerPoint 2007 so the only simple solution is iterate all shapes and find shape with OleObjectFrameEx type.
foreach (ShapeEx shape in shapes) { if (shape is OleObjectFrameEx) { … } }
It’s also possible to search shapes using Tags but they can be created and accessed in PowerPoint through VBA only.
I'm now trying to embed an existing chart in excel into blank powerpoint slide using the example below but what I get is "Embedded OLE Object" written on the slide where the chart is supposed to be. What am I doing wrong? Thanks for your help:
'Instantiate a Presentation object that represents a PPT file
Dim pres As Presentation = New Presentation("C:\\demo.ppt")
'Accessing a slide using its slide position
Dim slide As Slide = pres.GetSlideByPosition(2)
'Reading excel chart from the excel file and save as an array of bytes
Dim fstro As FileStream = New FileStream("C:\\excel1.xls", FileMode.Open, FileAccess.Read)
Dim b() AsByte = NewByte(fstro.Length) {}
fstro.Read(b, 0, CType(fstro.Length, Integer))
'Inserting the excel chart as new OleObjectFrame to a slide
You can solve this problem by inserting your own image. Please see this example where a chart was created and its image was taken using Aspose.Cells and then that was used to replace the object change image.