GroupDocs.Comparison for Python via .NET Overview

What is GroupDocs.Comparison?

GroupDocs.Comparison for Python via .NET is a native Python library that compares 50+ document formats — DOCX, PDF, XLSX, PPTX, OpenDocument, AutoCAD, Visio, images, HTML, and source code — and reports the differences at paragraph, word, and character level, including style and formatting changes. It runs entirely on-premise, requires no Microsoft Office installation, and ships as a pre-built wheel on Windows, Linux, and macOS.

Typical uses include:

  • Contract and policy review — surface inserted, deleted, and modified clauses between two DOCX or PDF revisions and route only the changed regions to reviewers (or to an LLM) instead of re-reading both documents.
  • Editorial accept/reject workflows — classify each detected change, then re-emit the document honouring the decisions via apply_changes.
  • AI-edit audit — compare the document an agent produced against the original to verify and explain every change it made. See Agents and LLM Integration for the full pipeline.
  • Version-control review — diff two exports of a non-text-friendly format (PPTX, XLSX, Visio, DWG) without flattening the binary.
  • Multi-source consolidation — diff one source against many targets in a single pass to spot which downstream copy drifted from the canonical version.

Key Capabilities

CapabilityDescription
50+ comparison formatsDOCX, PDF, XLSX, PPTX, ODT, HTML, images, AutoCAD, Visio, source code, and more. See supported formats.
Granular change detectionParagraph, word, and character-level diffs — including style, formatting, and structural changes.
Inspect detected changesIterate ChangeInfo objects — type (INSERTED / DELETED / STYLE_CHANGED), text, author, and style deltas — without writing an output file.
Accept / reject workflowsPer-change ACCEPT / REJECT decisions re-emitted via apply_changes.
Multi-source comparisonDiff one source against multiple targets in a single Comparer.
Folder comparisonCompare entire directories with the folder-compare mode.
Change coordinatesGet the Rectangle (x / y / width / height) of every detected change for overlay rendering.
Custom change stylingStyle inserted / deleted / changed regions with Color, RGB tuples, hex strings, or named colours.
Summary pagesAppend a summary with change statistics, or emit a summary-only result.
Password-protected documentsOpen and re-save protected DOCX / PDF / XLSX via LoadOptions.password and SaveOptions.password.
StreamsLoad input from file-like objects (open(..., "rb") or io.BytesIO) — handy for cloud blobs and HTTP bodies.
Document inspectionRead format, page count, and size without running a comparison.
Logging and diagnosticsWire ConsoleLogger through ComparerSettings for production traces.
On-premiseNo cloud calls, no Microsoft Office install, no network traffic.

Quick Example

from groupdocs.comparison import Comparer

def compare_documents():
    """Compare two DOCX revisions and write a tracked-changes result."""
    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")
        comparer.compare("./result.docx")

if __name__ == "__main__":
    compare_documents()
from groupdocs.comparison import Comparer
from groupdocs.comparison.options import CompareOptions, LoadOptions

def compare_with_options():
    """Compare two password-protected DOCX files with style detection
    and a summary page appended to the result."""
    load = LoadOptions()
    load.password = "1234"

    with Comparer("./protected_source.docx", load_options=load) as comparer:
        comparer.add("./protected_target.docx", load_options=load)
        options = CompareOptions()
        options.detect_style_changes = True
        options.generate_summary_page = True
        options.sensitivity_of_comparison = 75
        comparer.compare("./result.docx", options)

if __name__ == "__main__":
    compare_with_options()

result.docx is the comparison output produced by the compare_documents.py snippet. Download the sample result.

Where to next

  1. Install the packageInstallation walks through PyPI installation for Windows, Linux, and macOS.
  2. Run your first comparisonQuick Start Guide compares two DOCX files in five minutes.
  3. Explore the examplesRunning Examples clones the runnable repository and runs every documented scenario locally.
  4. Use it in depth — the Developer Guide covers loading, comparing, accepting/rejecting changes, multi-source, folder compare, summary pages, and logging.
  5. Plug it into AI pipelinesAgents and LLM Integration explains the MCP server, AGENTS.md, and how to use Comparison as the change-detection step in agent workflows.
Close
Loading

Analyzing your prompt, please hold on...

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