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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。