Last active
November 12, 2021 09:48
-
-
Save aspose-com-gists/b5768be90cce3202f83d485bc2d0db75 to your computer and use it in GitHub Desktop.
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
Learn how to combine multiple Word documents using Python: https://blog.aspose.com/2021/11/12/combine-word-documents-using-python/ |
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
import aspose.words as aw | |
# Load source and destination documents | |
dstDoc = aw.Document("document1.docx") | |
srcDoc = aw.Document("document2.docx") | |
# Append the source document to the destination document. | |
# Pass format mode to retain the original formatting of the source document when importing it. | |
dstDoc.append_document(srcDoc, aw.ImportFormatMode.KEEP_SOURCE_FORMATTING) | |
# Combine Word documents | |
dstDoc.save("combined.docx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment