Expand Minimize

Bookmark.StoryLength Property

Gets the number of characters in the story that contains the Bookmark control.

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

int StoryLength { get; }

Property Value

Type: System.Int32
The number of characters in the story that contains the Bookmark control.

The following code example adds a Bookmark control with text to the document and then displays the text of the bookmark in a message box if the story length is greater than 0.

This example is for a document-level customization.

private void BookmarkStoryLength()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";

    if (bookmark1.StoryLength > 1)
    {
        MessageBox.Show(bookmark1.Text);
    }
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft