Free Support Forum - aspose.com

OLE objects don't get loaded correctly

I’ve found another couple of problems relating to OLE objects, tested against the latest release 1.6.9.0.

The most important issue is that loading a PPT file containing an OLE objects seems to loose all the OLE data except the picture. For instance, this chunk of code creates two PPT files, the second of which is shorter and has lost the embedded objects:

Presentation presentation = new Presentation();
assertTrue(“Presentation creation”, presentation.getSlides().size()>0);

Slide slide = presentation.getSlides().get(0);
addOLE(slide, “Word.Document.8”, wordDoc, OLE1, 0);
addOLE(slide, “Excel.Sheet.8”, excelDoc, OLE2, 1);

FileOutputStream outputStream = new FileOutputStream(getFile(OUTPUT_PPT));
presentation.write(outputStream);
outputStream.close();

ByteArrayOutputStream baos = new ByteArrayOutputStream();
presentation.write(baos);
baos.flush();

Presentation readPresentation = new Presentation(new ByteArrayInputStream(baos.toByteArray()));
FileOutputStream output2Stream = new FileOutputStream(getFile(OUTPUT2_PPT));
readPresentation.write(output2Stream);
output2Stream.close();

Clearly, just loading a document and saving it is enough to corrupt the OLE objects, which is causing us a serious problem as we are selectively updating certain objects and leaving other alone. If all non-updated objects are deleted, this is clearly a serious problem!

It seems that on loading a document cotaining OLE objects, they all get turned into regular picture frames. Yet the release notes for 1.6.7.0 lists “Fixed: Recognizing ole objects”.

Additionally, I have discovered that calling getObjectData() on an OleObjectFrame always throws a PptReadException exception, even when called immediately after adding the object.

I have fixed PptReadException in getObjectData(). But I can’t reproduce losing OLE objects in the last 1.6.10 hot fix.
Both created presentations have normal ole object.
Try it. There were many fixes which are not listed in the blog. New 1.6.11 (with getObjectData) will be published in a couple of hours.

Excellent! I tried 1.6.11.0 and all my problems seem to be fixed.

Thanks again for your quick response!