共用方式為


DocumentBase.OriginalDocumentTitle Property

Definition

Gets the title of the original document after performing a legal-blackline document compare operation.

public:
 property System::String ^ OriginalDocumentTitle { System::String ^ get(); };
public string OriginalDocumentTitle { get; }
member this.OriginalDocumentTitle : string
Public ReadOnly Property OriginalDocumentTitle As String

Property Value

The title of the original document after performing a legal-blackline document compare operation.

Examples

The following code example compares the Word document in the document-level customization (called the original document) with another version of the same document (called the revised document). It places the result of the comparison into the original document. The example then notifies the user whether the title of the original document and the title of the revised document are identical or different and displays both document titles. To use this example, run it from the ThisDocument class in a document-level project.

private void GetDocumentTitlesAfterComparison()
{
    object OriginalFileName = @"c:\myDocs\HikingGuide.docx";
    Word.Document originalDoc = this.Application.Documents.Open(
        ref OriginalFileName, ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing, ref missing,
        ref missing);

    object RevisedFileName = @"c:\myDocs\RevisedHikingGuide.docx";
    Word.Document revisedDoc = this.Application.Documents.Open(
        ref RevisedFileName, ref missing, ref missing, ref missing, ref missing, 
        ref missing,ref missing, ref missing, ref missing, ref missing, 
        ref missing, ref missing, ref missing, ref missing,ref missing, 
        ref missing);

    this.Application.CompareDocuments(
        originalDoc, revisedDoc, 
        Word.WdCompareDestination.wdCompareDestinationOriginal, 
        Word.WdGranularity.wdGranularityWordLevel, true, true, 
        true, true, true, true, true, true, true, true, "", true);
    
    StringBuilder sb = new StringBuilder();
    if (this.OriginalDocumentTitle == this.RevisedDocumentTitle)
    {
        sb.Append(
            "The titles of the orginal and revised document are identical.");
    }
    else
    {
        sb.Append(
            "The titles of the orginal and revised document are different.");                    
    }
    sb.Append(
            "\r\nTitle of original document: " + this.OriginalDocumentTitle
            + "\r\nTitle of revised document: " + this.RevisedDocumentTitle);
    MessageBox.Show(sb.ToString());
}
Private Sub GetDocumentTitlesAfterComparison()        
    Dim originalFileName As Object = "c:\myDocs\HikingGuide.docx"
    Dim originalDoc As Word.Document = Me.Application.Documents.Open( _
        originalFileName)

    Dim revisedFileName As Object = "c:\myDocs\RevisedHikingGuide.docx"
    Dim revisedDoc As Word.Document = Me.Application.Documents.Open( _
        revisedFileName)

    Me.Application.CompareDocuments( _
        originalDoc, revisedDoc, _
        Word.WdCompareDestination.wdCompareDestinationOriginal, _
        Word.WdGranularity.wdGranularityWordLevel, True, True, _
        True, True, True, True, True, True, True, True, "", True)

    Dim sb As StringBuilder = New StringBuilder()
    If Me.OriginalDocumentTitle = Me.RevisedDocumentTitle Then
        sb.Append("The titles of the orginal and revised document are identical.")
    Else
        sb.Append("The titles of the orginal and revised document are different.")
    End If
    sb.Append( _
            vbCrLf + "Title of original document: " _
            + Me.OriginalDocumentTitle _
            + vbCrLf + "Title of revised document: " _
            + Me.RevisedDocumentTitle)
    MessageBox.Show(sb.ToString())
End Sub

Remarks

To perform a legal-blackline document compare operation, use the CompareDocuments method of the Application property.

Applies to