All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

CellRange.GetReferenceA1(ReferenceElement) Method

Gets the cell or cell range reference in the A1 reference style.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v21.1.Core.dll

Declaration

string GetReferenceA1(
    ReferenceElement options
)

Parameters

Name Type Description
options ReferenceElement

A ReferenceElement enumeration values that specify whether to return the relative, absolute or mixed cell reference, and whether to precede it with the worksheet name.

Returns

Type Description
String

A String value that specifies the A1-style reference to a cell or range of cells.

Remarks

Use the CellRange.GetReferenceR1C1 method to get cell references in the R1C1 reference style.

Example

This example demonstrates how to get A1-style references (relative, absolute and mixed) to a range of cells.

using DevExpress.Spreadsheet;
// ...

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

CellRange range = worksheet.Range["B3:D5"];

// Returns the relative range reference - "B3:D5".
string refRel = range.GetReferenceA1();

// Returns the relative range reference that includes the worksheet name - "Sheet1!B3:D5".
string refSheet = range.GetReferenceA1(ReferenceElement.IncludeSheetName);

// Returns the absolute range reference - "$B$3:$D$5".
string refAbs = range.GetReferenceA1(ReferenceElement.ColumnAbsolute | ReferenceElement.RowAbsolute);

// Returns the mixed range reference (with absolute row and relative column) 
// that includes the worksheet name - "Sheet1!B$3:D$5".
string refMixed = range.GetReferenceA1(ReferenceElement.RowAbsolute | ReferenceElement.IncludeSheetName);
See Also