Bookmark.InlineShapes Property

 

Gets an InlineShapes collection that represents all the InlineShape objects in a Bookmark control.

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

InlineShapes InlineShapes { get; }

Property Value

Type: Microsoft.Office.Interop.Word.InlineShapes

An InlineShapes collection that represents all the InlineShape objects in a Bookmark control.

The following code example adds a Bookmark control to the document and then adds a horizontal line to the bookmark. The code then displays the total number of inline shapes the bookmark contains in a message box.

This example is for a document-level customization.

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

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    object myRange = bookmark1.Range;
    bookmark1.InlineShapes.AddHorizontalLineStandard(ref myRange);
    MessageBox.Show("Number of inline shapes in bookmark1: " +
        bookmark1.InlineShapes.Count.ToString());
}
Return to top
Show: