We often need to compare two MS Word DOC/DOCX documents to check the similarities or differences. The comparison gives us an idea of what has been changed in the two versions of a single Word document. Various online document comparison applications are available that let you compare two Word documents. However, there could be the case when you need to integrate document comparison features within your web application. On the other hand, you may want to build your own online document comparison app. To deal with such cases, I’ll show you how to compare two Word documents using C# within ASP.NET web application. This application will have the following features.
- Compare two Word (DOC/DOCX) documents
- Download the comparison result in DOCX format
- Download the comparison result in PDF format
.NET API to Compare Word Documents
To perform the comparison of the Word documents without MS Office, we’ll use Aspose.Words for .NET which is a powerful word processing API for ASP.NET or other .NET/.NET Core applications. You can download API or install it within your ASP.NET application using NuGet.
PM> Install-Package Aspose.Words
Compare Two Word Documents in C# ASP.NET
- Create a new ASP.NET Core Web Application in Visual Studio 2017 or later.
- Choose the Web Application (Model-View-Controller) template.
- Install the Aspose.Words for .NET package using NuGet Package Manager.
- Copy and paste the following script in index.cshtml view.
- Copy and paste the following method in HomeController.cs controller.
- Insert the following CSS and JS files of drag and drop plugin in the head tag of _layout.cshtml view.
- Build the application and run in the browser.
ASP.NET Word Document Comparison App – Demo
The following is the demonstration of how to compare two Word documents using our ASP.NET document comparison application.
Download
You may download the complete source code of ASP.NET Word document comparison application from here.
About Aspose.Words for .NET
Try Aspose.Words for .NET for Free
Aspose offers a temporary license to try Aspose APIs for free. Get yours to evaluate Aspose.Words for .NET.