Merge Documents
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 });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
FAQ
Q: Do I need a license to use Wordize Merge for .NET?
A: Yes. A valid Wordize license is required to use the Merge module in production. You can evaluate the functionality with a trial license, and the standard license includes the merging capabilities.Q: Can Wordize merge PDF files without converting them to the internal DOM?
A: Absolutely. When all input files are PDFs and the output format is a fixed‑page type (PDF, image, etc.), Wordize merges the PDFs directly, which improves performance and preserves fidelity.Q: How can I keep the original layout of each source document during a merge?
A: Use theMergeFormatMode.KeepSourceLayoutenumeration in theMerger.MergeorMerger.MergeToImagesoverloads. This mode retains the exact page layout of each source document.Q: Is it possible to merge documents and obtain the result as images?
A: Yes. CallMerger.MergeToImageswith anImageSaveOptionsinstance. The method returns an array ofStreamobjects, each containing an image of a page (e.g., PNG, JPEG, TIFF).Q: Which output formats are supported when merging documents?
A: Wordize can produce any format it supports, such as DOCX, PDF, PNG, JPEG, TIFF, and more. Specify the desiredSaveFormatvalue in the overload that accepts it to get the merged document in that format.