共用方式為


DocumentBase.RevisedDocumentTitle 屬性

取得執行修正標記文件比較作業後之修訂文件的標題。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property RevisedDocumentTitle As String
public string RevisedDocumentTitle { get; }

屬性值

型別:System.String
執行修正標記文件比較作業後之修訂文件的標題。

備註

若要執行修正標記文件比較作業,請使用 Application 屬性的 CompareDocuments 方法。

範例

下列程式碼範例會將文件層級自訂中的 Word 文件 (稱為原始文件) 與相同文件的其他版本 (稱為修訂文件) 進行比較。 它會將比較結果放入原始文件中。 這個範例接著會通知使用者該原始文件標題與修訂文件標題是否相同,並顯示這兩個文件標題。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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
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());
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間