Freigeben über


Bookmark.Find-Eigenschaft

Ruft ein Find-Objekt ab, das die Kriterien für einen Suchvorgang innerhalb eines Bookmark-Steuerelements enthält.

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

Syntax

'Declaration
ReadOnly Property Find As Find
Find Find { get; }

Eigenschaftswert

Typ: Microsoft.Office.Interop.Word.Find
Ein Find-Objekt, das die Kriterien für einen Suchvorgang innerhalb eines Bookmark-Steuerelements enthält.

Beispiele

Im folgenden Codebeispiel wird dem ersten Absatz ein Bookmark-Steuerelement mit Text hinzugefügt. Anschließend wird im Lesezeichen das Wort sample durch das Wort replacement ersetzt.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

Private Sub BookmarkFind()

    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."

    MessageBox.Show("Bookmark text before using Find method: " & Bookmark1.Text)

    Bookmark1.Find.Execute(FindText:="sample", ReplaceWith:="replacement", _
        Replace:=Word.WdReplace.wdReplaceAll, Forward:=True)

    MessageBox.Show("Bookmark text after using Find method: " & Bookmark1.Text)

End Sub
private void BookmarkFind()
{
    object FindText = "sample";
    object ReplaceWith = "replacement";
    object Replace = Word.WdReplace.wdReplaceAll;
    object Forward = true;
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";
    MessageBox.Show("Bookmark text before using Find method: " + bookmark1.Text);

    bookmark1.Find.Execute(ref FindText, ref missing, ref missing,
        ref missing, ref missing, ref Forward, ref missing, ref
        missing,ref missing,ref ReplaceWith, ref Replace, ref missing, 
        ref missing, ref missing, ref missing);

    MessageBox.Show("Bookmark text after using Find method: " + bookmark1.Text);
}

.NET Framework-Sicherheit

Siehe auch

Referenz

Bookmark Schnittstelle

Microsoft.Office.Tools.Word-Namespace