Worksheet.GetUsedRange() Method
Returns the used range on the specified worksheet.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v18.2.Core.dll
Declaration
Returns
Type | Description |
---|---|
Range | A Range object that is the range of modified cells. |
Remarks
In the Spreadsheet document model, empty cells in a worksheet do not exist until they are accessed in some way or modified. The GetUsedRange method returns a worksheet range that complies with the requirements listed below.
The used range is a continuous range of non-empty cells. The top-left cell of the used range is a cell located at the intersection of the topmost row and the leftmost column containing non-empty cells. The bottom-right cell of the used range is a cell located at the intersection of the lowest row and the rightmost column containing non-empty cells.
Note
The cell is not empty if it contains a Range.Value, Range.Formula, or has any Formatting properties which are not null.
The used range is extended to include the leftmost and rightmost empty columns containing visual formatting (fill or border). However, the returned range cannot include more than 8192 columns. Hidden columns that contain no data or formatting options applied, as well as empty columns with a custom width are not included in the used range.
The used range is extended to include the topmost and bottommost empty rows containing visual formatting (fill or border).
The used range includes all the tables regardless their visibility state (a table occupies a range determined by the Table.Range property).
Pictures are not included in the used range.
Merged cells are included in the used range, even if they are located in hidden columns or rows.
- Conditional formatting is ignored.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetUsedRange() 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.