Compare two Word files in C# using our difference checker. With our high-fidelity .NET API, you can find the difference between compared Word documents and export the results to a convenient file format.
Comparing documents is a rather difficult function to implement. But our .NET solution is designed so that you can get the most accurate result.
To compare two Word documents, our powerful .NET library compares content at both the character level and word level. If only a character has been changed, the word will be marked as the whole changed.
This way you can no longer look for differences in documents manually, but instead use our .NET API to compare documents.
Sometimes you are not sure if a document has not been modified, and comparing two document versions manually can be tricky. Or vice versa, you know for sure that the document has been changed, but manually searching for updated places is too hard.
In all these situations and more, you can diff two Word files using our product API. To compare two documents, simply load them, call the comparison method, and get the result in a convenient file format. This allows you to find even small changes that would be invisible to the human eye.
To compare Word s and verify how our .NET library works, simply load the files you want to diff and select the export file format. After comparing two files, the document containing the difference of this comparison will be automatically loaded.
An important point: the compared documents should not have any revisions before calling the comparison method. And it is necessary to accept all revisions, which we have already taken care of in our example:
using Aspose.Words;
var docA = new Document("Input1.docx");
var docB = new Document("Input2.docx");
// There should be no revisions before comparison.
docA.AcceptAllRevisions();
docB.AcceptAllRevisions();
docA.Compare(docB, "Author Name", DateTime.Now);
docA.Save("Output.docx");
There are three alternative options to install "Aspose.Words for .NET" onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:
Our product is fully cross-platform and supports all major .NET implementations following '.NET Standard 2.0' specification:
As far as .NET code doesn't depend on the underlying hardware or operating system, but only on a Virtual Machine, you are free to develop any kind of software for Windows, macOS, Android, iOS and Linux. Just make sure you have installed the corresponding version of .NET Framework, .NET Core, Windows Azure, Mono or Xamarin.
We recommend using Microsoft Visual Studio, Xamarin, and MonoDevelop integrated development environments to create C#, F#, VB.NET applications.
Fore more details please refer to Product Documentation.
You can perform compare operation for other file formats: