Excel Chart Export To PowerPoint Slide - MS Office 2007

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)

Hi,

Well, I think it looks your issue is regarding Aspose.Slides component, so, I will move this thread to Aspose.Slides forum where one of our developer will help you soon.

Thank you and have a good day!

Hello,

Please see this post.

https://forum.aspose.com/t/97380

Hi there,

Is there an example for VB for MS Office 2007 (i.e. using PPTX namespace) for this:

static void AddExcelChartInPresentation(Presentation pres, Slide sld, Stream wbStream, Bitmap imgChart)
{
    Aspose.Slides.Picture pic = new Aspose.Slides.Picture(pres, imgChart);
    int picId = pres.Pictures.Add(pic);
    int slideWidth = pres.SlideSize.Width;
    int slideHeight = pres.SlideSize.Height;
    int x = 0;
    byte[] chartOleData = new byte[wbStream.Length];
    wbStream.Position = 0;
    wbStream.Read(chartOleData, 0, chartOleData.Length);
    OleObjectFrame oof = sld.Shapes.AddOleObjectFrame(x, 0, slideWidth, slideHeight, "Excel.Sheet.8", chartOleData);
    oof.PictureId = picId;
}

And by the way, how do I get to my private messages? I don’t see a link in the main ASPOSE.com page

Thanks