Property to turn off locked aspect ratio for OLEObjectFrame

Hi,

By default an OLEObjectFrame has the locked aspect ratio property enabled. Is there a property in Aspose.Slides to uncheck this?

Thanks again for your support.

Shaun

Dear Shaun,

No, you cannot turn Lock Aspect Ration off/on via Aspose.Slides.

But if you really need to turn it off, then you can have one work around, create an OLE object inside your template ppt via MS-PowerPoint, uncheck its Lock Aspect Ratio, then update it with your new OLE object via Aspose.Slides.

To illustrate further, I have create srcPres.ppt in MS-PowerPoint and added a chart on first slide, then I unchecked the Lock Aspect Ratio. Having that, I read this presentation via Aspose.Slides, located the chart (which is an OLE object) and update it with another OLE object (which is an excel sheet mySheet.xls)

I have attached the code, output ppt, source ppt and source excel sheet. Please see the code below.

Presentation srcPres = new Presentation(@"c:\srcPres.ppt");
Slide sld = srcPres.GetSlideByPosition(1);

//Get the ole object
OleObjectFrame oof = sld.Shapes[0] as OleObjectFrame;

//Update it with our ole object
FileStream fin = new FileStream(@"c:\mySheet.xls", FileMode.Open);
byte[] xlData = new byte[fin.Length];
fin.Read(xlData, 0, (int)fin.Length);

oof.ObjectClassName = "Excel.Sheet.8";
oof.ObjectData = xlData;

//Write it on disk
srcPres.Write("c:\\outOLE.ppt");

Hi. Thanks for that. My intention was to use the OLE Object in the template as the base for each chart I am creating. The code I am using to do this is here:

OleObjectFrame chart = this.slide.Parent.Slides[0].Shapes[0] as OleObjectFrame;
chart.Width = this.w;
chart.Height = this.h;
chart.X = this.x;
chart.Y = this.y;
chart.ObjectClassName = "Excel.Sheet.8";
chart.ObjectData = chartObj.getMS().ToArray();
chart.PictureId = this.slide.Parent.Pictures.Add(new Aspose.Slides.Picture(this.slide.Parent, chartObj.getImageStream()));

MemoryStream chrt = new MemoryStream();
chart.Serialize(chrt);
chrt.Position = 0;
this.slide.Shapes.Add(chrt);

It works fine but except in the Powerpoint output all the objects appear to reference each other and trying to activate any other than the first crashes PowerPoint. I thought that by serializing the template object I would be making a copy of it each time. Is this not the case?

Any advice you could offer would be very appreciated. Thanks again.

Shaun

I have solved the problem by first creating a clone of the template slide and then removing it later.

Thanks again for your help.

Shaun

Dear Shaun,

That’s good, we will also implement the new feature of setting Lock Aspect Ratio of any shape as soon as possible and will let you know about it by posting here.

Thanks! You guys are awesome.

Do you have any update for this issue? Thanks!

Sorry, we couldn’t find the property to turn it off.
It will be available as soon as we will find it.