Get list of changes
Leave feedback
On this page
GroupDocs.Comparison for Python via .NET lets you query the list of detected changes after a comparison.
Run a comparison and iterate over the resulting ChangeInfo
objects.
import groupdocs.comparison as gc
with gc.Comparer("source.docx") as comparer:
comparer.add("target.docx")
comparer.compare()
changes = comparer.get_changes()
for change in changes:
print(f"Type: {change.type}, Page: {change.page_info.page_number}, Id: {change.id}, Text: {change.text}")
🔹 Use case: Build a custom report UI that lists all differences with pagination info.
The result is as follows:
Compare from streams and retrieve the changes programmatically.
import groupdocs.comparison as gc
with open("source.docx", "rb") as src, open("target.docx", "rb") as tgt:
with gc.Comparer(src) as comparer:
comparer.add(tgt)
comparer.compare()
changes = comparer.get_changes()
for change in changes:
print(f"Type: {change.type}, Page: {change.page_info.page_number}, Id: {change.id}, Text: {change.text}")
🔹 Use case: Integrate diff extraction into services that operate on file streams.
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.