Expand Minimize

Bookmark.XMLParentNode Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets an Microsoft.Office.Interop.Word.XMLNode object that represents the parent node of a Bookmark control.

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

XMLNode XMLParentNode { get; }

Property Value

Type: Microsoft.Office.Interop.Word.XMLNode
An Microsoft.Office.Interop.Word.XMLNode object that represents the parent node of a Bookmark control.

The following code example inserts XML into the document and creates a Bookmark control on the second word. It then inserts additional XML into the bookmark and displays the text of the XMLParentNode in a message box.

This example is for a document-level customization.

private void BookmarkParentNode()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertXML("<example>This is an example.</example>",
        ref missing);
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range.Words[2],
        "bookmark1");
    bookmark1.Characters.First.InsertXML("<character>T</character>", ref missing);

    MessageBox.Show(bookmark1.XMLParentNode.Text);
}

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