ListObject.DataBodyRange, propriété

Obtient un Range qui représente la plage qui contient la zone de données de la liste comprise entre la ligne d'en-tête et la ligne d'insertion.

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

Syntaxe

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

Valeur de propriété

Type : Microsoft.Office.Interop.Excel.Range
Range qui représente la plage qui contient la zone de données de la liste comprise entre la ligne d'en-tête et la ligne d'insertion.

Notes

Si le contrôle ListObject ne possède pas de DataBodyRange, cette propriété retourne nullune référence null (Nothing en Visual Basic).

Exemples

L'exemple de code suivant crée un ListObject, puis affiche le nombre de lignes disponibles pour les données.

Cet exemple illustre une personnalisation au niveau du document.

    Private Sub ListObject_DataBodyRange()
        Dim List1 As Microsoft.Office.Tools.Excel.ListObject = _
            Me.Controls.AddListObject(Me.Range("A1", "C4"), "List1")
        Dim List1BodyRange As Excel.Range = List1.DataBodyRange
        Dim numberOfRows As Integer = List1BodyRange.Rows.Count
        MessageBox.Show("The DataBodyRange of list1 has " & _
            numberOfRows.ToString() & " rows.")

    End Sub

private void ListObject_DataBodyRange()
{
    Microsoft.Office.Tools.Excel.ListObject list1 = 
        this.Controls.AddListObject(
        this.Range["A1", "C4"], "list1");
    Excel.Range list1BodyRange = list1.DataBodyRange;
    int numberOfRows = list1BodyRange.Rows.Count;
    MessageBox.Show("The DataBodyRange of list1 has " +
        numberOfRows.ToString() + " rows.");
}

Sécurité .NET Framework

Voir aussi

Référence

ListObject Interface

Microsoft.Office.Tools.Excel, espace de noms