XDoc.Word is a FREE C# Office Word library to read, convert, edit, create MS-Word documents in .NET Framework projects. XDoc.Word from RasterEdge is an advanced Microsoft Word C# library : * It is FREE * Generate Word from PDF or scratch * Convert Word to PDF, SVG, HTML, multi-page TIFF, JPG, PNG and many raster image formats * Edit, process, merge Word document pages Compatible with * .NET Framework 4.x, 3.x, 2.x * Windows, MacOS, Linux, Docker, Azure Online Documents * C# How to Guide : https://www.rasteredge.com/how-to/csharp-imaging/word-reading/ * Email : support@rasteredge.com
$ dotnet add package XDoc.Word.FrameworkOnce installed the package, you can use the following C# code to combine multiple Word documents into one.
String inputFilePath1 = Program.RootPath + "\\" + "1.docx";
String inputFilePath2 = Program.RootPath + "\\" + "2.docx";
String outputFilePath = Program.RootPath + "\\" + "Output.docx";
String[] inputFilePaths = new String[2] { inputFilePath1, inputFilePath2 };
// Combine two Word files.
DOCXDocument.CombineDocument(inputFilePaths, outputFilePath);