If you are working with a bunch of Word documents, you may come across a scenario where you need to merge multiple documents into a single one programmatically. To achieve that, this article provides you with a complete guide on how to merge MS Word documents in an ASP.NET application using C#.
Merging multiple MS Word documents could be useful in keeping documents of the same type into a single file, combining multiple documents before sharing, and so on. To make you achieve this, we’ll show you how to create an ASP.NET application to merge MS Word (DOC/DOCX) documents. This Word Document Merger application will have the following features:
- Merge MS Word Documents into a Single Document
- Download Merged Word Documents in DOCX Format
- Download Merged Word Documents in PDF Format
C# Library to Merge MS Word Documents in ASP.NET
Aspose.Words for .NET is a feature-rich word processing library 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.
ASP.NET Word Document Merging Application - Source Code
Download the source code of ASP.NET Word Document Merger application from here.
C# Word Processing Library - Get a Free License
Get your free temporary license and use Aspose.Words for .NET for free.