Show Gap Lines Instead of Changes

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Comparison MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-comparison -- dnx GroupDocs.Comparison.Mcp --yes
Folders, licensing and more →

GroupDocs.Comparison for Python via .NET can produce redacted-style results in which inserted and deleted content is hidden and replaced with empty gap lines. The layout alignment is preserved so readers can see where changes occurred without seeing the changed text.

Example: Replace changes with gap lines

from groupdocs.comparison import Comparer
from groupdocs.comparison.options import CompareOptions

def show_gap_lines():
    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")
        options = CompareOptions()
        options.show_inserted_content = False
        options.show_deleted_content = False
        options.leave_gaps = True
        comparer.compare("./result.docx", options)

if __name__ == "__main__":
    show_gap_lines()

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

Use case: provide redacted-style diffs that keep layout alignment without showing actual changed text.

The result is as follows:

Default resultResult without LeaveGaps
Default resultResult with LeaveGaps

When to use gap lines

Gap-line output is useful in two scenarios:

  • Redacted-style diffs for regulatory review. Reviewers can see where changes occurred and how many without seeing the actual content — useful when the comparison artifact will be circulated more widely than the underlying documents.
  • Visual change density reporting. A gap-line result document gives a quick visual sense of how much was changed and where, without the cognitive load of reading every diff.

For full-content review use the default settings (show_inserted_content = True, show_deleted_content = True, leave_gaps = False).