Udostępnij za pośrednictwem


NamedRange.ListHeaderRows Property (2007 System)

Gets the number of header rows for the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public ReadOnly Property ListHeaderRows As Integer
'Usage
Dim instance As NamedRange 
Dim value As Integer 

value = instance.ListHeaderRows
public int ListHeaderRows { get; }
public:
property int ListHeaderRows {
    int get ();
}
public function get ListHeaderRows () : int

Property Value

Type: System.Int32
The number of header rows for the NamedRange control.

Examples

The following code example creates a NamedRange and then displays a message that shows the number of header rows in the NamedRange.

This example is for a document-level customization.

Private getHeadersRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub GetNumberOfHeaderRows()
    Me.Range("A1").Value2 = "Row 1" 
    Me.Range("B1").Value2 = "Row 2" 
    Me.Range("C1").Value2 = "Row 3" 

    Me.Range("A2", "A5").Value2 = 10
    Me.Range("B2", "B5").Value2 = 20
    Me.Range("C2", "C5").Value2 = 30

    getHeadersRange = Me.Controls.AddNamedRange( _
        Me.Range("A1", "C5"), "getHeadersRange")

    MessageBox.Show("The NamedRange contains " & _
        getHeadersRange.ListHeaderRows & " header row.")
End Sub
Microsoft.Office.Tools.Excel.NamedRange getHeadersRange;
private void GetNumberOfHeaderRows()
{
    this.Range["A1", missing].Value2 = "Row 1";
    this.Range["B1", missing].Value2 = "Row 2";
    this.Range["C1", missing].Value2 = "Row 3";

    this.Range["A2", "A5"].Value2 = 10;
    this.Range["B2", "B5"].Value2 = 20;
    this.Range["C2", "C5"].Value2 = 30;

    getHeadersRange = this.Controls.AddNamedRange(
        this.Range["A1", "C5"], "getHeadersRange");

    MessageBox.Show("The NamedRange contains " +
        getHeadersRange.ListHeaderRows + " header row.");
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace