How to Compare Word documents

Often when working with document management, you may encounter a situation where you need to compare large files that are similar to each other, but have slight differences that you would like to know about. And, of course, finding these changes manually is quite a time-consuming process. GroupDocs.Comparison gives you many options for comparing a wide range of supported file formats, including PDF format.

After comparing the two Word files, you will get a resulting document in which the changes are highlighted in three different colors:

  • Elements that were inserted in the first file. – blue, by default
  • Elements wich were deleted from the first file – red, by default
  • Elements that have changed their styles (font, color, etc.) – green, by default
Source / Target / Result Words files

The code sample to compare two Word files:

string sourcePath = @"source.doc"; // NOTE: Path to the source word document 
string targetPath = @"target.doc"; // NOTE: Path to the target word document 
string resultPath = @"result.doc"; // NOTE: Path to the result word document       
using (Comparer comparer = new Comparer(sourcePath))
    CompareOptions compareOptions = new CompareOptions
        DetectStyleChanges = true,
        DetalisationLevel = DetalisationLevel.High
    comparer.Compare(resultPath, compareOptions);

More resources

Advanced Usage Topics

To learn more about document comparison features, please refer to the advanced usage section.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to compare your DOC or DOCX, XLS or XLSX, PPT or PPTX, PDF, EML, EMLX, MSG and other documents with free to use online GroupDocs Comparison App.

© Aspose Pty Ltd 2001-2022. All Rights Reserved.