Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active November 12, 2021 09:48
Show Gist options
  • Save aspose-com-gists/b5768be90cce3202f83d485bc2d0db75 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/b5768be90cce3202f83d485bc2d0db75 to your computer and use it in GitHub Desktop.
Learn how to combine multiple Word documents using Python: https://blog.aspose.com/2021/11/12/combine-word-documents-using-python/
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