Aspose.Slides for .NET: OleObjectFrame Cannot Insert ThinkCell Embedded Object

Hi, I’m using Aspose.Slides 24.4.0

I am trying to re-create a Think-Cell shape from one slide on another and I am trying to use the same embedded file as was on first slide.

And I’m getting an exception while using
ShapeCollection.AddOleObjectFrame(X, Y, Width, Height, new OleEmbeddedDataInfo(embeddedFileStream.ToArray(), extension));
method for that.

Exception is the following:

“Parameter is not valid.”
at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap…ctor(Image original, Int32 width, Int32 height)
at Aspose.Slides.ShapeCollection.(Single , Single , String )
at Aspose.Slides.ShapeCollection.(Single , Single , IOleEmbeddedDataInfo )
at Aspose.Slides.ShapeCollection.AddOleObjectFrame(Single x, Single y, Single width, Single height, IOleEmbeddedDataInfo dataInfo)

The file I need to use as an embedding (put in an archive, as uploading .bin files is not allowed):
file_for_embedding.zip (3.8 KB)

Presentation, wherefrom I tried to re-create an OleObject:
presentation_example.zip (25.0 KB)
Mentioned OleObjects are on a slide and on a Slide Master.

@GeorgiyS,
Thank you for contacting support.

We need more details to investigate the case and help you. Could you kindly share a complete code example to reproduce the error you encountered?

Sure, sending you the .NET solution with the presentation provided and the code sample.

TestProjectForOleObject.zip (85.6 KB)

@GeorgiyS,
Unfortunately, the archive file you attached does not contain an example project.

Sorry, it looks like there happened something with my computer during copying the project into archive.

Now it definitely contains one.
TestProjectForOleObject.zip (137.8 KB)

@GeorgiyS,
Thank you for the sample project. I’ve reproduced the error you described. Please note that you cannot specify width and height parameters for the new OLE object equal to zero. Please try to use valid values.

More examples:
Manage OLE|Aspose.Slides Documentation

Thanks for checking. Yes, using the value 1 for height and width fixed the issue. Hovewer, using the actual values, which were there for a Think-Cell object, being 0.125039369f still causes an exception. Looks like, 1 is a minimal value for the OLE object’s height and width.

@GeorgiyS,
It looks like you are right, Aspose.Slides does not allow creating OLE objects with width and height less than 1. Please try using the following code line to create a clone:

var oleClone = slide.Shapes.AddClone(oleObjectShape);

Shape Manipulations|Aspose.Slides Documentation

Understood, thank you

@GeorgiyS,
Thank you for using Aspose.Slides.