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.9
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
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
Shows how to specify which document shall be used as a target during comparison
[C#]

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