C#: Online Guide
How To: Word SDK
File: Merge Word Files
File: Merge Word Files
  |  
Home ›› XDoc.Word ›› C# Word: Merge Word Files

C# Word - Merge Word Documents in C#.NET


Provide C# Demo Codes for Merging and Appending Word Document




Overview



RasterEdge C#.NET Word document merging toolkit (XDoc.Word) is designed to help .NET developers combine Word document files created by different users to one Word file. mvc print pdf, c# split pdf into images, c# convert pdf to jpg, vb.net read pdf file text, convert word document to pdf using itextsharp c#, asp.net pdf writer. Thus, C#.NET Word document merge library control can be counted as an efficient .NET doc solution for keeping Word document files organized.


Related .net document control helps:
asp.net edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net mvc excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
c# asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net edit pdf image using c#: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
c# asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net sharepoint document viewer open source: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint


This C# .NET Word document merging control is written in managed C# code and compatible with all .NET developing platforms, like ASP.NET web application and Windows Forms project. c# remove text from pdf, pdf to text vb.net, vb.net pdf open password protected, convert pptx to pdf c#, create pdf report in asp.net c#, how to convert pdf to text file in vb.net, vb.net ocr pdf free. Using this Word document concatenating library SDK, C# developers can easily merge and append one Word document to another Word document file, and choose to create a new Word file in .NET class application.


Besides C#.NET Word document merging function, XDoc.Word, a professional third-party .NET document imaging toolkit, also offers other advanced Word document page processing and manipulating functions, such as Word page insertion, Word page deleting, Word document splitting, Word page reordering and Word page image and text extraction. asp.net mvc generate pdf from view, edit pdf in asp.net mvc, pdf preview in asp.net c#, asp.net pdf viewer c#, asp net add text to pdf, asp.net tiff viewer, asp.net remove image from pdf file. Remarkably, all those C#.NET Word document page processing functions can be implemented independently, without using any Adobe-related software.


Our .NET Word SDK empowers C# programmers to easily merge and append Word files with mature APIs. To be more specific, two or more input Word documents can be merged and appended together according to its loading sequence, and then saved and output as a single Word with user-defined location.




C# DLLs: Merge Word File



Add references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Word;




Combine and Merge Multiple Word Files into One Using C#



This part illustrates how to combine three Word files into a new file in C# application. You may also combine more Word documents together.




String inputFilePath1 = Program.RootPath + "\\" + "1.docx";
String inputFilePath2 = Program.RootPath + "\\" + "2.docx";
String inputFilePath3 = Program.RootPath + "\\" + "3.docx";
String outputFilePath = Program.RootPath + "\\" + "Output.docx";
String[] inputFilePaths = new String[3] { inputFilePath1, inputFilePath2, inputFilePath3 };

// Combine three Word files and output.
DOCXDocument.CombineDocument(inputFilePaths, outputFilePath);





Append Word Document in C#



In addition, C# users can append a Word file to the end of a current Word document and combine to a single Word file.




//  get DOCXDocument object from one file
String inputFilePath1 = Program.RootPath + "\\" + "1.docx";
DOCXDocument doc1 = new DOCXDocument(inputFilePath1);
//  get DOCXDocument object from another file
String inputFilePath2 = Program.RootPath + "\\" + "2.docx";
DOCXDocument doc2 = new DOCXDocument(inputFilePath2);

//  append the 2nd document
doc1.AppendDocument(doc2);

//  save the document
String outputFilePath = Program.RootPath + "\\" + "Output.docx";
doc1.Save(outputFilePath);