We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback


Trusted by the world’s leading companies

Overview

The Syncfusion .NET Word Library (DocIO) allows users to identify the changes between two versions of a Word document as tracked changes by comparing them, without requiring Microsoft Word or interop dependencies. With precision, it programmatically highlights insertions, deletions, and formatting changes.


How to compare Word documents in C#

  1. Install NuGet package: Install the Syncfusion.DocIORenderer.Net.Core NuGet package in your project.  
  2. Load in .NET Word Library: Create WordDocument objects for the original and revised Word documents by passing the FileStream object.
  3. Compare Word documents: Use the Compare method of the WordDocument class to compare the Word documents.
  4. Save Word document: Save the WordDocument object to the FileStream object.  

Here is an example of how to compare the Word documents in C# using the Syncfusion .NET Word Library (DocIO). 

//Load the original Word document.
using FileStream originalDocumentStream = new FileStream("OriginalDocument.docx", FileMode.Open, FileAccess.Read);
using WordDocument originalDocument = new WordDocument(originalDocumentStream, FormatType.Docx);

//Load the revised Word document.
using FileStream revisedDocumentStream = new FileStream("RevisedDocument.docx", FileMode.Open, FileAccess.Read);
using WordDocument revisedDocument = new WordDocument(revisedDocumentStream, FormatType.Docx);

//Compare the original and revised Word documents.
originalDocument.Compare(revisedDocument);

//Save the Word document.
using FileStream outputDocumentStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite);
originalDocument.Save(outputDocumentStream, FormatType.Docx);

Comparison options

Set author and date

Specify the author’s name and the date for revisions, simplifying the identification of changes during the comparison of Word documents.

Ignore format changes

Users can focus solely on content changes by ignoring formatting differences.




Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon