Bookmark.InRange(Range) Yöntem

Tanım

RangeYöntemin, denetimin içinde uygulandığını belirler Bookmark .

public bool InRange (Microsoft.Office.Interop.Word.Range Range);

Parametreler

Range
Range

Rangenesne.

Döndürülenler

Boolean

trueEğer Range belirtilen Bookmark denetimin içindeyse yöntemin uygulandığı denetimde ise, aksi durumda false .

Örnekler

Aşağıdaki kod örneği, Bookmark belgeye metin içeren bir denetim ekler ve sonra yer Işaretinin paragraf 1 ile aynı aralıkta olup olmadığını denetler. Bu kod daha sonra sonuçları bir ileti kutusunda görüntüler.

Bu örnek, belge düzeyinde özelleştirme içindir

private void BookmarkInRange()
{
    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.";
    if (bookmark1.InRange(this.Paragraphs[1].Range))
    {
        MessageBox.Show("The bookmark is in the first paragraph.");
    }
    else
    {
        MessageBox.Show("The bookmark is not in the first paragraph.");
    }
}
Private Sub BookmarkInRange()

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

    If Bookmark1.InRange(Me.Paragraphs(1).Range) Then
        MessageBox.Show("The bookmark is in the first paragraph.")
    Else
        MessageBox.Show("The bookmark is not in the first paragraph.")
    End If

End Sub

Açıklamalar

Bu yöntem, Range Bookmark Başlangıç ve bitiş karakteri konumlarını ve hikaye türünü karşılaştırarak denetimde olup olmadığını belirler.

Şunlara uygulanır