Merge documents to DOC

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Merger MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-merger -- dnx GroupDocs.Merger.Mcp --yes
Folders, licensing and more →

Introduction

Consider the functionality for merging files of various formats such as DOC, PDF, XPS, EPUB and TEX into a DOC document. Let’s see, why do we need to combine these files into a DOC document? This article discusses the DOC format, but those ones will be more in the near future. But turn back to the DOC format. It is a standard format that allows you to display information the same on any device with any platform. It is comfortable for transferring info via the Internet or to a printer. That is why this format is chosen for the current task of combining files of various formats.

Merge documents to DOC / DOCX

Multiple files (even different types of PDF files such as PDF, XPS, EPUB and TEX) can be combined into a single DOC / DOCX file by using GroupDocs.Merger API. You can also use this Join method to combine multiple DOC / DOCX files. This cross-format merge to DOC / DOCX could be useful for the cases when there is no ability to merge only DOC files. For now, GroupDocs.Merger API allows to Join other file types without password with the DOC / DOCX document loaded into Merger object.

The following example demonstrates how to merge DOC file with PDF, XPS, EPUB and TEX file types:

using (Merger merger = new Merger(@"c:\document1.doc"))
{
    merger.Join(@"c:\document2.pdf");
    merger.Join(@"c:\document3.xps");
    merger.Join(@"c:\document4.epub");
    merger.Join(@"c:\document5.tex");
    merger.Save(@"c:\merged.doc");
}

Also, please read the following article: How to correctly merge streams to DOCX