This gist contains code snippets related to merging of MS Word documents using Aspose.Words Cloud SDK for Python. For more information, please visit
Last active
June 13, 2021 00:13
This Gist contains code snippets related to MS Word files concatenation using Python SDK
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
# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud | |
word_api_client: ApiClient = asposewordscloud.api_client.ApiClient("a41d01ef-dfd5-4e02-ad29-bd85fe41e3e4","d87269aade6a46cdc295b711e26809af") | |
words_api = WordsApi(word_api_client) | |
fileName = "ComparisonResult.docx" | |
documentToAppend = "SampleMailMergeTemplate.docx" | |
destName = "MergedFile.docx" # # Changes will be made in the source document | |
# Upload original document to Cloud Storage | |
words_api.upload_file(asposewordscloud.models.requests.UploadFileRequest(open(fileName, 'rb'), "", None)) | |
# Upload the document to append to Cloud Storage | |
words_api.upload_file(asposewordscloud.models.requests.UploadFileRequest(open(documentToAppend, 'rb'), "", None)) | |
doc_entry = asposewordscloud.DocumentEntry(documentToAppend, 'KeepSourceFormatting') | |
body = asposewordscloud.DocumentEntryList([doc_entry]) | |
# Call API to merge Word documents | |
request = asposewordscloud.models.requests.AppendDocumentRequest(fileName, body, None, None, None, None, destName, None, None) | |
result = words_api.append_document(request) | |
print("Result {}".format(result)) |
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
This Gist contains code snippets related MS Word files (DOCX, DOC, DOT, RTF, DOCM) and OpenDocument (ODT, OTT) files using Python SDK. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment