Compare Bookmarks in Word Documents

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 supports bookmark comparison in Word documents — enable compare_bookmarks on CompareOptions to detect differences in bookmarked ranges.

Example: Enable bookmark comparison

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

def compare_bookmarks_in_word():
    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")
        options = CompareOptions()
        options.compare_bookmarks = True
        comparer.compare("./result.docx", options)

if __name__ == "__main__":
    compare_bookmarks_in_word()

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, 27 KB)

Download full output

Use case: validate that critical bookmarked sections (e.g., contract clauses) remain unchanged.

The result is as follows:

Notes

  • Word-only. Bookmark comparison applies only to Microsoft Word documents (.doc, .docx, .dot, .dotx). For other formats the option is silently ignored.
  • Interaction with word_track_changes. Bookmark comparison runs alongside revision processing — if a bookmarked range contains tracked changes, both are surfaced in the result.
  • Bookmark content vs. bookmark definitions. compare_bookmarks = True detects content changes inside bookmarked ranges. Pure bookmark-name renames without content change are not surfaced as content diffs.