Class
CellRange

Defines a rectangular selection of cells within a worksheet, bounded by row and column indices, supporting operations like offset, intersection, and containment checks.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public class CellRange

Inheritance: objectCellRange

Constructors

CellRange(CellIndex, CellIndex)

Initializes a new instance of the CellRange class.

Declaration

cs-api-definition
public CellRange(CellIndex fromIndex, CellIndex toIndex)

Parameters

fromIndex

CellIndex

Start index.

toIndex

CellIndex

End index.

CellRange(int, int, int, int)

Initializes a new instance of the CellRange class.

Declaration

cs-api-definition
public CellRange(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)

Parameters

fromRowIndex

int

Start row index.

fromColumnIndex

int

Start column index.

toRowIndex

int

End row index.

toColumnIndex

int

End column index.

Fields

Empty

A single-cell empty range at position (0,0).

Declaration

cs-api-definition
public static readonly CellRange Empty

Field Value

CellRange

Properties

ColumnCount

Gets the number of columns spanned by the range.

Declaration

cs-api-definition
public int ColumnCount { get; }

Property Value

int

The column count.

FromIndex

Gets the top-left cell index of the range.

Declaration

cs-api-definition
public CellIndex FromIndex { get; }

Property Value

CellIndex

The start index.

IsSingleCell

Gets whether the range contains exactly one cell (1 row × 1 column).

Declaration

cs-api-definition
public bool IsSingleCell { get; }

Property Value

bool

The value indicating if the cell range is single cell range.

RowCount

Gets the number of rows spanned by the range.

Declaration

cs-api-definition
public int RowCount { get; }

Property Value

int

The row count.

ToIndex

Gets the bottom-right cell index of the range.

Declaration

cs-api-definition
public CellIndex ToIndex { get; }

Property Value

CellIndex

The end index.

Methods

Contains(CellIndex)

Checks whether the range includes the specified cell index.

Declaration

cs-api-definition
public bool Contains(CellIndex index)

Parameters

index

CellIndex

The index.

Returns

bool

The value indicating whether the range contains the specified index.

Contains(CellRange)

Checks whether this range fully contains the specified cell range.

Declaration

cs-api-definition
public bool Contains(CellRange cellRange)

Parameters

cellRange

CellRange

The cell range.

Returns

bool

The value indicating whether the range contains the specified range.

Contains(int, int)

Checks whether the range includes the cell at the specified row and column.

Declaration

cs-api-definition
public bool Contains(int rowIndex, int columnIndex)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

Returns

bool

The value indicating whether the range contains the specified index.

Equals(object)

Determines whether the specified object is equal to the current object.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

The object to compare with the current object.

Returns

bool

True if the specified object is equal to the current object; otherwise, false.

Overrides object.Equals(object)

FromColumn(int)

Creates a range spanning all rows in the specified column.

Declaration

cs-api-definition
public static CellRange FromColumn(int columnIndex)

Parameters

columnIndex

int

Index of the column.

Returns

CellRange

The cell range of the specified column.

FromColumnRange(int, int)

Creates a cell range of a range of columns.

Declaration

cs-api-definition
public static CellRange FromColumnRange(int fromColumnIndex, int toColumnIndex)

Parameters

fromColumnIndex

int

Start column.

toColumnIndex

int

End column.

Returns

CellRange

The cell range.

FromRow(int)

Creates a range spanning all columns in the specified row.

Declaration

cs-api-definition
public static CellRange FromRow(int rowIndex)

Parameters

rowIndex

int

Index of the row.

Returns

CellRange

The cell range of the specified row.

FromRowRange(int, int)

Creates a cell range of a range of rows.

Declaration

cs-api-definition
public static CellRange FromRowRange(int fromRowIndex, int toRowIndex)

Parameters

fromRowIndex

int

Start row.

toRowIndex

int

End row.

Returns

CellRange

The cell range.

GetFirstColumn()

Gets the first column.

Declaration

cs-api-definition
public CellRange GetFirstColumn()

Returns

CellRange

The cell range of the first column.

GetFirstRow()

Gets the first row.

Declaration

cs-api-definition
public CellRange GetFirstRow()

Returns

CellRange

The cell range of the first row.

GetHashCode()

Serves as a hash function for a particular type.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code for the current object.

Overrides object.GetHashCode()

GetLastColumn()

Gets the last column.

Declaration

cs-api-definition
public CellRange GetLastColumn()

Returns

CellRange

The cell range of the last column.

GetLastRow()

Gets the last row.

Declaration

cs-api-definition
public CellRange GetLastRow()

Returns

CellRange

The cell range of the last row.

Intersect(CellRange)

Computes the overlapping region between this range and another, or returns Empty if no overlap.

Declaration

cs-api-definition
public CellRange Intersect(CellRange other)

Parameters

other

CellRange

The other cell range.

Returns

CellRange

The intersection.

IntersectsWith(CellRange)

Checks whether this range overlaps with another cell range.

Declaration

cs-api-definition
public bool IntersectsWith(CellRange other)

Parameters

other

CellRange

The other cell range.

Returns

bool

The value indicating whether the present instance intersects with another cell range.

Offset(int, int)

Creates a new range by shifting this range by the specified row and column offsets, or returns null if out of bounds.

Declaration

cs-api-definition
public CellRange Offset(int rowOffset, int columnOffset)

Parameters

rowOffset

int

The row offset.

columnOffset

int

The column offset.

Returns

CellRange

The created cell range.

ToString()

Returns a string that represents the current object.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string that represents the current object.

Overrides object.ToString()