How to determine if two slide objects are equal?


Lets assume I have one .ppt file which contains exactly one slide. In code I create two Presentation objects which both have been loaded from that .ppt file.

Each Presentation object now contains a Slide object. These reside in a different location in the memory. Therefore the comparision (slideFromPres1== slideFromPres2) fails --> two different pointers. But the content of these object is evidentially the same.

How can I check if the content of two slides is completely identical? The Equal method of Slide seems not be overridden (the comparision also fails).

Thanks and regards

Dear Thomas,

Check if their Slide.SlideId property is same.

Ok. And what if I clone a slide? The cloned slide gets a different SlideId. How can I check if a cloned slide is equal with its original? Or how can I check if two MasterSlides which I added both to the same presentation are same?

Best regards

Ok, then try Slide.Name property. Before cloning a slide to other presentation, set its name so that you could recognize it later.


Presentation pres = new Presentation(@"C:\source\srcPres.ppt");

Slide sld = pres.GetSlideByPosition(2);

sld.Name = "SecondSlide";

Presentation pres1 = new Presentation();

Slide sld2 = pres.CloneSlide(sld, 1, pres1, new SortedList());

//Will print 'SecondSlide'


Perfect. Setting a GUID as the slide name will do the trick.


Using latest Aspose.Slides for .NET 20.6, you can now compare the two presentation files not only on presentation level but on 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.");