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

Free Support Forum - aspose.com

How to compare two presentations files (Java)

Hi
I want to compare the two presentations in the following way:

  1. It will check whether presentation having the same number of slides or not
  2. It will check the master slides and properties of slides like background color, title, the layout of slides, etc.
  3. It will check the content like text present in the slides, the properties of text(font size, color,etc.)
  4. It will check the images, shapes, etc.

I try this method but it’s not meeting the expectations https://docs.aspose.com/display/slidesjava/Changing+a+Slide’s+Layout#ChangingaSlide%27sLayout-Comparetwoslides

@Shree995,

Can you please share source files so that we may further investigate to help you out.

I am testing the code in slides-java-example the same repo which is shared by ASPOSE team for reference. In this project, I just put my code inside the CheckSlidesComparison class. The changed code get from attachment. CheckSlidesComparison.txt.zip (735 Bytes)

Using this method it’s not giving false in the following cases:

  1. Colour change of text or shape
  2. Font size changes
  3. Font style changed to underline
  4. Theme changes
  5. One shape changed to another shape
  6. Text change inside the shape like in round shape if I have 1 and in the second slide it has 2 in round shape then it’s not taking it as different
  7. Remove image from header

@Shree995,

I have observed the sample code shared by you and regret to share that at present there is no support available in API to compare two slides. One may need to devise his own approach to individually check each and every shape belonging to a particular slide along with all of its respective properties.

Thanks @mudassir.fayyaz for quick response.

@Shree995,

You are always welcome.

@Shree995,

Using latest, Aspose.Slides for Java 20.6, now you can compare the presentation files not only presentation levels but also have provision to compare master slides, layout slides and individual slides. Please refer to following example for usage of the supported feature.

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

            //Comparing on presentation level
            if(Src1Pres.equals(Src2Pres))
            {
                    System.out.println("Two Presentation files are equal");
            }

            //Comparing Master slides
            if(Src1Pres.getMasters().get_Item(0).equals(Src2Pres.getMasters().get_Item(0)))
            {
                    System.out.println("Masters are equal.");
            }

            //Comparing Layout slides
            if (Src1Pres.getMasters().get_Item(0).getLayoutSlides().get_Item(0).equals(Src2Pres.getMasters().get_Item(0).getLayoutSlides().get_Item(0)))
            {
                    System.out.println("Layout are equal.");
            }

            //Comparing Normal slides
            if (Src1Pres.getSlides().get_Item(0).equals(Src2Pres.getSlides().get_Item(0)))
            {
                    System.out.println("Slides are equal.");
            }

    }