Hi there,
I'm trying to embed an existing chart in excel 2007 (chart is in the first sheet) into blank powerpoint 2007 slide (the exported chart from excel will be embedded onto the last slide of the presentation which is blank) using the example below (link below) but what I get is "Embedded OLE Object" (Please see attached file) written on the slide where the chart is supposed to be. What am I doing wrong?
https://docs.aspose.com/slides/net/manage-ole/
This is my code:
********************************************************************************
Public Sub XLExportChart(ByVal filePath As String)
Dim inputPPTXFileName As String
Dim inputXLSXFileName As String
inputPPTXFileName = filePath & "modified.pptx"
inputXLSXFileName = filePath & "template.xlsx"
'Instantiate a Presentation object that represents a PPT file
Dim pres As PresentationEx = New PresentationEx(inputPPTXFileName)
'Always add the chart to the last slide in presentation
Dim slideCount As Integer = pres.Slides.Count
'Accessing a slide using its slide position - The last slide in the presentation which should be blank
Dim slide As SlideEx = pres.Slides(slideCount-1)
'Reading excel chart from the excel file and save as an array of bytes
Dim fstro As FileStream = New FileStream(inputXLSXFileName, 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
Dim oof As OleObjectFrameEx = slide.Shapes.AddOleObjectFrame(0,0,pres.SlideSize.Size.Width, pres.SlideSize.Size.Height,"Excel.Sheet.8", b)
'Writing the presentation back into the PPTX file
pres.Write(inputPPTXFileName)
End Sub
********************************************************************************
Thanks for your help
Thanks
This message was posted using Email2Forum by Amjad Sahi. (attachment)