Merge Documents

Wordize Merge for .NET combines your documents into one, saving time and reducing manual work. Merge documents, preserving styles and choosing a convenient output document format.
Supported Modules and Document Formats

Wordize supports merging of documents in any format:

  • to merge documents, use the Wordize Merge for .NET module
  • to work with documents in the required formats, select the appropriate document conversion module

Wordize provides the Wordize Merge for .NET module to combine multiple documents into one, saving time and reducing manual work. Programmatically merging documents ensures consistent formatting, supports various output formats (e.g. DOCX, PDF), and enhances document management. It is especially useful for creating reports, consolidating legal documents, and handling large-scale data efficiently.

How to Merge Documents

Merging documents appends the second document to the end of the first. Use one of the following Merge methods to programmatically merge two documents:

string inputDoc1 = "Document1.docx";
string inputDoc2 = "Document2.docx";

Merger.Merge("MergeDocument.1.docx", new[] { inputDoc1, inputDoc2 });
Important to note:
If all input document is PDF and the output document has a fixed page format (where the geometry of objects and their position on the page are fixed, such as PDF or image formats), for better performance and fidelity, merging is performed without reading PDF documents into the internal flow Document Object Model.

How to Specify Output Document Formatting

You can also specify how formatting is merged when combining multiple documents using the MergeFormatMode enumeration:

  • MergeFormatting — to combine document formatting.
  • KeepSourceFormatting — to retain source documents’ formatting
  • KeepSourceLayout — to preserve source documents’ layout

The following code example shows how to merge two documents into one, preserving the source documents’ layout and using the Merge method:

string inputDoc1 = "Document1.docx";
string inputDoc2 = "Document2.docx";

Merger.Merge("MergeDocument.2.pdf", new[] { inputDoc1, inputDoc2 }, SaveFormat.Pdf, MergeFormatMode.KeepSourceLayout);

How to Merge To an Image

You can merge two documents and save the result as an image. In this case, each element of the returned array represents one page of output, rendered as an image.

The following code example shows how to merge two documents and save the result as a PNG using the MergeToImages method:

Stream[] pages = Merger.MergeToImages(new string[] { "Document1.pdf", "Document2.docx" }, new ImageSaveOptions(SaveFormat.Png), MergeFormatMode.KeepSourceFormatting);

See Also