New to Telerik Document Processing? Start a free 30-day trial

Cells

Class

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

Definition

Namespace:Telerik.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public class Cells : WorksheetEntityBase

Inheritance: objectWorksheetEntityBaseCells

Inherited Members WorksheetEntityBase.Worksheet

Properties

Gets the maximum number of columns in the worksheet.

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

The column count.

Gets the maximum number of rows in the worksheet.

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

The row count.

Gets the CellSelection with the specified start and end indices.

C#
public CellSelection this[CellIndex fromIndex, CellIndex toIndex] { get; }
Parameters:fromIndexCellIndextoIndexCellIndexProperty Value:

The cell selection.

Gets the CellSelection with the specified cell index.

C#
public CellSelection this[CellIndex cellIndex] { get; }
Parameters:cellIndexCellIndexProperty Value:

The cell selection.

Gets the CellSelection with the specified cell range.

C#
public CellSelection this[CellRange cellRange] { get; }
Parameters:cellRangeCellRangeProperty Value:

The cell selection.

Gets the CellSelection with the specified cell ranges.

C#
public CellSelection this[IEnumerable<CellRange> cellRanges] { get; }
Parameters:cellRangesIEnumerable<CellRange>Property Value:

The cell selection.

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

C#
public CellSelection this[int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex] { get; }
Parameters:fromRowIndexintfromColumnIndexinttoRowIndexinttoColumnIndexintProperty Value:

The cell selection.

Gets the CellSelection with the specified row and column indices.

C#
public CellSelection this[int rowIndex, int columnIndex] { get; }
Parameters:rowIndexintcolumnIndexintProperty Value:

The cell selection.

Methods

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

C#
public bool CanInsert(CellRange cellRange, InsertShiftType shiftType)
Parameters:cellRangeCellRange

The cell range.

shiftTypeInsertShiftType

Type of the shift.

Returns:

bool

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

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

C#
public bool CanInsert(int rowIndex, int columnIndex, int itemCount, InsertShiftType shiftType)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

itemCountint

The item count.

shiftTypeInsertShiftType

Type of the shift.

Returns:

bool

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

Gets cell selection.

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

Start index.

toIndexCellIndex

End index.

Returns:

CellSelection

The cell selection.

Gets cell selection.

C#
public CellSelection GetCellSelection(CellIndex cellIndex)
Parameters:cellIndexCellIndex

Index of the cell.

Returns:

CellSelection

The cell selection.

Gets cell selection.

C#
public CellSelection GetCellSelection(CellRange cellRange)
Parameters:cellRangeCellRange

The cell range.

Returns:

CellSelection

The cell selection.

Gets the cell selection.

C#
public CellSelection GetCellSelection(IEnumerable<CellRange> cellRanges)
Parameters:cellRangesIEnumerable<CellRange>

The cell ranges.

Returns:

CellSelection

The cell selection.

Gets cell selection.

C#
public CellSelection GetCellSelection(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.

Returns:

CellSelection

The cell selection.

Gets cell selection.

C#
public CellSelection GetCellSelection(int rowIndex, int columnIndex)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

Returns:

CellSelection

The cell selection.

Gets the merged ranges containing the specified cell range.

C#
public IEnumerable<CellRange> GetContainingMergedRanges(CellRange range)
Parameters:rangeCellRange

The range.

Returns:

IEnumerable<CellRange>

The merged ranges containing the specified cell range.

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

C#
public bool GetIsMerged(CellIndex cellIndex)
Parameters:cellIndexCellIndex

Index of the cell.

Returns:

bool

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

Gets the merged cell ranges.

C#
public IEnumerable<CellRange> GetMergedCellRanges()
Returns:

IEnumerable<CellRange>

The cell ranges.

Gets the merge state.

C#
public CellMergeState GetMergeState(CellIndex cellIndex)
Parameters:cellIndexCellIndex

Index of the cell.

Returns:

CellMergeState

The merge state.

Gets the merge state.

C#
public CellMergeState GetMergeState(int rowIndex, int columnIndex)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

Returns:

CellMergeState

The merge state.

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

C#
public bool Insert(CellRange cellRange, InsertShiftType shiftType)
Parameters:cellRangeCellRange

The cell range.

shiftTypeInsertShiftType

Type of the shift.

Returns:

bool

The value indicating whether the insertion was successful.

Inserts the specified number of items at the specified location.

C#
public bool Insert(int rowIndex, int columnIndex, int itemCount, InsertShiftType shiftType)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

itemCountint

The item count.

shiftTypeInsertShiftType

Type of the shift.

Returns:

bool

The value indicating whether the insertion was successful.

Raises the event.

C#
protected virtual void OnCellPropertyChanged(CellPropertyChangedEventArgs args)
Parameters:argsCellPropertyChangedEventArgs

The CellPropertyChangedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnCellRangeInsertedOrRemoved(CellRangeInsertedOrRemovedEventArgs args)
Parameters:argsCellRangeInsertedOrRemovedEventArgs

The CellRangeInsertedOrRemovedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnMergedCellsChanged(MergedCellRangesChangedEventArgs args)
Parameters:argsMergedCellRangesChangedEventArgs

The MergedCellRangesChangedEventArgs instance containing the event data.

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

C#
public void Remove(CellRange cellRange, RemoveShiftType shiftType)
Parameters:cellRangeCellRange

The cell range.

shiftTypeRemoveShiftType

Type of the shift.

Removes the specified number of items at the specified location.

C#
public void Remove(int rowIndex, int columnIndex, int itemCount, RemoveShiftType shiftType)
Parameters:rowIndexint

Index of the row.

columnIndexint

Index of the column.

itemCountint

The item count.

shiftTypeRemoveShiftType

Type of the shift.

Tries to get the merged range containing the index.

C#
public bool TryGetContainingMergedRange(CellIndex cellIndex, out CellRange mergedRange)
Parameters:cellIndexCellIndex

Index of the cell.

mergedRangeCellRange

The merged range.

Returns:

bool

The value indicating whether precisely a range was found.

Events

Occurs when a cell property is changed.

C#
public event EventHandler<CellPropertyChangedEventArgs> CellPropertyChanged

Occurs when a cell range is inserted or removed.

C#
public event EventHandler<CellRangeInsertedOrRemovedEventArgs> CellRangeInsertedOrRemoved

Occurs when merged cells are changed.

C#
public event EventHandler<MergedCellRangesChangedEventArgs> MergedCellsChanged