Free Support Forum - groupdocs.com

Compare PPT documents with style changes detection in Java

Hello ,

My use case is to compare and identify differences between 2 ppt’s. All differences in style, text, anchor positions, text alignment etc needs to be identified. I am using groupdocs 19.10.
I have a valid purchased license.
In my testing, i have noticed that if an element on the ppt is moved ( like an image got moved or a line got moved) etc the difference is not reported. Is there a specific method in the ComparisonSettings class that i should call?

Currently, I am using the following methods

    settings.setGenerateSummaryPage(true);
    settings.setCalculateComponentCoordinates(true);
    settings.setDetailLevel(3);
    settings.setStyleChangeDetection(true);
    settings.setShowDeletedContent(true);
    settings.setSensitivityOfComparison(100);

Let me know if there any other recommendations to catch all changes between 2 ppts.

1 Like

@pnatteru,

Please share following details with us, we’ll then investigate this scenario:

  • Development environment (Java or .NET)
  • Source and Target PPT files along with expectd output

Dev environment is Java.

I am comparing Test Sample 1 ppt with Test Compare PPT. you can notice that the position of the text “Welcoming Folks. This is a test to check if PPT’s match” is different between the 2 PPT’s.

I have attached the result page as well. It does not seem to recognize that the position of the text rectangle is different.

Also, I found this method in an older version.
settings.setMovedContentDetection. This method is depricated in the latest version.

Result Page 1.jpg (148.8 KB)
Result Page 2.png (41.5 KB)
Test Compare.jpg (153.8 KB)
Test Sample 1.jpg (151.4 KB)

1 Like

@pnatteru,

Thanks for sharing the details. We are investigating this scenario (detect element position changings). Your investigation ticket ID is COMPARISONJAVA-764. As there is any update, you’ll be notified.

Hello,

Any updates on this ticket? COMPARISONJAVA-764

We are awaiting a solution for this issue.

thanks

@pawann,

We’re still investigating this issue. We’ll notify you about the outcomes soon.

@pawann,

This issue will be fixed in upcoming release of the API that is expected in March 2020. As release gets on-board, we’ll notify you.

Thanks. Please let is know once this is available.
Quick Question : Is there a method to get the values of the element that are different?
Lets say in PPT1, Text is “Hello” and in the second PPT text in the same location is “Hello…”, Is there a method using which I can get both the values “Hello” and “Hello…” as they are different.

thanks
Pawan

@pawann,

Sure.

When you compare two PPTX files with different content (irrespective of the location), you will see the difference in the output. Please have a look at these source, target and output.zip (86.4 KB) files. Source file has “Hello”, target file has “Hello…” and the output clearly shows the difference in the form of inserted or deleted items.

Thanks .

However, my requirement is that some differences are ok (numerical values) and should pass the check. In my wrapper, I want to be able to iterate through the differences and determine at run time, if the differences are Ok to pass.
Hope my requirement is clear.

thanks
Pawan

@pawann,

I think you are looking for this solution. Am I right, we’ll then assist you accordingly.

Yes, this would help. However, are these methods/classes available for PPT Comparison in Java? i cant seem to find them in Groupdocs-Comparision 19.10 jar.

changes[0].ComparisonAction = ComparisonAction.Reject;
comparer.ApplyChanges

1 Like

@pawann,

We are investigating this. Your investigation ticket ID is COMPARISONJAVA-774. As there’s any update, you’ll be notified.

@pawann,

This is how you can reject changes in Java variant of the API:

  Comparer comparer = new Comparer();
  ICompareResult result = comparer.compare(sourcePath, targetPath, new ComparisonSettings());
  ChangeInfo[] changes = result.getChanges();
  changes[0].setAction(ComparisonAction.REJECT);
  result.updateChanges(changes);
  result.saveDocument(resultPath);

Please let us know if you face any issue.