Bookmark.ShapeRange (Propiedad)

Obtiene una colección ShapeRange que representa todos los objetos Shape del control Bookmark.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word (en Microsoft.Office.Tools.Word.dll)

Sintaxis

'Declaración
ReadOnly Property ShapeRange As ShapeRange
    Get
ShapeRange ShapeRange { get; }

Valor de propiedad

Tipo: Microsoft.Office.Interop.Word.ShapeRange
Una colección ShapeRange que representa todos los objetos Shape del control Bookmark.

Comentarios

El objeto ShapeRange puede contener dibujos, formas, imágenes, objetos OLE, controles ActiveX, objetos de texto y llamadas.

Ejemplos

El ejemplo de código siguiente agrega un control Bookmark con texto al documento y, a continuación, utiliza las posiciones vertical y horizontal del marcador al crear un cuadro de texto. Muestra el nombre de la propiedad ShapeRange del marcador en un cuadro de mensaje.

Se trata de un ejemplo para una personalización en el nivel del documento.

Private Sub BookmarkShapeRange()

    Me.Paragraphs(1).Range.InsertParagraphBefore()

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This is sample bookmark text."

    Dim vertical As Single = Bookmark1.Information(Microsoft.Office _
        .Interop.Word.WdInformation.wdVerticalPositionRelativeToPage)
    Dim horizontal As Single = Bookmark1.Information(Microsoft.Office _
        .Interop.Word.WdInformation.wdHorizontalPositionRelativeToPage)

    Dim shape As Word.Shape = Me.Shapes.AddTextbox(Microsoft.Office.Core _
        .MsoTextOrientation.msoTextOrientationHorizontal, vertical, _
        horizontal, 50, 50)

    MessageBox.Show(Bookmark1.ShapeRange.Name.ToString)

End Sub
private void BookmarkShapeRange()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";

    object myRange = bookmark1.Range;
    object vertical = bookmark1.Information[Microsoft.Office
        .Interop.Word.WdInformation.wdVerticalPositionRelativeToPage];
    object horizontal = bookmark1.Information[Microsoft.Office
        .Interop.Word.WdInformation.wdHorizontalPositionRelativeToPage];

    Word.Shape shape = this.Shapes.AddTextbox(Microsoft.Office.Core
        .MsoTextOrientation.msoTextOrientationHorizontal, (float)vertical, 
        (float)horizontal, 50, 50, ref missing);

    MessageBox.Show(bookmark1.ShapeRange.Name.ToString());
}

Seguridad de .NET Framework

Vea también

Referencia

Bookmark Interfaz

Microsoft.Office.Tools.Word (Espacio de nombres)