Bookmark.FormattedText Property (2007 System)

Gets or sets a Range object that includes the formatted text in the Bookmark control.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property FormattedText As Range
'Usage
Dim instance As Bookmark 
Dim value As Range 

value = instance.FormattedText

instance.FormattedText = value
[BrowsableAttribute(false)]
public Range FormattedText { get; set; }
[BrowsableAttribute(false)]
public:
property Range^ FormattedText {
    Range^ get ();
    void set (Range^ value);
}
public function get FormattedText () : Range 
public function set FormattedText (value : Range)

Property Value

Type: Range
A Range object that includes the formatted text in the Bookmark control.

Remarks

When you set this property, the text in the Bookmark control is replaced with formatted text.

Examples

The following code example inserts text into the first paragraph and then formats the third word as bold. It then copies the third word (with formatting) to a Bookmark control.

This example is for a document-level customization.

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];
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace