New to Telerik Document ProcessingStart a free 30-day trial

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:

C#
public class CellRange

Inheritance: objectCellRange

Constructors

Initializes a new instance of the CellRange class.

C#
public CellRange(CellIndex fromIndex, CellIndex toIndex)
Parameters:fromIndexCellIndex

Start index.

toIndexCellIndex

End index.

Initializes a new instance of the CellRange class.

C#
public CellRange(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)
Parameters:fromRowIndexint

Start row index.

fromColumnIndexint

Start column index.

toRowIndexint

End row index.

toColumnIndexint

End column index.

Fields

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

C#
public static readonly CellRange Empty

Methods

Checks whether the range includes the specified cell index.

C#
public bool Contains(CellIndex index)
Parameters:indexCellIndex

The index.

Returns:

bool

The value indicating whether the range contains the specified index.

Checks whether this range fully contains the specified cell range.

C#
public bool Contains(CellRange cellRange)
Parameters:cellRangeCellRange

The cell range.

Returns:

bool

The value indicating whether the range contains the specified range.

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

C#
public bool Contains(int rowIndex, int columnIndex)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

Returns:

bool

The value indicating whether the range contains the specified index.

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

C#
public override bool Equals(object obj)
Parameters:objobject

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)

Creates a range spanning all rows in the specified column.

C#
public static CellRange FromColumn(int columnIndex)
Parameters:columnIndexint

Index of the column.

Returns:

CellRange

The cell range of the specified column.

Creates a cell range of a range of columns.

C#
public static CellRange FromColumnRange(int fromColumnIndex, int toColumnIndex)
Parameters:fromColumnIndexint

Start column.

toColumnIndexint

End column.

Returns:

CellRange

The cell range.

Creates a range spanning all columns in the specified row.

C#
public static CellRange FromRow(int rowIndex)
Parameters:rowIndexint

Index of the row.

Returns:

CellRange

The cell range of the specified row.

Creates a cell range of a range of rows.

C#
public static CellRange FromRowRange(int fromRowIndex, int toRowIndex)
Parameters:fromRowIndexint

Start row.

toRowIndexint

End row.

Returns:

CellRange

The cell range.

Gets the first column.

C#
public CellRange GetFirstColumn()
Returns:

CellRange

The cell range of the first column.

Gets the first row.

C#
public CellRange GetFirstRow()
Returns:

CellRange

The cell range of the first row.

Serves as a hash function for a particular type.

C#
public override int GetHashCode()
Returns:

int

A hash code for the current object.

Overrides: object.GetHashCode()

Gets the last column.

C#
public CellRange GetLastColumn()
Returns:

CellRange

The cell range of the last column.

Gets the last row.

C#
public CellRange GetLastRow()
Returns:

CellRange

The cell range of the last row.

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

C#
public CellRange Intersect(CellRange other)
Parameters:otherCellRange

The other cell range.

Returns:

CellRange

The intersection.

Checks whether this range overlaps with another cell range.

C#
public bool IntersectsWith(CellRange other)
Parameters:otherCellRange

The other cell range.

Returns:

bool

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

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

C#
public CellRange Offset(int rowOffset, int columnOffset)
Parameters:rowOffsetint

The row offset.

columnOffsetint

The column offset.

Returns:

CellRange

The created cell range.

Returns a string that represents the current object.

C#
public override string ToString()
Returns:

string

A string that represents the current object.

Overrides: object.ToString()

Properties

Gets the number of columns spanned by the range.

C#
public int ColumnCount { get; }
Property Value:

The column count.

Gets the top-left cell index of the range.

C#
public CellIndex FromIndex { get; }
Property Value:

The start index.

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

C#
public bool IsSingleCell { get; }
Property Value:

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

Gets the number of rows spanned by the range.

C#
public int RowCount { get; }
Property Value:

The row count.

Gets the bottom-right cell index of the range.

C#
public CellIndex ToIndex { get; }
Property Value:

The end index.