Bookmark.NextStoryRange Property
Gets a Range object that refers to the next story, as shown in the following table.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Syntax
'Declaration
ReadOnly Property NextStoryRange As Range
Range NextStoryRange { get; }
Property Value
Type: Microsoft.Office.Interop.Word.Range
a Range object that refers to the next story, as shown in the following table.
Remarks
Story type |
Item returned by the NextStoryRange method |
---|---|
wdMainTextStory, wdFootnotesStory, wdEndnotesStory, and wdCommentsStory |
Always returns nulla null reference (Nothing in Visual Basic). |
The story of the next set of linked text boxes. |
|
wdEvenPagesHeaderStory, wdPrimaryHeaderStory, wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageHeaderStory, wdFirstPageFooterStory |
The story of the same type in the next section. |
Examples
The following code example adds a Next page section break to the document and then adds a Bookmark control with text to the even page header of section 1. The code then uses NextStoryRange to add text to the header of section 2.
This example is for a document-level customization.
Private Sub BookmarkNextStoryRange()
Me.Paragraphs(1).Range.InsertBreak(Word.WdBreakType.wdSectionBreakNextPage)
Me.PageSetup.OddAndEvenPagesHeaderFooter = True
Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
Me.Controls.AddBookmark(Me.Sections(1).Headers( _
Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages).Range, _
"Bookmark1")
Bookmark1.Text = "Even Header 1"
Me.Sections(2).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages) _
.LinkToPrevious = False
Bookmark1.NextStoryRange.Text = "Even Header 2"
End Sub
private void BookmarkNextStoryRange()
{
int WordTrue = -1;
object BreakType = Word.WdBreakType.wdSectionBreakNextPage;
this.Paragraphs[1].Range.InsertBreak(ref BreakType);
this.PageSetup.OddAndEvenPagesHeaderFooter = WordTrue;
Microsoft.Office.Tools.Word.Bookmark bookmark1 =
this.Controls.AddBookmark(this.Sections[1].Headers[
Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages].Range,
"bookmark1");
bookmark1.Text = "Even Header 1";
this.Sections[2].Headers[Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages]
.LinkToPrevious = false;
bookmark1.NextStoryRange.Text = "Even Header 2";
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.