Compare Word Documents in ASP.NET

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 DOCX using C# within ASP.NET web application. This application will have the following features.

  • C# .NET API to Compare Word DOCX Documents
  • Compare two Word (DOC/DOCX) documents in C#
  • Download the comparison result in DOCX format
  • Download the comparison result in PDF format

C# .NET API to Compare Word DOCX

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.
Create ASP.NET Core Web Application
  • Choose the Web Application (Model-View-Controller) template.
Select MVC Application
  • Install the Aspose.Words for .NET package using NuGet Package Manager.
.NET API for Word Comparison
  • 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.

C# ASP.NET Word DOCX Comparison App - Demo

The following is the demonstration of how to compare two Word documents using our C# ASP.NET document comparison application.

Compare Word DOCX in ASP.NET

Comparing Word DOCX in ASP.NET

Download C# ASP.NET DOCX Comparison Application

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.

Related Article