Word document comparison options

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 provides the WordCompareOptions class for configuring comparison of Word documents (.doc, .docx, .rtf, and other word-processing formats). It inherits from CompareOptions and adds Word-specific properties — most notably the DisplayMode property, which controls how detected changes are written into the result document.

Display modes

The DisplayMode property accepts one of two values from the WordCompareOptions.ComparisonDisplayMode enumeration:

  • Revisions — changes are emitted as native Word revision (track-changes) markup. The result opens in Microsoft Word with the Review → Accept / Reject controls ready.
  • Highlight — inserted, deleted, and modified text is rendered with inline colour highlights directly in the document body. No track-changes metadata is added.

Revisions mode

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");

    WordCompareOptions options = new WordCompareOptions
    {
        DisplayMode = WordCompareOptions.ComparisonDisplayMode.Revisions
    };

    comparer.Compare("result.docx", options);
}

The result:

Revisions mode

Highlight mode

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");

    WordCompareOptions options = new WordCompareOptions
    {
        DisplayMode = WordCompareOptions.ComparisonDisplayMode.Highlight
    };

    comparer.Compare("result.docx", options);
}

The result:

Highlight mode

For a step-by-step walkthrough comparing both modes side by side, see the related tutorial: Word Comparison in .NET: Revision Track vs Highlight Modes.

Detect style changes

Set DetectStyleChanges to true to include formatting differences (bold, font size, colour, etc.) alongside textual edits.

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");

    WordCompareOptions options = new WordCompareOptions
    {
        DisplayMode = WordCompareOptions.ComparisonDisplayMode.Revisions,
        DetectStyleChanges = true
    };

    comparer.Compare("result.docx", options);
}

Compare headers and footers

Set HeaderFootersComparison to true to include header and footer content in the comparison.

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");

    WordCompareOptions options = new WordCompareOptions
    {
        HeaderFootersComparison = true
    };

    comparer.Compare("result.docx", options);
}

Mark line breaks

Set MarkLineBreaks to true to visually mark paragraph (line) breaks that differ between documents.

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");

    WordCompareOptions options = new WordCompareOptions
    {
        MarkLineBreaks = true
    };

    comparer.Compare("result.docx", options);
}

Other Word-specific properties

The properties below are also available on WordCompareOptions. Several of them are documented in dedicated articles — follow the links for details:

All CompareOptions base properties — InsertedItemStyle, DeletedItemStyle, ChangedItemStyle, SensitivityOfComparison, GenerateSummaryPage, and others — are also available on WordCompareOptions.

See also