Free Support Forum -

Slide equality

Hi I’m developing some code in aspose slides java 20.10
have I misunderstood slide equality?
I have a situation where slides are reporting equality when they’re are not.

specifically if I have
IBaseSlide s1;
IBaseSlide s2;
s1.equals(s2);// returns true
s1.getShapes().equals(s2.getShapes());//returns false

can slides be considered equal if their shape collections are different? (both slides have very similar content but some text is in a different place and style)

on further investigation it looks like the shape collection comparison always returns false;
but if I walk through the collection and compare frames I can find one mismatch…

s1.equals(s2);// returns true
for(int i=0;i<shapeCollection1.size();i++){
shape1.getFrame().equals(shape2.getFrame();// this will return false on one frame


The slides are considered equal if they have every thing the same inside them. When you will compare the two, it will give you true or false accordingly.

@mudassir.fayyaz even if the things are in different locations and have different fill style? (182.0 KB)

 public static void main(String[] args) {
        try {
            String dataDir = new File(".").getAbsolutePath() + File.separator;
            Presentation Pres1 = new Presentation(dataDir+"simple.pptx");
            IGlobalLayoutSlideCollection layouts=Pres1.getLayoutSlides();                       

            ILayoutSlide layout1= layouts.get_Item(0);
            ILayoutSlide layout2= layouts.get_Item(1);
            System.out.println("layout1.equals(layout2) returns "+layout1.equals(layout2));            

        catch( Exception e){
            System.out.println("Error  Exception in code: "+e.getMessage());
            System.exit(1) ;

simple example (uploaded as a zip as the site wouldn’t allow uploading ppt)
output is
layout1.equals(layout2) returns true
but the 2 layouts are different


I have created an issue with ID SLIDESJAVA-38357 in our issue tracking system to further investigate this on our end. We will share the feedback with you as soon as the issue will be addressed.

1 Like (390.8 KB)
Here’s another example where everything is in the same place but an image has changed (but it still reports the layouts are the same). Hope this is useful.


I have associated information in our issue tracking system and will share the feedback with you as soon as the issue will be addressed.

1 Like