NamedRange.EntireColumn Property

 

Gets a Microsoft.Office.Interop.Excel.Range that represents the entire column (or columns) that contains the NamedRange control.

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

Range EntireColumn { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Range

A Microsoft.Office.Interop.Excel.Range that represents the entire column (or columns) that contains the NamedRange control.

The following code example creates a NamedRange and then sets the border color of the columns and rows that contain the NamedRange to green.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange entireRowAndColumnRange;
private void HighlightColumnAndRow()
{
    entireRowAndColumnRange = this.Controls.AddNamedRange(
        this.Range["C3", "E5"], "entireRowAndColumnRange");

    // Set the style of the column and row borders to xlSlantDashDot.
    this.entireRowAndColumnRange.EntireColumn.Borders.LineStyle = 
        Excel.XlLineStyle.xlSlantDashDot;
    this.entireRowAndColumnRange.EntireRow.Borders.LineStyle = 
        Excel.XlLineStyle.xlSlantDashDot;
}
Return to top
Show: