DocumentBase.StoryRanges Property

Definition

Gets a StoryRanges collection that represents all the stories in the document.

public:
 property Microsoft::Office::Interop::Word::StoryRanges ^ StoryRanges { Microsoft::Office::Interop::Word::StoryRanges ^ get(); };
public Microsoft.Office.Interop.Word.StoryRanges StoryRanges { get; }
member this.StoryRanges : Microsoft.Office.Interop.Word.StoryRanges
Public ReadOnly Property StoryRanges As StoryRanges

Property Value

A StoryRanges collection that represents all the stories in the document.

Examples

The following code example adds text to the document header and then displays a message that shows the text of the header. To use this example, run it from the ThisDocument class in a document-level project.

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

}
Private Sub DocumentStoryRanges()
    Me.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text _
        = "Header text"
    MessageBox.Show(Me.StoryRanges(Word.WdStoryType.wdPrimaryHeaderStory).Text)
End Sub 

Applies to