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
shapeCollection1=s1.getShapes();
shapeCollection2=s2.getShapes();
for(int i=0;i<shapeCollection1.size();i++){
shape1=shapeCollection1.get_Item(i);
shape2=shapeCollection2.get_Item(i);
shape1.getFrame().equals(shape2.getFrame();// this will return false on one frame
}

@JamesDriscoll

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?

simple.zip (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

@JamesDriscoll

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

simple.zip (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.

@JamesDriscoll

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

The issues you have found earlier (filed as SLIDESJAVA-38357) have been fixed in this update.

Hi thanks for this - It may have improved but it’s still not working for all slides (slides with different text content is combing back as equal as are tiles with shapes in differenet places). when I have a little more time I will see if i can generate some simple examples.

@JamesDriscoll

We have also modified the example in online documentation as well. I request you to please consult this documentation link for your convenience as well. If you still encounter issue, please share the details as shared before for further investigation on our end.

simple (2).zip (23.2 KB)

Here’e a simple example where text is different on the layouts but the equality check above will return true

simple (3).zip (23.2 KB)
and another example where the text areas are in different locations but it still thinks the layouts are equal,
Hope this helps

@JamesDriscoll

Thank you for sharing the information. We have opened a new ticket with ID SLIDESJAVA-38435 and linked with older one to further investigate the issue based on new set of information shared by you. We will share feedback with you as soon as it will be addressed.

The issues you have found earlier (filed as SLIDESJAVA-38435) have been fixed in this update.

Sadly, although you have fixed the example slides provided the equality check is still broken. Aspose sometimes reports false when slides are equal and sometimes reports true when slides are unequal. I will try to allocate some more time to provide some more simple examples of when it fails .

Here’s one example.
Enclosed are two identical powerpoint files - one saved on 30/03/2021 (I changed the computer date) and one saved on 31/03/2021 without changing anything else.

I don’t think fields that display the current date should fail equality because the file happens to be saved on a different date. any documents loaded into power would display whatever the current day is rather than the date is was saved.
dates.zip (21.6 KB)

It may also be useful to clarify in the documentation what happens about equality of layout slides. I believe at the moment you say layout slides are equal even when they have different master slides. Depending on the scenario it may also be required to do a further test of equality via a call to getMasterSlide()

@JamesDriscoll

We are sorry for your inconvenience. I have associated the information in our issue tracking system and we will get back to you with feedback as soon as possible.