CompareOptions Class
Allows to choose advanced options for document comparison operation.
Inheritance Hierarchy
SystemObject
  Aspose.WordsCompareOptions

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class CompareOptions

The CompareOptions type exposes the following members.

Constructors
  NameDescription
Public methodCompareOptions
Initializes a new instance of the CompareOptions class
Properties
  NameDescription
Public propertyCode exampleIgnoreCaseChanges
True indicates that documents comparison is case insensitive. By default comparison is case sensitive.
Public propertyCode exampleIgnoreComments
Specifies whether to compare differences in comments. By default comments are not ignored.
Public propertyCode exampleIgnoreFields
Specifies whether to compare differences in fields. By default fields are not ignored.
Public propertyCode exampleIgnoreFootnotes
Specifies whether to compare differences in footnotes and endnotes. By default footnotes are not ignored.
Public propertyCode exampleIgnoreFormatting
True indicates that formatting is ignored. By default document formatting is not ignored.
Public propertyCode exampleIgnoreHeadersAndFooters
True indicates that headers and footers content is ignored. By default headers and footers are not ignored.
Public propertyCode exampleIgnoreTables
Specifies whether to compare the differences in data contained in tables. By default tables are not ignored.
Public propertyCode exampleIgnoreTextboxes
Specifies whether to compare differences in the data contained within text boxes. By default textboxes are not ignored.
Public propertyCode exampleTarget
Specifies which document shall be used as a target during comparison.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to specify which document shall be used as a target during comparison
Document doc1 = new Document(MyDir + "Document.CompareOptions.1.docx");
Document doc2 = new Document(MyDir + "Document.CompareOptions.2.docx");

// ComparisonTargetType with IgnoreFormatting setting determines which document has to be used as formatting source for ranges of equal text.
CompareOptions compareOptions = new CompareOptions
{
    IgnoreFormatting = true,
    IgnoreCaseChanges = false,
    IgnoreComments = false,
    IgnoreTables = false,
    IgnoreFields = false,
    IgnoreFootnotes = false,
    IgnoreTextboxes = false,
    IgnoreHeadersAndFooters = false,
    Target = ComparisonTargetType.New
};
doc1.Compare(doc2, "vderyushev", DateTime.Now, compareOptions);

doc1.Save(ArtifactsDir + "Document.CompareOptions.docx");
See Also