XDoc.Word is a FREE C# Office Word library to read, convert, edit, create MS-Word documents in .NET projects. XDoc.Word from RasterEdge is an advanced Microsoft Word 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 Standard 2.0 * .NET 8, .NET 7, .NET 6, .NET 5, .NET Core 3.x & 2.x * .NET Framework 4.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.WordOnce 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);