Class
Cells

Provides access to the cells in a worksheet, managing their values, formatting, data validation, and merged ranges with sparse storage.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public class Cells : WorksheetEntityBase

Inheritance: objectWorksheetEntityBaseCells

Inherited Members WorksheetEntityBase.Worksheet

Properties

ColumnCount

Gets the maximum number of columns in the worksheet.

Declaration

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

Property Value

int

The column count.

RowCount

Gets the maximum number of rows in the worksheet.

Declaration

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

Property Value

int

The row count.

this[CellIndex, CellIndex]

Gets the CellSelection with the specified start and end indices.

Declaration

cs-api-definition
public CellSelection this[CellIndex fromIndex, CellIndex toIndex] { get; }

Parameters

fromIndex

CellIndex

toIndex

CellIndex

Property Value

CellSelection

The cell selection.

this[CellIndex]

Gets the CellSelection with the specified cell index.

Declaration

cs-api-definition
public CellSelection this[CellIndex cellIndex] { get; }

Parameters

cellIndex

CellIndex

Property Value

CellSelection

The cell selection.

this[CellRange]

Gets the CellSelection with the specified cell range.

Declaration

cs-api-definition
public CellSelection this[CellRange cellRange] { get; }

Parameters

cellRange

CellRange

Property Value

CellSelection

The cell selection.

this[IEnumerable<CellRange>]

Gets the CellSelection with the specified cell ranges.

Declaration

cs-api-definition
public CellSelection this[IEnumerable<CellRange> cellRanges] { get; }

Parameters

cellRanges

IEnumerable<CellRange>

Property Value

CellSelection

The cell selection.

this[int, int, int, int]

Gets the CellSelection with the specified start row index, start column index, end row index and end column index.

Declaration

cs-api-definition
public CellSelection this[int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex] { get; }

Parameters

fromRowIndex

int

fromColumnIndex

int

toRowIndex

int

toColumnIndex

int

Property Value

CellSelection

The cell selection.

this[int, int]

Gets the CellSelection with the specified row and column indices.

Declaration

cs-api-definition
public CellSelection this[int rowIndex, int columnIndex] { get; }

Parameters

rowIndex

int

columnIndex

int

Property Value

CellSelection

The cell selection.

Methods

CanInsert(CellRange, InsertShiftType)

Determines whether cells can be inserted at the specified cell range.

Declaration

cs-api-definition
public bool CanInsert(CellRange cellRange, InsertShiftType shiftType)

Parameters

cellRange

CellRange

The cell range.

shiftType

InsertShiftType

Type of the shift.

Returns

bool

The value indicating whether cells can be inserted at the specified cell range.

CanInsert(int, int, int, InsertShiftType)

Checks whether cells can be inserted starting at the specified position without violating constraints like merged ranges or filters.

Declaration

cs-api-definition
public bool CanInsert(int rowIndex, int columnIndex, int itemCount, InsertShiftType shiftType)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

itemCount

int

The item count.

shiftType

InsertShiftType

Type of the shift.

Returns

bool

The value indicating whether cells can be inserted at the specified row index.

GetCellSelection(CellIndex)

Gets cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(CellIndex cellIndex)

Parameters

cellIndex

CellIndex

Index of the cell.

Returns

CellSelection

The cell selection.

GetCellSelection(CellIndex, CellIndex)

Gets cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(CellIndex fromIndex, CellIndex toIndex)

Parameters

fromIndex

CellIndex

Start index.

toIndex

CellIndex

End index.

Returns

CellSelection

The cell selection.

GetCellSelection(CellRange)

Gets cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(CellRange cellRange)

Parameters

cellRange

CellRange

The cell range.

Returns

CellSelection

The cell selection.

GetCellSelection(IEnumerable<CellRange>)

Gets the cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(IEnumerable<CellRange> cellRanges)

Parameters

cellRanges

IEnumerable<CellRange>

The cell ranges.

Returns

CellSelection

The cell selection.

GetCellSelection(int, int)

Gets cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(int rowIndex, int columnIndex)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

Returns

CellSelection

The cell selection.

GetCellSelection(int, int, int, int)

Gets cell selection.

Declaration

