Related blog post:
Last active
June 8, 2023 08:21
-
-
Save GroupDocsGists/f4d5b2e63fa8f34da102b8c84ce341f4 to your computer and use it in GitHub Desktop.
Merge Word Documents with Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Merge Selective Pages of Word Documents using Java | |
Merger merger = new Merger("source_document.docx")) | |
{ | |
// Set the merging options | |
JoinOptions joinOptions = new JoinOptions(2,3); // Specify the starting and ending page number | |
// Merge the documents | |
merger.join("document_to_merge.docx", joinOptions); // using joining settings | |
merger.join("another_document_to_merge.docx", new JoinOptions(new int[] { 2, 4, 6 })); // Specifying page number(s) | |
merger.save("output_document.docx"); // Saving merged document | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Merge Two Word Documents using Java | |
Merger merger = new Merger("source_document.docx"); // Load the source document | |
merger.join("document_to_merge.docx"); // Merge the document | |
merger.join("another_document_to_merge.docx"); // Merge additional documents | |
merger.save("output_document.docx"); // Save the merged document as output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment