Cloneslide results in corrupt presentation - Error accessing presentation

We're using Powerpoint 2003 Sp2 and have uncovered something very strange.

Run the app

It'll create a file called outputAfterClone.ppt Open up outputAfterClone.ppt Go to the 2nd slide, the one with the header called "Act"

Grab 1 of the 2 screenshots in the upper left corner of the slide and move it somewhere, anywhere Click save, it'll save fine Grab the second screenshot in the upper left corner of the slide and move it somewhere, anywhere Click save, you'll get an error, see attached screenshot

Can someone take a look at this and let me know? Any help would be appreciated.

Phil

Dear Phil,

Sorry, I couldn’t find the problem yet but will try to do it of course.
Now the only one solution is not delete unused master slides.

deleting the unrefernced master slide is part of our business need so it's something we cannot avoid. After a lot more effort, however, it appears that in some cases our customers are giving us presentations that have oledata associated with the master. When I save the presentation as a web page, it is clear that by the oledata.mso file and its explicit reference from the master.htm file that this is the case. So when the slide is clone to another presentation, the master (and the oledata) comes with it.

So in our case, when there are multiple slides cloned from multiple presentations, each of which has an oledata referenced by the master (the master of course, is subsequently delete), the result is that the oledata objects combine and balloon the file size. If the oledata objects are different (how they got there I don't know, what they are I don't know), then we have some bizzarre behavior like this.

So in the end, we have a work around for now and a way to manually identify the presentations. Thanks for the response, this is really just meant as an FYI from a customer who may be pushing the boundaries of aspose.slides a little.

Phil

In any case that is interesting question…

Really if OLE object doesn’t have links to any slide it should be deleted when you save presentation.
So that is strange enough if file grows too much.

Do you need OLE object after cloning? If I understood right you don’t need it.
As a quick and dirty solution I can offer checking master slides and delete all OLE objects before cloning.
Iterating all shapes and deleting some should work very quickly. That is the most quick operation.

I attempted to remove all shapes on all masters before cloning using code that looks kinda like this:

For Each master As Aspose.Slides.Slide In slide1Ppt.Masters
For i = master.Shapes.Count - 1 To 0 Step -1
master.Shapes.Remove(master.Shapes(i))
Next
Next

And we are still running into issues over here. The problem is certainly harder to reproduce now, but it still does happen on occassion. Should the above code remove all OLE objects as well or is there something else I need to do?

There is only one answer. You shouldn’t delete shapes (template shapes) from masters.
These shapes contain info about default formatting and also important things which are necessary for slide cloning.

Ok, right, I agree, deleting shapes from masters is normally a bad thing because it destroys the formatting. However you said:

"As a quick and dirty solution I can offer checking master slides and delete all OLE objects before cloning.
Iterating all shapes and deleting some should work very quickly. That is the most quick operation."

Also, after cloning these slides, we are changing their masters to a common master that has all of its shapes intact. I am only removing shapes from the masters of the cloned slides. Make sense?

MS PowerPoint creates presentations with standard template shapes on master slides.
You shouldn’t delete these shapes. But you can delete any shapes created by user.
For example you can delete all OleObjectFrame shapes.