cs-api-definition
public CellSelection GetCellSelection(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.

Returns

CellSelection

The cell selection.

GetContainingMergedRanges(CellRange)

Gets the merged ranges containing the specified cell range.

Declaration

cs-api-definition
public IEnumerable<CellRange> GetContainingMergedRanges(CellRange range)

Parameters

range

CellRange

The range.

Returns

IEnumerable<CellRange>

The merged ranges containing the specified cell range.

GetIsMerged(CellIndex)

Gets the value indicating whether the cell index is contained in a merged range.

Declaration

cs-api-definition
public bool GetIsMerged(CellIndex cellIndex)

Parameters

cellIndex

CellIndex

Index of the cell.

Returns

bool

The value indicating whether the cell index is contained in a merged range.

GetMergeState(CellIndex)

Gets the merge state.

Declaration

cs-api-definition
public CellMergeState GetMergeState(CellIndex cellIndex)

Parameters

cellIndex

CellIndex

Index of the cell.

Returns

CellMergeState

The merge state.

GetMergeState(int, int)

Gets the merge state.

Declaration

cs-api-definition
public CellMergeState GetMergeState(int rowIndex, int columnIndex)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

Returns

CellMergeState

The merge state.

GetMergedCellRanges()

Gets the merged cell ranges.

Declaration

cs-api-definition
public IEnumerable<CellRange> GetMergedCellRanges()

Returns

IEnumerable<CellRange>

The cell ranges.

Insert(CellRange, InsertShiftType)

Inserts empty cells at the specified range, shifting existing cells down or right, and returns whether the operation succeeded.

Declaration

cs-api-definition
public bool Insert(CellRange cellRange, InsertShiftType shiftType)

Parameters

cellRange

CellRange

The cell range.

shiftType

InsertShiftType

Type of the shift.

Returns

bool

The value indicating whether the insertion was successful.

Insert(int, int, int, InsertShiftType)

Inserts the specified number of items at the specified location.

Declaration

cs-api-definition
public bool Insert(int rowIndex, int columnIndex, int itemCount, InsertShiftType shiftType)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

itemCount

int

The item count.

shiftType

InsertShiftType

Type of the shift.

Returns

bool

The value indicating whether the insertion was successful.

OnCellPropertyChanged(CellPropertyChangedEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnCellPropertyChanged(CellPropertyChangedEventArgs args)

Parameters

args

CellPropertyChangedEventArgs

The CellPropertyChangedEventArgs instance containing the event data.

OnCellRangeInsertedOrRemoved(CellRangeInsertedOrRemovedEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnCellRangeInsertedOrRemoved(CellRangeInsertedOrRemovedEventArgs args)

Parameters

args

CellRangeInsertedOrRemovedEventArgs

The CellRangeInsertedOrRemovedEventArgs instance containing the event data.

OnMergedCellsChanged(MergedCellRangesChangedEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnMergedCellsChanged(MergedCellRangesChangedEventArgs args)

Parameters

args

MergedCellRangesChangedEventArgs

The MergedCellRangesChangedEventArgs instance containing the event data.

Remove(CellRange, RemoveShiftType)

Removes cells at the specified range and shifts remaining cells up or left to fill the gap.

Declaration

cs-api-definition
public void Remove(CellRange cellRange, RemoveShiftType shiftType)

Parameters

cellRange

CellRange

The cell range.

shiftType

RemoveShiftType

Type of the shift.

Remove(int, int, int, RemoveShiftType)

Removes the specified number of items at the specified location.

Declaration

cs-api-definition
public void Remove(int rowIndex, int columnIndex, int itemCount, RemoveShiftType shiftType)

Parameters

rowIndex

int

Index of the row.

columnIndex

int

Index of the column.

itemCount

int

The item count.

shiftType

RemoveShiftType

Type of the shift.

TryGetContainingMergedRange(CellIndex, out CellRange)

Tries to get the merged range containing the index.

Declaration

cs-api-definition
public bool TryGetContainingMergedRange(CellIndex cellIndex, out CellRange mergedRange)

Parameters

cellIndex

CellIndex

Index of the cell.

mergedRange

CellRange

The merged range.

Returns

bool

The value indicating whether precisely a range was found.

Events

CellPropertyChanged

Occurs when a cell property is changed.

Declaration

cs-api-definition
public event EventHandler<CellPropertyChangedEventArgs> CellPropertyChanged

Event Value

EventHandler<CellPropertyChangedEventArgs>

CellRangeInsertedOrRemoved

Occurs when a cell range is inserted or removed.

Declaration

cs-api-definition
public event EventHandler<CellRangeInsertedOrRemovedEventArgs> CellRangeInsertedOrRemoved

Event Value

EventHandler<CellRangeInsertedOrRemovedEventArgs>

MergedCellsChanged

Occurs when merged cells are changed.

Declaration

cs-api-definition
public event EventHandler<MergedCellRangesChangedEventArgs> MergedCellsChanged

Event Value

EventHandler<MergedCellRangesChangedEventArgs>