Share via


DocumentBase.Content 屬性

取得 Range,表示主文件大綱。

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

語法

'宣告
Public ReadOnly Property Content As Range
public Range Content { get; }

屬性值

型別:Microsoft.Office.Interop.Word.Range
Range ,表示主文件大綱。

範例

下列程式碼範例會將文字加入至文件中的第一個段落,然後建立內含文件所有內容的範圍。 接著,程式碼會將此範圍內容的字型大小設定為 24。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間