Free Support Forum - aspose.com

Slides version 4.0.0.1 cannot find OleObjectFrameEx objec

Hi,
I created a simple powerpoint file in the Office 2007,with one slide and one chart.
I am trying to access this chart using following code.
Dim p As Aspose.Slides.Pptx.PresentationEx = New Aspose.Slides.Pptx.PresentationEx(“C:\test2.pptx”)
Dim s As Aspose.Slides.Pptx.SlideEx = p.Slides(0)
Dim sp As Aspose.Slides.Pptx.ShapeEx
Dim oof As Aspose.Slides.Pptx.OleObjectFrameEx
For Each sp In s.Shapes
If TypeOf sp Is Aspose.Slides.Pptx.OleObjectFrameEx Then

oof = sp
End If
Next

The Problem is I cannot access OleObjectFrameEx, the code above only returns GraphicalObjectEx type.

Is there anything i am missing, I want an ablity to open PPTX file , change the chart data and save it as some other file.
Please let me know if this is do-able in this library.
Thanks
Saurabh

Hello,

4.0.0 version can find Ole objects in our tests. Could you please provide example of presentation for testing and investigation.

Thank you.

Code I am using is
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim str As String = “”
Dim p As Aspose.Slides.Pptx.PresentationEx = New Aspose.Slides.Pptx.PresentationEx(“C:\test2.pptx”)
Dim s As Aspose.Slides.Pptx.SlideEx = p.Slides(0)
Dim sp As Aspose.Slides.Pptx.ShapeEx
For Each sp In s.Shapes
MessageBox.Show(sp.GetType().ToString)

Next

MessageBox.Show(“done”)


End Sub







I am attaching powerpoint , with it also, it is simple slide with default chart object , nothing fancy , may be I am missing something assembly version 4.0.0.1.

Hello,

It looks like there are 2 types of charts can be inserted to a pptx slide. Both are Excel Charts but stored in a different format.

Currently we only support charts which inserted as “Microsoft Excel Chart” OLE object. Charts inserted simply as “Chart” can’t be recognized yet. We will add support for these objects in the future.

Hi ,
I am trying to insert the chart created in excel 2007, in to a blank ppt slide.
This works fine if I use slides (2003) library and xl 2003 .
I modified the code given in documentation to pptx version by changing namespace etc and keeping logic same.

Dim pres As Aspose.Slides.Pptx.PresentationEx = New Aspose.Slides.Pptx.PresentationEx(“C:\test2.pptx”)
'Accessing a slide using its slide position
Dim slide As Aspose.Slides.Pptx.SlideEx = pres.Slides(0)
'Reading excel chart from the excel file and save as an array of bytes
Dim fstro As System.IO.FileStream = New System.IO.FileStream(“C:\chart.xlsx”, System.IO.FileMode.Open, System.IO.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
slide.Shapes.InsertOleObjectFrame(0, 0, 0, 300, 300, “Excel.Sheet.12”, b)
'Writing the presentation as a PPT file
pres.Write(“C:\modified.pptx”)

I am attaching output file and chart with this post for your referece.
Can you please let me know if I am doing something wrong or there is issue with the library.

thanks
Saurabh

Hi Saurab,

The support for xslx files as ole objects will be available soon as it has been part of our plans.

I have tried same code, instead of using xlsx file, i save xlsx file as “xls” in excel 2003 format using MS excel, and i couldnt get the excel embeded into the pptx. can you please let me know what I am missing.
Thanks
Saurabh

This is the code

Dim pres As Aspose.Slides.Pptx.PresentationEx = New Aspose.Slides.Pptx.PresentationEx(“C:\test2.pptx”)
'Accessing a slide using its slide position
Dim slide As Aspose.Slides.Pptx.SlideEx = pres.Slides(0)
'Reading excel chart from the excel file and save as an array of bytes
Dim fstro As System.IO.FileStream = New System.IO.FileStream(“C:\chart.xls”, System.IO.FileMode.Open, System.IO.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
slide.Shapes.InsertOleObjectFrame(0, 0, 0, 300, 300, “Excel.Sheet.8”, b)
'Writing the presentation as a PPT file
pres.Write(“C:\modified.pptx”)

Hi Saurab,

Your code is ok. The problem is with your xls file. Use the xls attached instead.

Thanks a lot for providing excel.
The issue is after creating new file , I see embeded Ole object image, after double clicking on it , i can see the chart. Attached are “before” and “after” images. I wanted to know if there is workaround for this.
The program we are builinding needs export to chart functionality, the image shown and double clicking each chart would not be acceptable to client .
Can you please let me know.
Thanks…
Saurabh

Hello,

You can render Chart to image with Aspose.Cells. After that you can use created image for replacing standard “OLE Object Changed” text.

Hi,
Can you please point me to the example using pptx for attaching bitmap image to ole object frame.
Thanks
Saurabh

Hi Saurab,

Here is an example for that:

Stream pic = new FileStream("waterfall.jpg", FileMode.Open);

Bitmap rim = new Bitmap(pic, false);

ImageEx image = pres.Images.AddImage(rim);

OleObjectFrameEx oof = sld.Shapes.AddOleObjectFrame(0, 0, sldSize.Size.Width, sldSize.Size.Height, "Excel.Sheet.12", mstream.ToArray());

oof.Image = image;

The issues you have found earlier (filed as 10808) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.