New to Telerik Document ProcessingStart a free 30-day trial

Provides operations on a selection of one or more cell ranges, enabling batch setting of values, formatting, formulas, and data validation.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public class CellSelection : SelectionBase

Inheritance: objectSelectionBaseCellSelection

Inherited Members SelectionBase.BeginUpdate()SelectionBase.EndUpdate()SelectionBase.ExecuteForEachRangeInsideBeginEndUpdate(Action<CellRange>)SelectionBase.ExecuteForEachRangeInsideBeginEndUpdate(IEnumerable<CellRange>, Action<CellRange>, Predicate<CellRange>)SelectionBase.ExecuteForEachRange(Action<CellRange>)SelectionBase.ExecuteForEachRange(IEnumerable<CellRange>, Action<CellRange>, Predicate<CellRange>)SelectionBase.GetPropertyValue<T>(Func<CellRange, RangePropertyValue<T>>, IEnumerable<CellRange>, T)SelectionBase.GetTopLeftCellIndex()SelectionBase.Clear(ClearType)SelectionBase.GetFormat()SelectionBase.SetFormat(CellValueFormat)SelectionBase.ClearFormat()SelectionBase.GetStyleName()SelectionBase.SetStyleName(string)SelectionBase.ClearStyleName()SelectionBase.GetFill()SelectionBase.SetFill(IFill)SelectionBase.ClearFill()SelectionBase.GetFontFamily()SelectionBase.SetFontFamily(ThemableFontFamily)SelectionBase.ClearFontFamily()SelectionBase.GetFontSize()SelectionBase.SetFontSize(double)SelectionBase.ClearFontSize()SelectionBase.GetIsBold()SelectionBase.SetIsBold(bool)SelectionBase.ClearIsBold()SelectionBase.GetIsItalic()SelectionBase.SetIsItalic(bool)SelectionBase.ClearIsItalic()SelectionBase.GetIsStrikethrough()SelectionBase.SetIsStrikethrough(bool)SelectionBase.ClearIsStrikethrough()SelectionBase.GetVerticalTextAlignment()SelectionBase.SetVerticalTextAlignment(VerticalTextAlignment)SelectionBase.ClearVerticalTextAlignment()SelectionBase.GetUnderline()SelectionBase.SetUnderline(UnderlineType)SelectionBase.ClearUnderline()SelectionBase.GetForeColor()SelectionBase.SetForeColor(ThemableColor)SelectionBase.ClearForeColor()SelectionBase.GetHorizontalAlignment()SelectionBase.SetHorizontalAlignment(RadHorizontalAlignment)SelectionBase.ClearHorizontalAlignment()SelectionBase.GetVerticalAlignment()SelectionBase.SetVerticalAlignment(RadVerticalAlignment)SelectionBase.ClearVerticalAlignment()SelectionBase.GetIndent()SelectionBase.SetIndent(int)SelectionBase.ClearIndent()SelectionBase.IncreaseIndent()SelectionBase.DecreaseIndent()SelectionBase.GetIsWrapped()SelectionBase.SetIsWrapped(bool)SelectionBase.ClearIsWrapped()SelectionBase.GetTextRotation()SelectionBase.SetTextRotation(int)SelectionBase.ClearTextRotation()SelectionBase.GetBorders()SelectionBase.ClearBorders()SelectionBase.GetIsLocked()SelectionBase.SetIsLocked(bool)SelectionBase.ClearIsLocked()SelectionBase.CellRangesSelectionBase.Worksheet...

Methods

Adds a conditional formatting elemenet to the worksheet, applying it on the current selection ranges.

C#
public void AddConditionalFormatting(ConditionalFormatting formatting)
Parameters:formattingConditionalFormatting

The added conditional formatting

Determines whether the specified fragment can be copied.

C#
public bool CanCopy(WorksheetFragment fragment)
Parameters:fragmentWorksheetFragment

The fragment.

Returns:

bool

The value indicating whether the specified fragment can be copied.

Determines whether the selected range can be inserted or removed using the specified shift type.

C#
public bool CanInsertOrRemove(CellRange selectedRange, ShiftType shiftType)
Parameters:selectedRangeCellRange

The selected range.

shiftTypeShiftType

Type of the shift.

Returns:

bool

The value indicating whether the selected range can be inserted or removed using the specified shift type.

Determines whether the specified fragment can be pasted.

C#
public PasteResult CanPaste(WorksheetFragment fragment)
Parameters:fragmentWorksheetFragment

The fragment.

Returns:

PasteResult

The paste result.

Clears the data validation rule.

C#
public void ClearDataValidationRule()

Clears the value.

C#
public void ClearValue()

Copies this instance.

C#
public WorksheetFragment Copy()
Returns:

WorksheetFragment

The worksheet fragment.

Fills data.

C#
public void FillData(FillDirection direction)
Parameters:directionFillDirection

The direction.

Does auto data series fill.

C#
public void FillDataSeriesAuto(CellOrientation seriesOrientation, bool respectRangesDirection, int? initialValueCount = null)
Parameters:seriesOrientationCellOrientation

The series orientation.

respectRangesDirectionbool

The respect ranges direction.

initialValueCountint?

The initial value count.

Does date data series fill.

C#
public void FillDataSeriesDate(CellOrientation seriesOrientation, DateUnitType dateUnitType, double stepValue, double? stopValue = null)
Parameters:seriesOrientationCellOrientation

