DocumentBase.StoryRanges 屬性

取得 StoryRanges 集合,表示文件中的所有大綱。

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

語法

'宣告
Public ReadOnly Property StoryRanges As StoryRanges
    Get
public StoryRanges StoryRanges { get; }

屬性值

型別:Microsoft.Office.Interop.Word.StoryRanges
StoryRanges 集合,表示文件中的所有大綱。

範例

下列程式碼範例會將文字加入至文件頁首,然後顯示訊息說明頁首文字。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentStoryRanges()
    Me.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text _
        = "Header text"
    MessageBox.Show(Me.StoryRanges(Word.WdStoryType.wdPrimaryHeaderStory).Text)
End Sub 
private void DocumentStoryRanges()
{
    this.Sections[1].Headers[Word.WdHeaderFooterIndex.
        wdHeaderFooterPrimary].Range.Text = 
        "Header text";
    MessageBox.Show (this.StoryRanges[
        Word.WdStoryType.wdPrimaryHeaderStory].Text);

}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間