DocumentCompare Method (Document, String, DateTime, CompareOptions)
Compares this document with another document producing changes as a number of edit and format revisions Revision. Allows to specify comparison options using CompareOptions.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public void Compare(
	Document document,
	string author,
	DateTime dateTime,
	CompareOptions options
)

Parameters

document
Type: Aspose.WordsDocument
author
Type: SystemString
dateTime
Type: SystemDateTime
options
Type: Aspose.WordsCompareOptions
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