The series orientation.

dateUnitTypeDateUnitType

Type of the date unit.

stepValuedouble

The step value.

stopValuedouble?

The stop value.

Does exponential data series fill.

C#
public void FillDataSeriesExponential(CellOrientation seriesOrientation, double stepValue, double? stopValue = null)
Parameters:seriesOrientationCellOrientation

The series orientation.

stepValuedouble

The step value.

stopValuedouble?

The stop value.

Does exponential and trend data series fill.

C#
public void FillDataSeriesExponentialTrend(CellOrientation seriesOrientation)
Parameters:seriesOrientationCellOrientation

The series orientation.

Does linear data series fill.

C#
public void FillDataSeriesLinear(CellOrientation seriesOrientation, double stepValue, double? stopValue = null)
Parameters:seriesOrientationCellOrientation

The series orientation.

stepValuedouble

The step value.

stopValuedouble?

The stop value.

Does trend data series fill.

C#
public void FillDataSeriesLinearTrend(CellOrientation seriesOrientation)
Parameters:seriesOrientationCellOrientation

The series orientation.

Sets the specified filters to the cell selection.

C#
public void Filter(params IFilter[] filters)
Parameters:filtersIFilter[]

The filters.

Gets the conditional formatting elemenets that are active in the current selection.

C#
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Formattings")]
public IEnumerable<ConditionalFormattingRange> GetConditionalFormattings()
Returns:

IEnumerable<ConditionalFormattingRange>

Gets the data validation rule.

C#
public RangePropertyValue<IDataValidationRule> GetDataValidationRule()
Returns:

RangePropertyValue<IDataValidationRule>

Retrieves the cell value(s) from the selection, returning a single value if uniform or an indeterminate result if mixed.

C#
public RangePropertyValue<ICellValue> GetValue()
Returns:

RangePropertyValue<ICellValue>

Returns the value of the selection.

Inserts this instance using the specified shift type.

C#
public void Insert(InsertShiftType shiftType)
Parameters:shiftTypeInsertShiftType

Type of the shift.

Merges this instance.

C#
public bool Merge()
Returns:

bool

The value indicating whether the merge was successful.

Merges the instance across.

C#
public bool MergeAcross()
Returns:

bool

The value indicating whether the merge was successful.

Pastes the specified fragment.

C#
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions, out IEnumerable<CellRange> affectedCellRanges, out IEnumerable<FloatingShapeBase> newShapes)
Parameters:fragmentWorksheetFragment

The fragment.

pasteOptionsPasteOptions

The paste options.

affectedCellRangesIEnumerable<CellRange>

The affected cell ranges.

newShapesIEnumerable<FloatingShapeBase>

The new shapes.

Returns:

bool

The value indicating whether the paste was successful.

Pastes the specified fragment.

C#
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions, out IEnumerable<FloatingShapeBase> newShapes)
Parameters:fragmentWorksheetFragment

The fragment.

pasteOptionsPasteOptions

The paste options.

newShapesIEnumerable<FloatingShapeBase>

The new shapes.

Returns:

bool

Pastes the specified fragment.

C#
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions)
Parameters:fragmentWorksheetFragment

The fragment.

pasteOptionsPasteOptions

The paste options.

Returns:

bool

The value indicating whether the paste was successful.

Removes the instance using the specified shift type.

C#
public void Remove(RemoveShiftType shiftType)
Parameters:shiftTypeRemoveShiftType

Type of the shift.

Removes the a given formatting elemenets that is active in the current selection.

C#
public void RemoveConditionalFormatting(ConditionalFormatting formatting)
Parameters:formattingConditionalFormatting

Sets the borders.

C#
public override void SetBorders(CellBorders value)
Parameters:valueCellBorders

The value.

Overrides: SelectionBase.SetBorders(CellBorders)

Sets the data validation rule.

C#
public void SetDataValidationRule(IDataValidationRule value)
Parameters:valueIDataValidationRule

The value.

Sets all cells in the selection to the specified boolean value.

C#
public void SetValue(bool value)
Parameters:valuebool

The value.

Sets all cells in the selection to the specified date-time value and applies short date formatting if the cell format is default.

C#
public void SetValue(DateTime value)
Parameters:valueDateTime

The value.

Sets all cells in the selection to the specified numeric value.

C#
public void SetValue(double value)
Parameters:valuedouble

The value.

Sets the value.

C#
public void SetValue(ICellValue value)
Parameters:valueICellValue

The value.

Parses and sets the string value for all cells in the selection; prefer typed overloads for better performance.

C#
public void SetValue(string value)
Parameters:valuestring

The value.

Remarks:

Please note that the string value is parsed to find its type. This process is slow. If you know the type of your data use the other overloads of this method.

Sets all cells in the selection to the specified formula string, which will calculate dynamically.

C#
public void SetValueAsFormula(string value)
Parameters:valuestring

The value.

Sets all cells in the selection to the specified value as literal text, bypassing number and formula parsing.

C#
public void SetValueAsText(string value)
Parameters:valuestring

The value.

Sorts the selected cells using the specified sort conditions.

C#
public void Sort(params ISortCondition[] sortConditions)
Parameters:sortConditionsISortCondition[]

The sort conditions.

Unmerges this instance.

C#
public void Unmerge()