Get list of changes

GroupDocs.Comparison for Python via .NET lets you query the list of detected changes after a comparison.

Get list of changes from local disk

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:

Get list of changes from stream

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.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.