Back to Devexpress

CellRange.RowCount Property

officefileapi-devexpress-dot-spreadsheet-dot-cellrange-e4630b6a.md

latest7.0 KB
Original Source

CellRange.RowCount Property

Gets the number of rows in the cell range.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
int RowCount { get; }
vb
ReadOnly Property RowCount As Integer

Property Value

TypeDescription
Int32

An integer that specifies the number of rows.

|

Remarks

To obtain the number of columns in the cell range, use the CellRange.ColumnCount property.

If the current cell range is a complex (union) range, the RowCount property returns the number of rows in the rectangular cell range that covers all areas of the union range. For example, the RowCount value for the union range B3:C4, D6:E7 shown in the image below is 5.

The following code snippets (auto-collected from DevExpress Examples) contain references to the RowCount 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.

winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L118

csharp
DefinedName invoiceItems = sheet.DefinedNames.GetDefinedName("InvoiceItems");
    btnRemoveRecord.Enabled = invoiceItems != null && invoiceItems.Range.RowCount > 1 && invoiceItems.Range.IsIntersecting(sheet.SelectedCell);
}

how-to-export-cell-range-to-a-datatable/CS/ExportToDataTableExample/Form1.cs#L38

csharp
int firstDataRowIndex = rangeHasHeaders ? 1 : 0;
int rowCount = range.RowCount;
if (firstDataRowIndex < rowCount) {

how-to-use-excel-add-ins-in-winforms-spreadsheet/CS/SpreadsheetAddIn/Form1.cs#L164

csharp
{
    int height = parameter.RowCount;
    int width = parameter.ColumnCount;

winforms-spreadsheetcontrol-api-part1/CS/SpreadsheetControl/SpreadsheetActions/CellActions.cs#L205

csharp
// Get the number of cells in the range.
int cellCount = sourceRange.RowCount * sourceRange.ColumnCount;

wpf-spreadsheetcontrol-api-part-1/CS/SpreadsheetControl_WPF_API/SpreadsheetActions/CellActions.cs#L158

csharp
// Get the number of cells in the range.
int cellCount = sourceRange.RowCount * sourceRange.ColumnCount;

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L109

vb
Dim invoiceItems As DefinedName = sheet.DefinedNames.GetDefinedName("InvoiceItems")
    btnRemoveRecord.Enabled = invoiceItems IsNot Nothing AndAlso invoiceItems.Range.RowCount > 1 AndAlso invoiceItems.Range.IsIntersecting(sheet.SelectedCell)
Else

how-to-export-cell-range-to-a-datatable/VB/ExportToDataTableExample/Form1.vb#L37

vb
Dim firstDataRowIndex As Integer = If(rangeHasHeaders, 1, 0)
Dim rowCount As Integer = range.RowCount
If firstDataRowIndex < rowCount Then

how-to-use-excel-add-ins-in-winforms-spreadsheet/VB/SpreadsheetAddIn/Form1.vb#L177

vb
Private Function ConvertRefParameter(ByVal parameter As DevExpress.Spreadsheet.CellRange) As Object(,)
    Dim height As Integer = parameter.RowCount
    Dim width As Integer = parameter.ColumnCount

winforms-spreadsheetcontrol-api-part1/VB/SpreadsheetControl/SpreadsheetActions/CellActions.vb#L191

vb
' Get the number of cells in the range.
Dim cellCount As Integer = sourceRange.RowCount * sourceRange.ColumnCount

wpf-spreadsheetcontrol-api-part-1/VB/SpreadsheetControl_WPF_API/SpreadsheetActions/CellActions.vb#L147

vb
' Get the number of cells in the range.
Dim cellCount As Integer = sourceRange.RowCount * sourceRange.ColumnCount

See Also

ColumnCount

TopRowIndex

BottomRowIndex

LeftColumnIndex

RightColumnIndex

Union(CellRange)

Union

How to: Access a Range of Cells

CellRange Interface

CellRange Members

DevExpress.Spreadsheet Namespace