Excel Chart Embed In PPTX

Hi there,

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?

http://www.aspose.com/documentation/file-format-components/aspose.slides-for-.net-and-java/working-with-ole-object-frames.html

Thanks


This message was posted using Page2Forum from Working with OLE Object Frames - Aspose.Slides for .NET and Java

Hello,

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.

Hi there,

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() As Byte = New Byte(fstro.Length) {}

fstro.Read(b, 0, CType(fstro.Length, Integer))

'Inserting the excel chart as new OleObjectFrame to a slide

OleObjectFrame oof = slide.Shapes.AddOleObjectFrame(0,0,pres.SlideSize.Width,

pres.SlideSize.Height,"Excel.Sheet.8", b)

'Writing the presentation as a PPT file

pres.Write("C:\\modified.ppt")

Please read about Object Changed Issue When Adding OleObjectFrame

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.

Creating Excel chart and embedding them as OLE Object inside a Presentation