Bookmark.FormattedText (Propiedad)

Obtiene o establece un objeto Range que incluye el texto con formato del control Bookmark.

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

Sintaxis

'Declaración
Property FormattedText As Range
Range FormattedText { get; set; }

Valor de propiedad

Tipo: Microsoft.Office.Interop.Word.Range
Un objeto Range que incluye el texto con formato del control Bookmark.

Comentarios

Cuando se establece esta propiedad, el texto del control Bookmark se reemplaza con texto con formato.

Ejemplos

El ejemplo de código siguiente inserta texto en el primer párrafo y aplica formato de negrita a la tercera palabra.A continuación, copia la tercera palabra (con formato) a un control Bookmark.

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

Private Sub BookmarkFormattedText()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is text in the " & "first paragraph."
    Me.Paragraphs(1).Range.Words(3).Bold = True

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(2).Range, "Bookmark1")
    Bookmark1.FormattedText = Me.Paragraphs(1).Range.Words(3)

End Sub
private void BookmarkFormattedText()
{
    int WordTrue = 1;
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is text in the "
        + "first paragraph.";
    this.Paragraphs[1].Range.Words[3].Bold = WordTrue;
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[2].Range,
        "bookmark1");
    bookmark1.FormattedText = this.Paragraphs[1].Range.Words[3];
}

Seguridad de .NET Framework

Vea también

Referencia

Bookmark Interfaz

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