Class
CellSelection

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:

cs-api-definition
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.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

AddConditionalFormatting(ConditionalFormatting)

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

Declaration

cs-api-definition
public void AddConditionalFormatting(ConditionalFormatting formatting)

Parameters

formatting

ConditionalFormatting

The added conditional formatting

CanCopy(WorksheetFragment)

Determines whether the specified fragment can be copied.

Declaration

cs-api-definition
public bool CanCopy(WorksheetFragment fragment)

Parameters

fragment

WorksheetFragment

The fragment.

Returns

bool

The value indicating whether the specified fragment can be copied.

CanInsertOrRemove(CellRange, ShiftType)

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

Declaration

cs-api-definition
public bool CanInsertOrRemove(CellRange selectedRange, ShiftType shiftType)

Parameters

selectedRange

CellRange

The selected range.

shiftType

ShiftType

Type of the shift.

Returns

bool

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

CanPaste(WorksheetFragment)

Determines whether the specified fragment can be pasted.

Declaration

cs-api-definition
public PasteResult CanPaste(WorksheetFragment fragment)

Parameters

fragment

WorksheetFragment

The fragment.

Returns

PasteResult

The paste result.

ClearDataValidationRule()

Clears the data validation rule.

Declaration

cs-api-definition
public void ClearDataValidationRule()

ClearValue()

Clears the value.

Declaration

cs-api-definition
public void ClearValue()

Copy()

Copies this instance.

Declaration

cs-api-definition
public WorksheetFragment Copy()

Returns

WorksheetFragment

The worksheet fragment.

FillData(FillDirection)

Fills data.

Declaration

cs-api-definition
public void FillData(FillDirection direction)

Parameters

direction

FillDirection

The direction.

FillDataSeriesAuto(CellOrientation, bool, int?)

Does auto data series fill.

Declaration

cs-api-definition
public void FillDataSeriesAuto(CellOrientation seriesOrientation, bool respectRangesDirection, int? initialValueCount = null)

Parameters

seriesOrientation

CellOrientation

The series orientation.

respectRangesDirection

bool

The respect ranges direction.

initialValueCount

int?

The initial value count.

FillDataSeriesDate(CellOrientation, DateUnitType, double, double?)

Does date data series fill.

Declaration

cs-api-definition
public void FillDataSeriesDate(CellOrientation seriesOrientation, DateUnitType dateUnitType, double stepValue, double? stopValue = null)

Parameters

seriesOrientation

CellOrientation

The series orientation.

dateUnitType

DateUnitType

Type of the date unit.

stepValue

double

The step value.

stopValue

double?

The stop value.

FillDataSeriesExponential(CellOrientation, double, double?)

Does exponential data series fill.

Declaration

cs-api-definition
public void FillDataSeriesExponential(CellOrientation seriesOrientation, double stepValue, double? stopValue = null)

Parameters

seriesOrientation

CellOrientation

The series orientation.

stepValue

double

The step value.

stopValue

double?

The stop value.

FillDataSeriesExponentialTrend(CellOrientation)

Does exponential and trend data series fill.

Declaration

cs-api-definition
public void FillDataSeriesExponentialTrend(CellOrientation seriesOrientation)

Parameters

seriesOrientation

CellOrientation

The series orientation.

FillDataSeriesLinear(CellOrientation, double, double?)

Does linear data series fill.

Declaration

cs-api-definition
public void FillDataSeriesLinear(CellOrientation seriesOrientation, double stepValue, double? stopValue = null)

Parameters

seriesOrientation

CellOrientation

The series orientation.

stepValue

double

The step value.

stopValue

double?

The stop value.

FillDataSeriesLinearTrend(CellOrientation)

Does trend data series fill.

Declaration

cs-api-definition
public void FillDataSeriesLinearTrend(CellOrientation seriesOrientation)

Parameters

seriesOrientation

CellOrientation

The series orientation.

Filter(params IFilter[])

Sets the specified filters to the cell selection.

Declaration

cs-api-definition
public void Filter(params IFilter[] filters)

Parameters

filters

IFilter[]

The filters.

GetConditionalFormattings()

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

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Formattings")]
public IEnumerable<ConditionalFormattingRange> GetConditionalFormattings()

Returns

IEnumerable<ConditionalFormattingRange>

GetDataValidationRule()

Gets the data validation rule.

Declaration

cs-api-definition
public RangePropertyValue<IDataValidationRule> GetDataValidationRule()

