Back to Devexpress

ColumnCollection.Item[String] Property

officefileapi-devexpress-dot-spreadsheet-dot-columncollection-dot-item-x28-system-dot-string-x29.md

latest3.7 KB
Original Source

ColumnCollection.Item[String] Property

Provides access to an individual column in the collection by its heading.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
Column this[string columnHeading] { get; }
vb
ReadOnly Property Item(columnHeading As String) As Column

Parameters

NameTypeDescription
columnHeadingString

A string that specifies the heading of the column to be obtained in the A1 reference style (the letter or combination of letters, for example, “A”, “B”, “C”,…,”XFD”).

|

Property Value

TypeDescription
Column

A Column object that is a column with the specified heading.

|

Remarks

The Item property requires the column heading in the A1 reference style, regardless of which cell reference style is used in the workbook (DocumentSettings.R1C1ReferenceStyle). If you need to get a cell range by its R1C1 reference, use the IRangeProvider.Parse method.

Example

This example demonstrates how to access columns in a worksheet. Use the Worksheet.Columns property to get a collection of columns contained in a worksheet (the ColumnCollection object). To get an individual column by its index (zero-based) or heading (“A”, “B”, “C”, etc.), use the ColumnCollection.Item property.

csharp
using DevExpress.Spreadsheet;
// ...

Workbook workbook = new Workbook();

// Access a collection of columns.
ColumnCollection columns = workbook.Worksheets[0].Columns;

// Access the first column by its index in the collection of columns.
Column firstColumn_byIndex = columns[0];

// Access the first column by its unique name.
Column firstColumn_byName = columns["A"];
vb
Imports DevExpress.Spreadsheet
' ...

Dim workbook As New Workbook()

' Access a collection of columns.
Dim columns As ColumnCollection = workbook.Worksheets(0).Columns

' Access the first column by its index in the collection of columns.
Dim firstColumn_byIndex As Column = columns(0)

' Access the first column by its unique name.
Dim firstColumn_byName As Column = columns("A")

See Also

Rows and Columns in Spreadsheet Documents

WinForms Spreadsheet Control Examples

ColumnCollection Interface

ColumnCollection Members

DevExpress.Spreadsheet Namespace