Failed to Embed OLE Objects into a Presentation for PDF and PPTX Documents in C#

Hello,


I’m not able to embed OLE objects of type PDF or PPTX. XLSX and DOCX are embedded properly.

I’ve attached a sample project, which creates a PPTX with linked OLE objects (all types are working) and another one with embedded OLE objects. You’ll see, that in the embedded version, PDF and PPTX won’t open and PowerPoint shows an error message.

Thanks.

Hi Daniel,


I have worked with the sample code shared and have been able to observe the issue specified. An issue with ID SLIDESNET-34366 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

I am having the same issue. Can you advise what the value of className should be for a PDF file in:

mySlide.Shapes.AddOleObjectFrame(x, y, width, height, className…

I am running aspose.slides for .net 7.6.0 on windows 7.

Thanks!

Hi Craig,


I have observed the requirement shared and suggest you to please try using following sample code to get the file name. The Class name depends on the type and format of the file.

private static string GetClassName(string fileName)
{
var ext = (Path.GetExtension(fileName) ?? “”).ToLower();
var key = Registry.ClassesRoot.OpenSubKey(ext);
return key != null ? key.GetValue(null).ToString() : null;
}

Many Thanks,

For pdf what will be the class name ?

I need this to work in java version of Aspose slide.

Hi Jahir-ud-din,


Thanks for inquiring Aspose.Slides.

I have observed your requirements for getting the class name of file in Java environment and have shared the sample project that will serve the purpose for you in getting the class name for file extensions. The PDF has class name AcroExch.Document.11 that you need to set for your Ole frame. However, I suggest you to pleas try using the shared sample code to get the PDF class name on your end.

Many Thanks,

Hi Mudassir,

I tried with that but found no luck.
Could you please verify below code I am using ?
Also the sample code is .Net, can you please suggest me the java code to get the class ?

//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();

//Access the first slide
SlideEx sld = pres.getSlides().get_Item(0);

//Load an Excel file to Array of Bytes
File file=new File(“testpdf.pdf”);
int length=(int)file.length();
FileInputStream fstro = null;
try {
fstro = new FileInputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
byte[] buf = new byte[length];
try {
fstro.read(buf, 0, length);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

//Add an Ole Object Frame shape
OleObjectFrameEx oof = sld.getShapes().addOleObjectFrame((float)0,(float) 0, 0, 0, “AcroExch.Document.11”, buf);
oof.setHeight(100);
oof.setWidth(100);
// oof.setObjectIsIcon(false);
//Write the PPTX to disk
pres.write(“outputpdf.pptx”);

Thanks,
Jahir

Hi Jahir,

I have observed the sample code shared by you and it is in fact in Java. I have embedded the sample code shared by you in a sample application and I have shared that for your kind reference. The sample code works fine and presentation is generated as well. However, the issue is when you add PDF as ole frame the Ole frame is not getting enabled when viewed in PowerPoint. This is in fact a an issue in Aspose.Slides for .NET and I have created a separate issue with ID SLIDESJAVA-34120 to further investigate and resolve the issue in Aspose.Slides for Java as well. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Hi Mudassir,

Please let me know the resolution asap. I am holding due to this to buy full license.

Thanks,
Jahir

Hi Jahir,

I like to share that the issue has just been created and will be scheduled for investigation and resolution on its due turn by our development team. I will share the feedback with you as soon a the issue will be resolved.

Many Thanks,

Hi,

Are there any updates?

Hi Jahir,

I have verified from our issue tracking system and regret to share that the shared issue is still pending for resolution owing to already pending paid enterprise and priority support customers. I will be able to share the further feedback with you in this regard as soon as the issue will be scheduled for investigation and resolution.

Many Thanks,

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