DocumentBase.StoryRanges Property

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property StoryRanges As StoryRanges
public StoryRanges StoryRanges { get; }

Property Value

Type: Microsoft.Office.Interop.Word.StoryRanges
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 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 Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace