Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/a43fed90e331da4e6a6cebf2a4bfeaf5 to your computer and use it in GitHub Desktop.
Save aspose-cloud/a43fed90e331da4e6a6cebf2a4bfeaf5 to your computer and use it in GitHub Desktop.
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