Share via


Bookmark.StoryLength Property (2007 System)

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

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

Syntax

'Declaration
Public ReadOnly Property StoryLength As Integer
'Usage
Dim instance As Bookmark 
Dim value As Integer 

value = instance.StoryLength
public int StoryLength { get; }
public:
property int StoryLength {
    int get ();
}
public function get StoryLength () : int

Property Value

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

Examples

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 Sub BookmarkStoryLength()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.Text = "This is sample bookmark text." 

    If bookmark1.StoryLength > 1 Then
        MessageBox.Show(Bookmark1.Text)
    End If 

End Sub
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);
    }
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace