Hi
I have a word document with track changes on. Is there an api to accept all the revisions and create a clean document will all changes accepted?
Please use PutChangesDocument for accepting/rejecting changes. Kindly check documentation article to accept or reject document changes for more details. Hopefully it will help you to accomplish the task.
Thanks for responding.
The links you refer to, seem to be comparing two documents and then accept/reject the compared changes. In my case there is just one document with track changes on and on which multiple changes have happened by the same author, so I’m not actually doing any comparison. If I open the document in Microsoft Word, I would normally use the
Review -> Accept -> Accept All Changes
option to achieve this end.
If this can be done through the links you have given, kindly provide some more guidance. I tried putting source and target as the same file but it did not detect any changes, so, did not work.
Thanks for your feedback. We have logged a ticket COMPARISONCLOUD-153 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress within this forum thread.
Hi, just wanted to check if there was any update on this request.
Hi, checking to see if there is any update or an ETA.
The requested feature was also missing in the native on-premise API of GroupDocs.Comparison Cloud API. We have implemented the feature in GroupDocs.Comparison for .NET and now will port it to the Cloud version. We will notify you as soon as some further update is available. Thanks for your patience and cooperation.
We have good news for you, your above requested feature to accept or reject all revisions in a Word document is implemented in the latest release of GroupDocs.Comparison Cloud 20.12. Please find sample code for reference and check the documentation for more details.
How to Accept or Reject Tracked Changes of Word Document in cURL
curl -X PUT "https://api.groupdocs.cloud/v2.0/comparison/revisions"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-H "x-aspose-client: Containerize.Swagger"
-d "{ "SourceFile": { "FilePath": "Temp/Revisions.docx" }, "Revisions": [ { "Id": 0, "Action": "Accept" },{ "Id": 1, "Action": "Accept" },{ "Id": 2, "Action": "Accept" },{ "Id": 3, "Action": "Accept" },{ "Id": 4, "Action": "Accept" },{ "Id": 5, "Action": "Accept" } ], "OutputPath": "Temp/Revisions_Accept.docx"}"
How to Accept or Reject Tracked Changes of Word Document in Python
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples
import groupdocs_comparison_cloud
client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
# Create an Instance of GroupDocs.Conversion REST API
api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret)
source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_with_revs.docx"
options = groupdocs_comparison_cloud.ApplyRevisionsOptions()
options.source_file = source
options.output_path = "output/result.docx"
# Accept or Reject all Revisions of Word document
revisions = api_instance.get_revisions(groupdocs_comparison_cloud.GetRevisionsRequest(source))
for revision in revisions:
revision.action = "Accept"
options.revisions = revisions
response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options))
print("Output file link: " + response.href)
That is fantastic. Thanks.
Will test and confirm.
Tested this. Works great.
Although, it would have been slightly more convenient if we didn’t have to fetch the revisions first, some option to accept all revisions that exist in the doc. But nevertheless, this does the job. So thanks for making this api available.
It is good to know that the new ApplyRevisions API method helps you to accomplish your requirements.
Thanks for your suggestions. We have logged an enhancement ticket COMPARISONCLOUD-171 for further investigation and will try to improve the ApplyRevisions API.
Please note above enhancement ticket COMPARISONCLOUD-171 is resolved. In the 21.3 release, we have introduced two new properties AcceptAll and RejectAll for the requirement in ApplyRevisions API method. Please check the following documentation articles for details. We are also updating the SDKs for this change.
Accept all Revisions
Reject all Revisions
Accept All Tracked Changes of Word Document in Python
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples
import groupdocs_comparison_cloud
client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
# Create an instance of GroupDocs.Conversion REST API
api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret)
# Accept all Revisions
source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_with_revs.docx"
options = groupdocs_comparison_cloud.ApplyRevisionsOptions()
options.source_file = source
options.accept_all = True
options.output_path = "output/result.docx"
response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options))
print("Output file link: " + response.href)
Reject All Tracked Changes of Word Document in Python
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples
import groupdocs_comparison_cloud
client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
# Create an instance of GroupDocs.Conversion REST API
api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret)
# Reject all Revisions
source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_with_revs.docx"
options = groupdocs_comparison_cloud.ApplyRevisionsOptions()
options.source_file = source
options.reject_all = True
options.output_path = "output/result.docx"
response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options))
print("Output file link: " + response.href)