We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cloning slides and master slides

I have a project where I am combining several presentations into one. It all seems to work fine except for the master slides are all from the source presentations. This causes some undesirable formatting results.

Here is my code, for each presentation i do this for the slides inside it.

for (int i = 1; i <= numslides; i++)
{
Slide slide = src.CloneSlide(src.GetSlideByPosition(i), dst.Slides.LastSlidePosition + 1, dst, new SortedList());
}


What I want to do is have every slide in the presentation use the same master slide. If I open the destination presentation in Powerpoint and delete all the master slides except the one that I want, then it fixes my formatting issues. I want to do this in code.

Thanks

Dear hensods,

Thanks for considering Aspose.Slides

You can change the master of slide via Slide.ChangeMater(), after changing masters of all slides, you can then remove all unused masters like this.

presentation.DeleteUnusedMasters();
presentation.DeleteHandout();

I have 2 questions about that:

1. How do I tell Slide.ChangeMaster() that I want to use the master that slide 1 is using?

2. What does DeleteHandout() do?

The following code changes the master of slide2 to the master of slide1

Slide mastrSld = presentation.GetSlideById(slide1.MasterId);
slide2.ChangeMaster(mastrSld);

DeleteHandout deletes the handout that may have cross references to unused masters