Returns

RangePropertyValue<IDataValidationRule>

GetValue()

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

Declaration

cs-api-definition
public RangePropertyValue<ICellValue> GetValue()

Returns

RangePropertyValue<ICellValue>

Returns the value of the selection.

Insert(InsertShiftType)

Inserts this instance using the specified shift type.

Declaration

cs-api-definition
public void Insert(InsertShiftType shiftType)

Parameters

shiftType

InsertShiftType

Type of the shift.

Merge()

Merges this instance.

Declaration

cs-api-definition
public bool Merge()

Returns

bool

The value indicating whether the merge was successful.

MergeAcross()

Merges the instance across.

Declaration

cs-api-definition
public bool MergeAcross()

Returns

bool

The value indicating whether the merge was successful.

Paste(WorksheetFragment, PasteOptions)

Pastes the specified fragment.

Declaration

cs-api-definition
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions)

Parameters

fragment

WorksheetFragment

The fragment.

pasteOptions

PasteOptions

The paste options.

Returns

bool

The value indicating whether the paste was successful.

Paste(WorksheetFragment, PasteOptions, out IEnumerable<CellRange>, out IEnumerable<FloatingShapeBase>)

Pastes the specified fragment.

Declaration

cs-api-definition
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions, out IEnumerable<CellRange> affectedCellRanges, out IEnumerable<FloatingShapeBase> newShapes)

Parameters

fragment

WorksheetFragment

The fragment.

pasteOptions

PasteOptions

The paste options.

affectedCellRanges

IEnumerable<CellRange>

The affected cell ranges.

newShapes

IEnumerable<FloatingShapeBase>

The new shapes.

Returns

bool

The value indicating whether the paste was successful.

Paste(WorksheetFragment, PasteOptions, out IEnumerable<FloatingShapeBase>)

Pastes the specified fragment.

Declaration

cs-api-definition
public bool Paste(WorksheetFragment fragment, PasteOptions pasteOptions, out IEnumerable<FloatingShapeBase> newShapes)

Parameters

fragment

WorksheetFragment

The fragment.

pasteOptions

PasteOptions

The paste options.

newShapes

IEnumerable<FloatingShapeBase>

The new shapes.

Returns

bool

Remove(RemoveShiftType)

Removes the instance using the specified shift type.

Declaration

cs-api-definition
public void Remove(RemoveShiftType shiftType)

Parameters

shiftType

RemoveShiftType

Type of the shift.

RemoveConditionalFormatting(ConditionalFormatting)

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

Declaration

cs-api-definition
public void RemoveConditionalFormatting(ConditionalFormatting formatting)

Parameters

formatting

ConditionalFormatting

SetBorders(CellBorders)

Sets the borders.

Declaration

cs-api-definition
public override void SetBorders(CellBorders value)

Parameters

value

CellBorders

The value.

Overrides SelectionBase.SetBorders(CellBorders)

SetDataValidationRule(IDataValidationRule)

Sets the data validation rule.

Declaration

cs-api-definition
public void SetDataValidationRule(IDataValidationRule value)

Parameters

value

IDataValidationRule

The value.

SetValue(DateTime)

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

Declaration

cs-api-definition
public void SetValue(DateTime value)

Parameters

value

DateTime

The value.

SetValue(ICellValue)

Sets the value.

Declaration

cs-api-definition
public void SetValue(ICellValue value)

Parameters

value

ICellValue

The value.

SetValue(bool)

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

Declaration

cs-api-definition
public void SetValue(bool value)

Parameters

value

bool

The value.

SetValue(double)

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

Declaration

cs-api-definition
public void SetValue(double value)

Parameters

value

double

The value.

SetValue(string)

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

Declaration

cs-api-definition
public void SetValue(string value)

Parameters

value

string

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.

SetValueAsFormula(string)

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

Declaration

cs-api-definition
public void SetValueAsFormula(string value)

Parameters

value

string

The value.

SetValueAsText(string)

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

Declaration

cs-api-definition
public void SetValueAsText(string value)

Parameters

value

string

The value.

Sort(params ISortCondition[])

Sorts the selected cells using the specified sort conditions.

Declaration

cs-api-definition
public void Sort(params ISortCondition[] sortConditions)

Parameters

sortConditions

ISortCondition[]

The sort conditions.

Unmerge()

Unmerges this instance.

Declaration

cs-api-definition
public void Unmerge()