Udostępnij za pośrednictwem


Bookmark.TextRetrievalMode Property (2007 System)

Gets or sets a TextRetrievalMode object that controls how text is retrieved from 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 TextRetrievalMode As TextRetrievalMode
'Usage
Dim instance As Bookmark 
Dim value As TextRetrievalMode 

value = instance.TextRetrievalMode

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

Property Value

Type: TextRetrievalMode
A TextRetrievalMode object that controls how text is retrieved from the Bookmark control.

Examples

The following code example adds a Bookmark control with text to the document, hides the third word in the bookmark, and sets the TextRetrievalMode so that hidden text is not included. It then displays the text of the bookmark in a message box.

This example is for a document-level customization.

Private Sub BookmarkTextRetrievalMode()

    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."
    Bookmark1.Words(3).Font.Hidden = True
    Bookmark1.TextRetrievalMode.IncludeHiddenText = False
    MessageBox.Show("The text in Bookmark1 is: " & Bookmark1.Text)

End Sub
private void BookmarkTextRetrievalMode()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    int WordTrue = 1;
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";
    bookmark1.Words[3].Font.Hidden = WordTrue;
    bookmark1.TextRetrievalMode.IncludeHiddenText = false;
    MessageBox.Show("The text in bookmark1 is: " + bookmark1.Text);
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace