Problems with attaching files to OleObjectFrame

Hi, I've been trying to get this part working for a long time it just doesn't seem to work as expected.

This is what I need to get done using aspose.slides:
I need to be able to attach any file to a powerpoint slide as an icon. When the user opens the document he should be able to click the icon and save the file.

It is possible to do this from powerpoint (office 2003) by Insert -> Object -> From file -> choose file and check "Show as icon" with any file including files without extension. It seems like powerpoint does not need to support the OLE type when doing this and opens the file in the right application using the associated file extension.

I've read all posts in this forum on this subject and none seems to work well:

1. I've tried to replace the data inside an PDF document I attached in powerpoint with another PDF document, this seems to work. Since I need to be able to add multiple PDF documents I tried to clone the attached file but this does not work. When I serialize the OleObjectFrame shape and then add the shape I get an PictureFrame and not an OleObjectFrame. This PictureFrame can't be casted or converted to a OleObjectFrame so I can't replace the data. This is a quite bad solution even if it works since I need to add shapes for all file types that the user should be able to attach.

2. I've tried to add the files using the AddOleObjectFrame using the approach you recommend in the thread:

<A href="https://forum.aspose.com/t/104650</A></P> <P>When I do this pdf files does not work and when I try to click on the files in powerpoint I get the message : "An unknown error occured or the server program can not be found. You might have to reinstall the server program". Adding an image as Imager will not work either and gives me the same error message. I've tried to add MS Excel and MS Word files using a similar approach but by setting the ObjectType to the corresponding values and this works just fine.

I've also tried to set the properties of the OleObjectFrame after adding an PDF to make sure it has the exact same properties:

ObjectIsIcon true bool
ObjectIsLink false bool
ObjectName "Acrobat Document" string
ObjectProgId "AcroExch.Document.7" string
ObjectType Unknown Aspose.Slides.OleObjectType

This still does not work and gives me the same error. I've attached the new.pdf file to this thread.

Me and larsxe has been trying to work around this problem for months now (see his posts in the forums) without any good solution/answer from you guys. Is it possible for you to fix this? If you can fix it, can you also please attach a working code example on what ObjectName to use when calling the AddOleObjectFrame method for the following formats or any code on how to attach the following files (its important that the attached files has ObjectIsIcon = true):

.gif
.jpg
.png
.txt
.pdf

When you provide a solution, please attach sample files (.pdf, .txt, .gif, .jpg, .png) as well so we can debug here in case it still does not work on our machines.


Note:
We're using Office 2003, Visual Studio 2005 (2.0.50727 SP1 .NET Framework).

Regards
Jesper

Dear Jesper,

PDF is actually Ole1 type object, which Aspose.Slides can only read but can't write it back. So it is not possible to embed them.

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

Yes, 1.8.3 can read any Ole1 and Ole2 objects but can write Ole2 only.

We tried to implement embedding pdf objects some time ago but without success.

Currently we should reinvestigate such possibility.

In theory, it's possible to implement this feature.

Ok, so its not possible to attach the file as a binary stream and let the operating system shell open the file depending on the file extension?

I'm not sure but it seems like powerpoint can do this with unsupported file types when you attach them as an icon (not displaying any of the file content in the powerpoint slide). This approach would let you attach any file type as an icon without you guys having to write any format specific code in aspose slides.

See my previous post on how this is done in PowerPoint 2003.

Regards
Jesper

On the subject of attaching files, is it possible to attach an image as an icon (when you click it you get to save it to your hard drive)?

Regards
Jesper

Hello Jesper,

All unsupported file formats, text files, images and etc. inserted as Ole1 objects.
But you know, currently it’s not possible to create Ole1 objects.