GroupDocs.Comparison for Python via .NET lets you programmatically accept or reject individual changes before producing the final result. This enables reviewer-style workflows: get the change list, decide per change, then apply the accepted ones.
Steps to accept or reject changes
Compare two documents using Comparer.compare().
Enumerate the changes via comparer.get_changes().
For each ChangeInfo, set comparison_action to ComparisonAction.ACCEPT or ComparisonAction.REJECT.
Call comparer.apply_changes() with ApplyChangeOptions(changes=...) to produce the merged result.
Example 1: Accept or reject changes (file paths)
fromgroupdocs.comparisonimportComparerfromgroupdocs.comparison.optionsimportApplyChangeOptionsfromgroupdocs.comparison.resultimportComparisonActiondefaccept_or_reject_changes():withComparer("./source.docx")ascomparer:comparer.add("./target.docx")comparer.compare()changes=comparer.get_changes()# Reject the first change; accept everything elseifchanges:changes[0].comparison_action=ComparisonAction.REJECTcomparer.apply_changes("./result.docx",ApplyChangeOptions(changes=changes))if__name__=="__main__":accept_or_reject_changes()
source.docx is the source file used in this example. Click here to download it.
target.docx is the target file used in this example. Click here to download it.
Accept or reject revisions — same accept/reject pattern, but applied to existing Word Track Changes revisions on a single document rather than to detected changes between two documents.