CompareOptions Class

Wordize.Comparing.CompareOptions class. Allows to choose additional options for document comparison operation.

CompareOptions class

Allows to choose additional options for document comparison operation.

public class CompareOptions

Constructors

NameDescription
CompareOptions()The default constructor.

Properties

NameDescription
CompareMoves { get; set; }Specifies whether to compare differences move revision between the two documents.
Granularity { get; set; }Specifies whether changes are tracked by character or by word.
IgnoreCaseChanges { get; set; }True indicates that documents comparison is case insensitive.
IgnoreComments { get; set; }Specifies whether to compare differences in comments.
IgnoreFields { get; set; }Specifies whether to compare differences in fields.
IgnoreFootnotes { get; set; }Specifies whether to compare differences in footnotes and endnotes.
IgnoreFormatting { get; set; }True indicates that formatting is ignored.
IgnoreHeadersAndFooters { get; set; }True indicates that headers and footers content is ignored.
IgnoreTables { get; set; }Specifies whether to compare the differences in data contained in tables.
IgnoreTextboxes { get; set; }Specifies whether to compare differences in the data contained within text boxes.

Examples

Demonstrates how to compare two documents using the Fluent API with customized CompareOptions.

ComparerContext context = new ComparerContext();
context.Author = "Wordize";
context.DateTime = DateTime.Now;
context.CompareOptions.IgnoreFormatting = true;

Comparer.Create(context)
    .From(MyDir + "CompareV1.docx")
    .From(MyDir + "CompareV2.docx")
    .To(ArtifactsDir + "CompareFluentAPI.docx")
    .Execute();

Demonstrates how to compare two documents from streams using customized CompareOptions.

CompareOptions options = new CompareOptions();
options.IgnoreFormatting = true;
options.IgnoreHeadersAndFooters = true;

using (Stream v1 = File.OpenRead(MyDir + "CompareV1.docx"))
using (Stream v2 = File.OpenRead(MyDir + "CompareV2.docx"))
using (Stream output = File.Create(ArtifactsDir + "CompareStreams.docx"))
{
    Comparer.Compare(v1, v2, output, SaveFormat.Docx, "Wordize", DateTime.Now, options);
}

See Also