officefileapi-devexpress-dot-spreadsheet-dot-cellrange-dot-resize-x28-system-dot-int32-system-dot-int32-x29.md
Resizes the current cell range.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
CellRange Resize(
int rowCount,
int columnCount
)
Function Resize(
rowCount As Integer,
columnCount As Integer
) As CellRange
| Name | Type | Description |
|---|---|---|
| rowCount | Int32 |
The number of rows in the new range.
| | columnCount | Int32 |
The number of columns in the new range.
|
| Type | Description |
|---|---|
| CellRange |
The resized cell range.
|
Use the Resize method to enlarge or reduce a cell range within a worksheet. This method always takes the range’s top left cell as its starting point. If the resulting range’s height or width is less than one cell or exceeds the maximum number of rows or columns in a worksheet, the Spreadsheet throws an InvalidOperationException.
The following example demonstrates how to extend selection within the Spreadsheet control by one row and one column:
CellRange selection = spreadsheetControl1.Selection;
selection.Resize(selection.RowCount + 1, selection.ColumnCount + 1).Select();
Dim selection As CellRange = spreadsheetControl1.Selection
selection.Resize(selection.RowCount + 1, selection.ColumnCount + 1).Select()
You can use the Resize method for a union range only if it meets the following requirements:
Its subranges start at the same column and have the same width (for example, “B2:D4, B7:D8”).
Its subranges start at the same row and have the same height (for example, “B2:C7, E2:E7”):
For other types of union ranges, the Resize method throws an InvalidOperationException.
See Also