Get Comparison Result as a Document Object
Leave feedback
On this page
GroupDocs.Comparison for Python via .NET returns a Document object from Comparer.compare() that exposes the result file name, detected changes, and the result stream. The object model is compatible with Aspose libraries, so you can pass it into downstream processing pipelines.
from groupdocs.comparison import Comparer
def get_result_document_object():
with Comparer("./source.docx") as comparer:
comparer.add("./target.docx")
result_document = comparer.compare("./result.docx")
for change in result_document.changes:
print(f"Source text: {change.source_text}")
print(f"Target text: {change.target_text}\n")
if __name__ == "__main__":
get_result_document_object()
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.
Binary file (DOCX, 25 KB)
The result will list source and target text segments for each detected change.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.