DocumentBase.Compare Method

Displays revision marks that indicate where the document differs from another document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub Compare ( _
    name As String, _
    ByRef authorName As Object, _
    ByRef compareTarget As Object, _
    ByRef detectFormatChanges As Object, _
    ByRef ignoreAllComparisonWarnings As Object, _
    ByRef addToRecentFiles As Object, _
    ByRef removePersonalInformation As Object, _
    ByRef removeDateAndTime As Object _
)
public void Compare(
    string name,
    ref Object authorName,
    ref Object compareTarget,
    ref Object detectFormatChanges,
    ref Object ignoreAllComparisonWarnings,
    ref Object addToRecentFiles,
    ref Object removePersonalInformation,
    ref Object removeDateAndTime
)

Parameters

  • name
    Type: System.String
    The name of the document with which the document is compared.
  • authorName
    Type: System.Object%
    The reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string "Comparison" if no author information is present.
  • detectFormatChanges
    Type: System.Object%
    true (default) for the comparison to include detection of format changes.
  • ignoreAllComparisonWarnings
    Type: System.Object%
    true compares the documents without notifying a user of problems. The default value is false.
  • addToRecentFiles
    Type: System.Object%
    true adds the document to the list of recently used files on the File menu.
  • removePersonalInformation
    Type: System.Object%
    true if personal information should be removed from the specified document. The default value is false.
  • removeDateAndTime
    Type: System.Object%
    true removes date and time stamp information from tracked changes; false does not remove date and time stamp information from tracked changes.

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the Compare method to compare the current document with the specified document and display revision marks to indicate where the documents differ. This example assumes that the file Sales1.doc exists on the current computer at the location C:\Docs. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentCompare()

    Me.Compare("C:\Docs\Sales1.doc", _
        CompareTarget:=Word.WdCompareTarget.wdCompareTargetNew, _
        AddToRecentFiles:=False)
End Sub
private void DocumentCompare()
{
    object compareTarget = Word.WdCompareTarget.wdCompareTargetNew;
    object addToRecentFiles = false;

    this.Compare("C:\\Docs\\Sales1.doc", ref missing, ref compareTarget, 
        ref missing, ref missing, ref addToRecentFiles, ref missing, 
        ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace