Customize changes styles

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 compare options collection to set up the appropriate comparison speed and quality.

To compare two documents with custom change style settings, follow these steps:

  1. Instantiate the Comparer object. Specify the source document path or stream.
  2. Call the Add method. Specify the target document path or stream.
  3. Instantiate the CompareOptions object. Specify the appropriate parameters.
  4. Call the Comparer method. Specify the CompareOptions object.

The following code snippets show how to compare documents with specific options:

Compare documents from local disk with custom change styles

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

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target.docx");
    CompareOptions compareOptions = new CompareOptions()
    {
        InsertedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Red,
            FontColor = System.Drawing.Color.Green,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        },
        DeletedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Azure,
            FontColor = System.Drawing.Color.Brown,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        },
        ChangedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Crimson,
            FontColor = System.Drawing.Color.Firebrick,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        }
    };
    comparer.Compare("result.docx", compareOptions);
}

The result is as follows:

Compare documents from stream with custom change styles

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
using System.IO;
// ...

using (Comparer comparer = new Comparer(File.OpenRead("source.docx")))
{
    comparer.Add(File.OpenRead("target.docx"));
    CompareOptions compareOptions = new CompareOptions()
    {
        InsertedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Red,
            FontColor = System.Drawing.Color.Green,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        },
        DeletedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Azure,
            FontColor = System.Drawing.Color.Brown,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        },
        ChangedItemStyle = new StyleSettings()
        {
            HighlightColor = System.Drawing.Color.Crimson,
            FontColor = System.Drawing.Color.Firebrick,
            IsUnderline = true,
            IsBold = true,
            IsStrikethrough = true,
            IsItalic = true
        }
    };
    comparer.Compare(File.Create("result.docx"), compareOptions);
}