Export (0) Print
Expand All
Expand Minimize

NamedRange.ListHeaderRows Property

Gets the number of header rows for the NamedRange control.

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

int ListHeaderRows { get; }

Property Value

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

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.

Microsoft.Office.Tools.Excel.NamedRange getHeadersRange;
private void GetNumberOfHeaderRows()
{
    this.Range["A1"].Value2 = "Row 1";
    this.Range["B1"].Value2 = "Row 2";
    this.Range["C1"].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.");
}

Show:
© 2015 Microsoft