Style Property
Collapse the table of content
Expand the table of content

Bookmark.Style Property


Gets or sets the style for the Bookmark control.

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

object Style { get; set; }

Property Value

Type: System.Object

The style for the Bookmark control.

To set this property, specify the local name of the style, an integer, a T:Microsoft.Office.Interop.Word.WdBuiltinStyle constant, or an object that represents the style. For a list of valid constants, consult the Microsoft Visual Basic Object Browser.

When you return the style for a Bookmark control that includes more than one style, only the first character or paragraph style is returned.

The following code example adds a Bookmark control with text in the document, changes the style to Heading 1, and then deletes the bookmark.

This example is for a document-level customization.

private void BookmarkStyle()

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
    bookmark1.Text = "Heading of Document";
    bookmark1.Style = "Heading 1";
Return to top
© 2016 Microsoft