Bookmark.TextRetrievalMode-Eigenschaft

Ruft ein TextRetrievalMode-Objekt ab, das steuert, wie Text vom Bookmark-Steuerelement abgerufen wird.

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

Syntax

'Declaration
Property TextRetrievalMode As TextRetrievalMode
    Get
    Set
TextRetrievalMode TextRetrievalMode { get; set; }

Eigenschaftswert

Typ: Microsoft.Office.Interop.Word.TextRetrievalMode
Ein TextRetrievalMode-Objekt, das steuert, wie Text vom Bookmark-Steuerelement abgerufen wird.

Beispiele

Im folgenden Codebeispiel wird dem Dokument ein Bookmark-Steuerelement mit Text hinzugefügt, das dritte Wort im Lesezeichen ausgeblendet und TextRetrievalMode darauf festgelegt, dass ausgeblendeter Text nicht eingeschlossen ist. Dann wird der Text des Lesezeichens in einem Meldungsfeld angezeigt.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

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-Sicherheit

Siehe auch

Referenz

Bookmark Schnittstelle

Microsoft.Office.Tools.Word-Namespace