_Application.CompareDocuments Method
Compares two documents and returns a _Document object that represents the document that contains the differences between the two documents, marked using tracked changes.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
Syntax
'Declaration
Function CompareDocuments ( _
OriginalDocument As Document, _
RevisedDocument As Document, _
Destination As WdCompareDestination, _
Granularity As WdGranularity, _
CompareFormatting As Boolean, _
CompareCaseChanges As Boolean, _
CompareWhitespace As Boolean, _
CompareTables As Boolean, _
CompareHeaders As Boolean, _
CompareFootnotes As Boolean, _
CompareTextboxes As Boolean, _
CompareFields As Boolean, _
CompareComments As Boolean, _
CompareMoves As Boolean, _
RevisedAuthor As String, _
IgnoreAllComparisonWarnings As Boolean _
) As Document
'Usage
Dim instance As _Application
Dim OriginalDocument As Document
Dim RevisedDocument As Document
Dim Destination As WdCompareDestination
Dim Granularity As WdGranularity
Dim CompareFormatting As Boolean
Dim CompareCaseChanges As Boolean
Dim CompareWhitespace As Boolean
Dim CompareTables As Boolean
Dim CompareHeaders As Boolean
Dim CompareFootnotes As Boolean
Dim CompareTextboxes As Boolean
Dim CompareFields As Boolean
Dim CompareComments As Boolean
Dim CompareMoves As Boolean
Dim RevisedAuthor As String
Dim IgnoreAllComparisonWarnings As Boolean
Dim returnValue As Document
returnValue = instance.CompareDocuments(OriginalDocument, _
RevisedDocument, Destination, Granularity, _
CompareFormatting, CompareCaseChanges, _
CompareWhitespace, CompareTables, _
CompareHeaders, CompareFootnotes, _
CompareTextboxes, CompareFields, _
CompareComments, CompareMoves, RevisedAuthor, _
IgnoreAllComparisonWarnings)
Document CompareDocuments(
Document OriginalDocument,
Document RevisedDocument,
WdCompareDestination Destination,
WdGranularity Granularity,
bool CompareFormatting,
bool CompareCaseChanges,
bool CompareWhitespace,
bool CompareTables,
bool CompareHeaders,
bool CompareFootnotes,
bool CompareTextboxes,
bool CompareFields,
bool CompareComments,
bool CompareMoves,
string RevisedAuthor,
bool IgnoreAllComparisonWarnings
)
Parameters
- OriginalDocument
Type: Microsoft.Office.Interop.Word.Document
Specifies the path and file name of the original document.
- RevisedDocument
Type: Microsoft.Office.Interop.Word.Document
Specifies the path and file name of the revised document to which to compare the original document.
- Destination
Type: Microsoft.Office.Interop.Word.WdCompareDestination
Specifies whether to create a new file or whether to mark the differences between the two documents in the original document or in the revised document. Default value is wdCompareDestinationNew.
- Granularity
Type: Microsoft.Office.Interop.Word.WdGranularity
Specifies whether changes are tracked by character or by word. Default value is wdGranularityWordLevel.
- CompareFormatting
Type: System.Boolean
Specifies whether to mark differences in formatting between the two documents. Default value is True.
- CompareCaseChanges
Type: System.Boolean
Specifies whether to mark differences in case between the two documents. Default value is True.
- CompareWhitespace
Type: System.Boolean
Specifies whether to mark differences in white space, such as paragraphs or spaces, between the two documents. Default value is True.
- CompareTables
Type: System.Boolean
Specifies whether to compare the differences in data contained in tables between the two documents. Default value is True.
- CompareHeaders
Type: System.Boolean
Specifies whether to compare differences in headers and footers between the two documents. Default value is True.
- CompareFootnotes
Type: System.Boolean
Specifies whether to compare differences in footnotes and endnotes between the two documents. Default value is True.
- CompareTextboxes
Type: System.Boolean
Specifies whether to compare differences in the data contained within text boxes between the two documents. Default value is True.
- CompareFields
Type: System.Boolean
Specifies whether to compare differences in fields between the two documents. Default value is True.
- CompareComments
Type: System.Boolean
Specifies whether to compare differences in comments between the two documents. Default value is True.
- CompareMoves
Type: System.Boolean
- RevisedAuthor
Type: System.String
Specifies the name of the person to whom to attribute changes when comparing the two documents.
- IgnoreAllComparisonWarnings
Type: System.Boolean
Specifies whether to ignore warnings when comparing the two documents.
Return Value
Type: Microsoft.Office.Interop.Word.Document
_Document