SpreadsheetControl.ActiveCell Property
Gets an active cell in the active worksheet.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
Cell | A Cell object that specifies an active cell in the worksheet that is currently active. |
Remarks
The SpreadsheetControl.Selection property specifies the range of cells selected in a worksheet that is currently active (B3:F9, in the image below). The SpreadsheetControl.SelectedCell property specifies a single cell located in the active worksheet where data is inserted when an end-user types (E7, in the image below). In other words, the selected cell is an active cell that can be also obtained via the ActiveCell property. Selection can be a single cell or range of cells, while SelectedCell is always a single cell inside the current selection.
The following code sets selection and active cell as shown in the image above.
using DevExpress.Spreadsheet;
// ...
IWorkbook workbook = spreadsheetControl1.Document;
Worksheet activeSheet = workbook.Worksheets.ActiveWorksheet;
// Specify the selected cell range in the active worksheet.
spreadsheetControl1.Selection = activeSheet.Range["B3:F9"];
// Specify the active cell in the active worksheet.
spreadsheetControl1.SelectedCell = activeSheet.Cells["E7"];
Note
You can also use the Worksheet.Selection and Worksheet.SelectedCell properties to specify the selected range and active cell in a specific worksheet.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveCell property.
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.