更新:2007 年 11 月
获取一个表示主文档内容的 Range。
命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v9.0(在 Microsoft.Office.Tools.Word.v9.0.dll 中)
语法
声明
<BrowsableAttribute(False)> _
Public ReadOnly Property Content As Range
用法
Dim instance As Document
Dim value As Range
value = instance.Content
[BrowsableAttribute(false)]
public Range Content { get; }
属性值
类型:Microsoft.Office.Interop.Word.Range
一个表示主文档内容的 Range。
示例
下面的代码示例向文档中的第一个段落添加文本,然后创建一个包括文档所有内容的范围。该代码随后将此范围内容的字号设置为 24。
此示例针对的是文档级自定义项。
Private Sub DocumentContent()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is some sample text."
    Dim myRange As Word.Range = Me.Content
    myRange.Font.Size = 24
End Sub
private void DocumentContent()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is some sample text.";
    Word.Range myRange = this.Content;
    myRange.Font.Size = 24;
}
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。