ActionEventArgs.Range 属性

获取一个包含已被识别为智能标记的文本的范围。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)

语法

声明
ReadOnly Property Range As Range
    Get
Range Range { get; }

属性值

类型:Microsoft.Office.Interop.Word.Range
一个包含已被识别为智能标记的文本的范围。

示例

下面的代码示例演示 Click 事件的处理程序。 该事件处理程序使用 Range 属性来显示所识别的智能标记术语的起始位置和结束位置。 此代码示例摘自为 Action 接口提供的一个更大的示例。

此示例针对的是文档级自定义项。

Private Sub DisplayAddress_Click(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _
    Handles displayAddress.Click

    Dim termStart As Integer = e.Range.Start
    Dim termEnd As Integer = e.Range.End
    MsgBox("The recognized text '" & e.Text & _
            "' begins at position " & termStart & _
            " and ends at position " & termEnd)
End Sub
void displayAddress_Click(object sender,
    Microsoft.Office.Tools.Word.ActionEventArgs e)
{
    int termStart = e.Range.Start;
    int termEnd = e.Range.End;
    System.Windows.Forms.MessageBox.Show("The recognized text '" + e.Text +
        "' begins at position " + termStart.ToString() +
        " and ends at position " + termEnd.ToString());
}

.NET Framework 安全性

请参见

参考

ActionEventArgs 接口

Microsoft.Office.Tools.Word 命名空间