CellRange.GetReferenceA1() Method
Gets the relative cell or cell range reference in the A1 reference style.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Returns
Type | Description |
---|---|
String | A String value that specifies the A1-style relative 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);
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetReferenceA1() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.