Bookmark.ModifyEnclosure Method (Object, Object, Object)

 

Adds, modifies, or removes an enclosure around the specified character or characters in the Bookmark control.

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

void ModifyEnclosure(
	ref object Style,
	ref object Symbol,
	ref object EnclosedText
)

Parameters

Style
Type: System.Object

The style of the enclosure. Can be any T:Microsoft.Office.Interop.Word.WdEncloseStyle constant.

Symbol
Type: System.Object

The symbol in which to enclose the Bookmark control. Can be any T:Microsoft.Office.Interop.Word.WdEnclosureType constant.

EnclosedText
Type: System.Object

The characters that you want to enclose. If you include this argument, Microsoft Office Word replaces the Bookmark control with the enclosed characters. If you do not specify text to enclose, Microsoft Office Word encloses all text in the Bookmark control.

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example adds a Bookmark control to the first paragraph and encloses the third character in a circle.

This example is for a document-level customization.

private void BookmarkModifyEnclosure()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "First bookmark";

    object Style = Word.WdEncloseStyle.wdEncloseStyleLarge;
    object Symbol = Word.WdEnclosureType.wdEnclosureCircle;

    bookmark1.Characters[3].ModifyEnclosure(ref Style, ref Symbol, ref missing);
}
Return to top
Show: