Free Support Forum - groupdocs.com

Compare in detail with Options


#1

How to compare with/ without below options ?

  1. Font family type
  2. Font size
  3. Change case
  4. without formatting
  5. Bold style
  6. Italian
  7. Underline
  8. StrikeThrough
  9. Subscript
  10. Superscript
  11. Text effect and Typography type
  12. background color
  13. font color
  14. Bullets
  15. Numbering
  16. Multilevel List
  17. Decrease / Increase Indent
  18. Alignment
  19. Line and Paragraph Spacing
  20. Shading
  21. Table Borders

Sometimes we need to compare with some of the options above and other options are don’t want to show the differences !!!
how can we do this type of comparison with GroupDocs ?

Seen 2 options only StyleChangeDetection & StyleChangedItemsStyle


#2

@kranthireddyr,

Do you mean that you have such options in the documents (source and target) and sometimes you want to compare all of them and sometimes some of them? For example you want to compare Superscript in both docs but not Subscript?


#3

@atirtahir3

Yes, we want compare only the some of the options(Superscript/ few of above mentioned options) not with all Changes.

Here user can able to select Compare with above options,
1.User may Compare only Bold type compare
2.User may compare with Background color and Bold type Compare etc…


#4

@kranthireddyr,

This feature is not yet supported by the API. However, we will investigate it but we cannot share any ETA at the moment.
As a workaround, you can get changes by node type after the comparison and then choose item(s) that you need, and work with it.
Let me further elaborate this:
You can get array with all changes by invoking method GetChanges() from ICompareResult interface. After this you can either accept or reject the changes by index as shown in the code sample below:

Comparer comparer = new Comparer(); 
ICompareResult compareResult = null;
compareResult = comparer.Compare(sourcefile, targetfile, new ComparisonSettings());
ChangeInfo[] changes = compareResult.GetChanges();
changes[5].Action = ComparisonAction.Reject;
compareResult.UpdateChanges(changes);

You can also get any needed information from ChangeInfo properties like:

  • Id of change
  • Type of change
  • Area of change
  • Text value of change
  • Style changes
  • Authors
  • NodeType or NodePosition

#5

@atirtahir3
No with this above code also we can not archive style types of Comparison !

We found below two type to switch the style comparison, but we need specific types in it !!!

changes[0].Type = GroupDocs.Comparison.Common.TypeChanged.StyleChanged;

or

Settings.StyleChangeDetection = true;

how to reject spcific style change with above code


#6

@kranthireddyr,

If I am not wrong, you are looking for a way to show comparison difference or style changes in a customized way. For example, you want to set inserted items style to bold and italic. And for deleted items you need to set a different font color and add underline. Can you please confirm this?


#7

@atirtahir3

Please find the Sample documents for more clarity Sample.zip (47.9 KB)

  1. we want to compare with Bold type changes only so, result should be like Result_1.docx.
  2. Bold type and font color type changes result should be Result_2.docx.
  3. etc… with all the combinations.

#8

@kranthireddyr,

Thanks for the explanation but you cannot do such type of comparison. The only workaround is to get all the changes in array and then decide what changes to reject.

And then on that basis you can allow or reject output/differences.