Get Comparison Result as a Document Object

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.

Example: Obtain the result Document object

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)

Download full output

The result will list source and target text segments for each detected change.

Close
Loading

Analyzing your prompt, please hold on...

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