Sign In  Sign Up Live-Chat

Excel Chart Export To PowerPoint Slide - MS Office 2007

Last post 07-10-2009, 10:25 AM by twin. 3 replies.
Sort Posts: Previous Next
  •  07-03-2009, 12:16 PM 186824

    Excel Chart Export To PowerPoint Slide - MS Office 2007

    Attachment: Present (inaccessible)

    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?

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

     

    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)
     
  •  07-03-2009, 12:22 PM 186825 in reply to 186824

    Re: Excel Chart Export To PowerPoint Slide - MS Office 2007

    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!


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-05-2009, 11:38 PM 186955 in reply to 186824

    Re: Excel Chart Export To PowerPoint Slide - MS Office 2007

    Hello,

    Please see this post.

    http://www.aspose.com/community/forums/permalink/186643/186953/showthread.aspx#186953


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-10-2009, 10:25 AM 188019 in reply to 186955

    Re: Excel Chart Export To PowerPoint Slide - MS Office 2007

    Hi there,

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

    http://www.aspose.com/community/forums/thread/175247/creating-excel-chart-and-embedding-them-as-ole-object-inside-a-presentation.aspx

     

    Basically, I'm having problems here in this method below. I need to use ASPOSE.SLIDES.PPTX.PICTUREEX and the first line of code below is a problem since the code below is for Excel 2003. Correct? And I'm converting the code below into VB. Thanks so much for your help!

          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

     
View as RSS news feed in XML