Share via


ActionEventArgs.Range, propriété

Obtient la plage contenant le texte qui a été reconnu comme une balise active.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word (dans Microsoft.Office.Tools.Word.dll)

Syntaxe

'Déclaration
ReadOnly Property Range As Range
    Get
Range Range { get; }

Valeur de propriété

Type : Microsoft.Office.Interop.Word.Range
Plage contenant le texte qui a été reconnu comme une balise active.

Exemples

L'exemple de code suivant illustre un gestionnaire pour l'événement Click. Le gestionnaire d'événements utilise la propriété Range pour afficher les positions de début et de fin du terme de balise active reconnu. Cet exemple de code fait partie d'un exemple plus complet fourni pour l'interface Action.

Cet exemple illustre une personnalisation au niveau du document.

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());
}

Sécurité .NET Framework

Voir aussi

Référence

ActionEventArgs Interface

Microsoft.Office.Tools.Word, espace de noms