Merging multiple MS Word documents could be useful in various scenarios. For example, it can be used in keeping a similar type of documents into a single file, combining multiple documents before sharing, and so on. Various online tools are available that allow you to merge MS Word documents quite easily, however, what if you want to add this feature within your own application? To make you achieve this, I’ll show you how to merge MS Word (DOC/DOCX) documents using C# within your ASP.NET web applications. This Word Document Merger application will have the following features:
- Merge MS Word Documents into a Single Document
- Download Merged Word Documents as DOCX Format
- Download Merged Word Documents as PDF Format
.NET API to Merge MS Word Documents in ASP.NET
Aspose.Words for .NET is a feature-rich word processing API that lets you process MS Word documents with ease. It also allows you to merge multiple Word documents into a single document within ASP.NET or any .NET/.NET Core application. Aspose.Words for .NET can be installed using NuGet as well as downloaded as a DLL file.
PM> install-package Aspose.Words
Merge MS Word Documents in ASP.NET
The following are the steps to create an ASP.NET application that will let you merge two or more Word (DOC/DOCX) documents without using MS Office/Word.
- Create an ASP.NET Core Web Application in Visual Studio.
- Choose the Web Application (Model-View-Controller) from the template list.
- Install the Aspose.Words for .NET from NuGet Package Manager or Package Manager Console.
- Insert the following script in your index.cshtml file.
- Insert the following code in your HomeController.cs class.
- Include the following JS and CSS files of drag and drop plugin within the head tag of _layout.cshtml file.
- Build the application and run it in your browser.
Download the source code of ASP.NET Word Document Merger application from here.
Try Aspose.Words for .NET for Free
Get your temporary license (a complete license for 30 days) to try Aspose.Words for .NET for free.