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

Free Support Forum - aspose.com

Problem with too many master slides on destination presentation

I have a project where I am cloning multiple slides into one presentation. On the destination presentation there are multiple masters that are exactly the same. How do I get rid of the duplicates?

Dear Daniel,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides.

Master slides are really small and don’t contribute considerably in presentation size.

Anyway, you can get rid of by changing the masters of your newly cloned slides. Aspose.Slides provides Slide.ChangeMaster() method which takes parameter of master slide.

Suppose, you want to change master of slide2 same as that of slide1. Your code will look something like this

Slide slide1Master=presentation.GetSlideById(slide1.MasterId);


Once, you change the master of all slides to some single master, you can delete all unused Masters using Presentation.DeleteUnusedMasters() method.

Ok, I understand that, but the problem is that I have 250 slides in my generated presentation and each one has a different master slide. The source files have probably 5 or 6 different master slides all together, but each slide in the generated one has it’s own master. Is there any way to tell in code if the master slides are the same?

Dear Daniel,
Aspose.Slides tries to minimize a number of cloned masters, but it needs caller’s cooperation. Please check the “idList” parameter of the CloneSlide method, it stores information about already cloned masters. If you will pass the same sortedlist for every source and target presentation pair, there will be much lesser unnecessary masters.