This documentation is archived and is not being maintained.

Bookmark.FormattedText Property

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 (in microsoft.office.tools.word.dll)

public Range FormattedText { get; set; }

Property Value

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

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

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.

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

Show: