Skip to content

Instantly share code, notes, and snippets.

This Gist contains code snippets related to MS Word files concatenation using Python SDK
# 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 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