Share via


NamedRange.EntireColumn 屬性

取得 Microsoft.Office.Interop.Excel.Range,表示包含 NamedRange 控制項的整個 (或多個) 欄。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
ReadOnly Property EntireColumn As Range
Range EntireColumn { get; }

屬性值

型別:Microsoft.Office.Interop.Excel.Range
Microsoft.Office.Interop.Excel.Range ,表示包含 NamedRange 控制項的整個 (或多個) 欄。

範例

下列程式碼範例會建立 NamedRange,然後將包含 NamedRange 欄和列的框線色彩設定為綠色。

這是示範文件層級自訂的範例。

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

Private Sub HighlightColumnAndRow()
    entireRowAndColumnRange = Me.Controls.AddNamedRange( _
        Me.Range("C3", "E5"), "entireRowAndColumnRange")

    ' Set the style of the column and row borders to xlSlantDashDot.
    Me.entireRowAndColumnRange.EntireColumn.Borders.LineStyle = _
        Excel.XlLineStyle.xlSlantDashDot
    Me.entireRowAndColumnRange.EntireRow.Borders.LineStyle = _
        Excel.XlLineStyle.xlSlantDashDot
End Sub
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;
}

.NET Framework 安全性

請參閱

參考

NamedRange 介面

Microsoft.Office.Tools.Excel 命名空間