Skip to main content

Row.Item[String] Property

Provides access to an individual cell located at the intersection of the current row and the specified column.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

Cell this[string columnHeading] { get; }

Parameters

Name Type Description
columnHeading String

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

Property Value

Type Description
Cell

A Cell object that is the cell at the specified column.

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 several ways to access individual cells.

  • By row and column indexes of a cell via the Worksheet.Item property.
  • By a cell reference (for example, A1, B2, etc.) or by row and column indexes from the worksheet’s collection of cells. Use the CellCollection.Item property.
  • By a column index or column heading from the specified row. Use the Row.Item property.

    By a row index or row heading from the specified column. Use the Column.Item property.

    See the How to: Access a Row or Column example to learn how to get an individual row or column.

  • By a cell index from the specified range of cells, or by row and column offsets relative to the cell range. Use the CellRange.Item property. See the How to: Access a Range of Cells document to learn how to access an individual range of cells in a worksheet.
using DevExpress.Spreadsheet;
// ...

IWorkbook workbook = spreadsheetControl1.Document;
Worksheet worksheet = workbook.Worksheets[0];

Cell cellA1 = worksheet[0, 0]; // Cell A1

Cell cellB2 = worksheet.Cells["B2"]; // Cell B2
Cell cellC2 = worksheet.Cells[1, 2]; // Cell C2

Cell cellD3 = worksheet.Cells[2, 3]; // Cell D3
Cell cellE4 = worksheet.Rows[3]["E"]; // Cell E4
Cell cellF4 = worksheet.Rows["4"][5]; // Cell F4

Cell cellG5 = worksheet.Columns[6][4]; // Cell G5
Cell cellH6 = worksheet.Columns["H"][5]; // Cell H6
Cell cellI7 = worksheet.Columns["I"]["7"]; // Cell I7

// Access a cell from the range of cells.
Cell cellB5 = worksheet.Range["B3:D6"][6]; // Cell B5
Cell cellD6 = worksheet.Range["B3:D6"][3, 2]; // Cell D6
See Also