다음을 통해 공유


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)

Syntax

'Declaration
ReadOnly Property InlineShapes As InlineShapes
InlineShapes InlineShapes { get; }

Property Value

Type: Microsoft.Office.Interop.Word.InlineShapes
An InlineShapes collection that represents all the InlineShape objects in a Bookmark control.

Examples

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 Sub BookmarkInlineShapes()
    Me.Paragraphs(1).Range.InsertParagraphBefore()

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

    MessageBox.Show("Number of inline shapes in Bookmark1: " & _
        Bookmark1.InlineShapes.Count.ToString)

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

.NET Framework Security

See Also

Reference

Bookmark Interface

Microsoft.Office.Tools.Word Namespace