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

Free Support Forum - aspose.com

Finding identical/duplicate master slides in a presentation


can anyone guide me as to how to find identical/duplicate master slides in a presentation.

I want to delete duplicate/identical master slides and link up the slides to the unique master slide.



Dear Prashanth

Thank you for considering Aspose.Slides.

If I am not wrong, there is no way to detect, which slides are identical. However, you may devise a workaround using Presentation.DeleteUnusedMasters to get rid of such a problem.

but DeleteUnusedMasters will only delete if the master slide is not used up by any of the slide right? I have a presentation with duplicate master slides which are all linked to the normal slides. i want to find the duplicates, delete them from the presentation and link the slides which were originally linked to the deleted master slide to the unique master slide remaining now. please advise how this can be accomplished?.

Are you cloning slides from other presentation(s) or your source presentation has already duplicate master slides.

In later case, there is no way to determine the duplicate master slides and no way to get rid of them.

But in earlier case, when you clone slide from presentation, its master is also copied into the destination presentation. We can then save its master slide id and for rest of slides, we will change their masters to the saved master slide id, finally we will delete the unused master slides that were copied with rest of slides.

Dear Prashanth,

At first, please answer one question. Why you need delete master slides? Do you try to reduce ppt size?
If yes, deleting master slides won’t help. Master slide structure is very small. In the same time changing master operation can brake down whole ppt. That is experimental functionality and I wouldn’t suggest use it.

The second thing. Why your presentation has many duplicate master slides?
Are they all cloned from one presentation? In this case you simply use CloneSlide method in a wrong way.
If they cloned from different presentations but only look similar then they can’t be duplicate because they always absolutely different inside.

it will be easier to maintain if you have less master slides.else you have to apply changes to all the master slides(50 in number)

actually the source presentation has already been created by different persons and merged into a single presentation not through code but using powerpoint directly. each of those presentations have master slides which are identical. For maintainence purposes, i want to find the identical master slides and delete them and link the slides which are related to the deleted master slide to the unique master slide. Is this possible?



Dear Prashanth,

No, it is not possible, because they are not identical/duplicate internally; they are different, as Alexey explained to you earlier, so there isn’t any way for Aspose.Slides to detect, which of them are duplicate.

However, you can programmatically change the master slides of normal slides using Aspose.Slides.

In your case, you must find out yourself which master slide ids are to be used and which ones are to be discarded.

As Shakeel wrote there is no simple way to identify such master slides.
I theory you can compare background of slides, number of shapes and their formatting.


Now you can compare the presentation files on presentation level, Master slide level, Layout slide level and Normal slide level. Please try using following example on your end to get to know about usage of feature.

	public static void ComaprePresentationSlides()
		Presentation Src1Pres = new Presentation("Src1.pptx");
		Presentation Src2Pres = new Presentation("Src2.pptx");

		//Comparing on presentation level
			Console.WriteLine("Two Presentation files are equal");

		//Comparing Master slides
			Console.WriteLine("Masters are equal.");

		//Comparing Layout slides
		if (Src1Pres.Masters[0].LayoutSlides[0].Equals(Src2Pres.Masters[0].LayoutSlides[0]))
			Console.WriteLine("Layout are equal.");

		//Comparing Normal slides
		if (Src1Pres.Slides[0].Equals(Src2Pres.Slides[0]))
			Console.WriteLine("Slides are equal.");