Class
SelectionBase

Abstract base for range-based selections in worksheets, providing property access and modification methods for formatting, borders, and values across one or more cell ranges.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public abstract class SelectionBase

Inheritance: objectSelectionBase

Derived Classes: CellSelectionRowColumnSelectionBase

Properties

CellRanges

The collection of cell ranges included in this selection.

Declaration

cs-api-definition
public IEnumerable<CellRange> CellRanges { get; }

Property Value

IEnumerable<CellRange>

The cell ranges.

Worksheet

The worksheet containing this selection.

Declaration

cs-api-definition
public Worksheet Worksheet { get; }

Property Value

Worksheet

The worksheet.

Methods

BeginUpdate()

Suspends layout recalculation and starts an undo group, enabling efficient batch modifications across the selection.

Declaration

cs-api-definition
protected void BeginUpdate()

Clear(ClearType)

Clears content, formatting, or both from the selection based on the specified clear type.

Declaration

cs-api-definition
public void Clear(ClearType type)

Parameters

type

ClearType

The type of clear.

ClearBorders()

Removes all borders from the selection, including outer, inner, and diagonal borders.

Declaration

cs-api-definition
public void ClearBorders()

ClearFill()

Removes the background fill from the selection, reverting to no fill.

Declaration

cs-api-definition
public void ClearFill()

ClearFontFamily()

Removes the font family from the selection, reverting to the default font.

Declaration

cs-api-definition
public void ClearFontFamily()

ClearFontSize()

Removes the font size from the selection, reverting to the default size.

Declaration

cs-api-definition
public void ClearFontSize()

ClearForeColor()

Removes the text color from the selection, reverting to the default color.

Declaration

cs-api-definition
public void ClearForeColor()

ClearFormat()

Removes the number format from the selection, reverting to the default format.

Declaration

cs-api-definition
public void ClearFormat()

ClearHorizontalAlignment()

Removes the horizontal alignment from the selection, reverting to the default alignment.

Declaration

cs-api-definition
public void ClearHorizontalAlignment()

ClearIndent()

Removes the indentation from the selection, reverting to zero indent.

Declaration

cs-api-definition
public void ClearIndent()

ClearIsBold()

Removes the bold formatting from the selection, reverting to the default weight.

Declaration

cs-api-definition
public void ClearIsBold()

ClearIsItalic()

Removes the italic formatting from the selection, reverting to the default style.

Declaration

cs-api-definition
public void ClearIsItalic()

ClearIsLocked()

Removes the lock setting from the selection, reverting to the default locked state.

Declaration

cs-api-definition
public void ClearIsLocked()

ClearIsWrapped()

Removes the text wrapping setting from the selection, reverting to the default behavior.

Declaration

cs-api-definition
public void ClearIsWrapped()

ClearStyleName()

Removes the named style reference from the selection, reverting to the default style.

Declaration

cs-api-definition
public void ClearStyleName()

ClearTextRotation()

Removes the text rotation from the selection, reverting to zero degrees.

Declaration

cs-api-definition
public void ClearTextRotation()

ClearUnderline()

Removes the underline style from the selection, reverting to no underline.

Declaration

cs-api-definition
public void ClearUnderline()

ClearVerticalAlignment()

Removes the vertical alignment from the selection, reverting to the default alignment.

Declaration

cs-api-definition
public void ClearVerticalAlignment()

DecreaseIndent()

Decreases the indentation level by one for the selection, ensuring compatible horizontal alignment and stopping at zero.

Declaration

cs-api-definition
public void DecreaseIndent()

EndUpdate()

Resumes layout recalculation and closes the undo group, completing the batch modification initiated by BeginUpdate.

Declaration

cs-api-definition
protected void EndUpdate()

ExecuteForEachRange(Action<CellRange>)

Executes the specified action on each range in the selection without suspending updates.

Declaration

cs-api-definition
protected void ExecuteForEachRange(Action<CellRange> action)

Parameters

action

Action<CellRange>

The action.

ExecuteForEachRange(IEnumerable<CellRange>, Action<CellRange>, Predicate<CellRange>)

Executes the specified action on each provided range, optionally checking a predicate before proceeding, and returns whether all ranges passed the predicate.

Declaration

cs-api-definition
protected bool ExecuteForEachRange(IEnumerable<CellRange> cellRanges, Action<CellRange> action, Predicate<CellRange> canExecute = null)

Parameters

cellRanges

IEnumerable<CellRange>

The cell ranges.

action

Action<CellRange>

The action.

canExecute

Predicate<CellRange>

The can execute.

Returns

bool

ExecuteForEachRangeInsideBeginEndUpdate(Action<CellRange>)

Executes the specified action on each range in the selection within a suspended-update context.

Declaration

cs-api-definition
protected void ExecuteForEachRangeInsideBeginEndUpdate(Action<CellRange> action)

Parameters

action

Action<CellRange>

The action.

ExecuteForEachRangeInsideBeginEndUpdate(IEnumerable<CellRange>, Action<CellRange>, Predicate<CellRange>)

Executes the specified action on each provided range within a suspended-update context, optionally checking a predicate before proceeding, and returns whether all ranges passed the predicate.

Declaration

cs-api-definition
protected bool ExecuteForEachRangeInsideBeginEndUpdate(IEnumerable<CellRange> cellRanges, Action<CellRange> action, Predicate<CellRange> canExecute = null)

Parameters

cellRanges

IEnumerable<CellRange>

The cell ranges.

action

Action<CellRange>

The action.

canExecute

Predicate<CellRange>

The can execute.

Returns

bool

GetBorders()

Retrieves all border styles applied to the selection, including outer, inner, and diagonal borders, resolving conflicts by priority.

Declaration

cs-api-definition
public CellBorders GetBorders()

Returns

CellBorders

The cell borders.

GetFill()

Retrieves the background fill applied to the selection, or an indeterminate state if fills differ.

Declaration

cs-api-definition
public RangePropertyValue<IFill> GetFill()

Returns

RangePropertyValue<IFill>

The fill value for the selection.

GetFontFamily()

Retrieves the font family applied to the selection, which may reference a theme font or explicit typeface.

Declaration

cs-api-definition
public RangePropertyValue<ThemableFontFamily> GetFontFamily()

Returns

RangePropertyValue<ThemableFontFamily>

The font family for the selection.

GetFontSize()

Retrieves the font size in device-independent units from the selection.

Declaration

cs-api-definition
public RangePropertyValue<double> GetFontSize()

Returns

RangePropertyValue<double>

The font size for the selection.

GetForeColor()

Retrieves the text color applied to the selection, which may reference a theme color or explicit RGB value.

Declaration

cs-api-definition
public RangePropertyValue<ThemableColor> GetForeColor()

Returns

RangePropertyValue<ThemableColor>

The font color for the selection.

GetFormat()

Retrieves the number format pattern applied to the selection, or an indeterminate state if formats differ.

Declaration

cs-api-definition
public RangePropertyValue<CellValueFormat> GetFormat()

Returns

RangePropertyValue<CellValueFormat>

The format for the selection.

GetHorizontalAlignment()

Retrieves the horizontal text alignment applied to the selection.

Declaration

cs-api-definition
public RangePropertyValue<RadHorizontalAlignment> GetHorizontalAlignment()

Returns

RangePropertyValue<RadHorizontalAlignment>

The horizontal alignment for the selection.

GetIndent()

Retrieves the text indentation level applied to the selection, measured in indent units.

Declaration

cs-api-definition
public RangePropertyValue<int> GetIndent()

Returns

RangePropertyValue<int>

The indent for the selection.

GetIsBold()

Checks whether bold formatting is applied to the selection.

Declaration

cs-api-definition
public RangePropertyValue<bool> GetIsBold()

Returns

RangePropertyValue<bool>

The value indicating whether the font is bold for the selection.

GetIsItalic()

Checks whether italic formatting is applied to the selection.

Declaration

cs-api-definition
public RangePropertyValue<bool> GetIsItalic()

Returns

RangePropertyValue<bool>

The value indicating whether the font is italic for the selection.

GetIsLocked()

Checks whether the selection is locked for editing when worksheet protection is enabled.

Declaration

cs-api-definition
public RangePropertyValue<bool> GetIsLocked()

Returns

RangePropertyValue<bool>

The value indicating whether the selection is locked.

GetIsWrapped()

Checks whether text wrapping is enabled for the selection.

Declaration

cs-api-definition
public RangePropertyValue<bool> GetIsWrapped()

Returns

RangePropertyValue<bool>

The value indicating whether text wrapping is used.

GetPropertyValue<T>(Func<CellRange, RangePropertyValue<T>>, IEnumerable<CellRange>, T)

Retrieves a property value from the specified ranges, returning either a consistent value or an indeterminate state if values differ across ranges.

Declaration

cs-api-definition
protected RangePropertyValue<T> GetPropertyValue<T>(Func<CellRange, RangePropertyValue<T>> getRangePropertyValue, IEnumerable<CellRange> cellRanges, T defaultValue)

Parameters

getRangePropertyValue

Func<CellRange, RangePropertyValue<T>>

The get range property value.

cellRanges

IEnumerable<CellRange>

The cell ranges.

defaultValue

T

The default value.

Returns

RangePropertyValue<T>

GetStyleName()

Retrieves the named cell style applied to the selection, or an indeterminate state if styles differ.

Declaration

cs-api-definition
public RangePropertyValue<string> GetStyleName()

Returns

RangePropertyValue<string>

The name of the style for the selection.

GetTextRotation()

Retrieves the text rotation angle applied to the selection, measured in degrees from -90 to 90.

Declaration

cs-api-definition
public RangePropertyValue<int> GetTextRotation()

Returns

RangePropertyValue<int>

The text rotation degree for the selection in range -90 to 90.

GetTopLeftCellIndex()

Finds and returns the top-left cell index across all ranges in the selection.

Declaration

cs-api-definition
protected CellIndex GetTopLeftCellIndex()

Returns

CellIndex

GetUnderline()

Retrieves the underline style applied to the selection.

Declaration

cs-api-definition
public RangePropertyValue<UnderlineType> GetUnderline()

Returns

RangePropertyValue<UnderlineType>

The underline property for the selection.

GetVerticalAlignment()

Retrieves the vertical text alignment applied to the selection.

Declaration

cs-api-definition
public RangePropertyValue<RadVerticalAlignment> GetVerticalAlignment()

Returns

RangePropertyValue<RadVerticalAlignment>

The vertical alignment for the selection.

IncreaseIndent()

Increases the indentation level by one for the selection, ensuring compatible horizontal alignment and respecting the maximum indent limit.

Declaration

cs-api-definition
public void IncreaseIndent()

SetBorders(CellBorders)

Applies the specified border configuration to the selection, supporting outer, inner, and diagonal borders.

Declaration

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

Parameters

value

CellBorders

The value.

SetFill(IFill)

Applies the specified background fill (solid, pattern, or gradient) to the selection.

Declaration

cs-api-definition
public void SetFill(IFill value)

Parameters

value

IFill

The value.

SetFontFamily(ThemableFontFamily)

Applies the specified font family to the selection, supporting both theme-based and explicit font references.

Declaration

cs-api-definition
public void SetFontFamily(ThemableFontFamily value)

Parameters

value

ThemableFontFamily

The value.

SetFontSize(double)

Applies the specified font size to the selection, which must be between 1 and 409 points.

Declaration

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

Parameters

value

double

The value.

SetForeColor(ThemableColor)

Applies the specified text color to the selection, supporting both theme-based and explicit color references.

Declaration

cs-api-definition
public void SetForeColor(ThemableColor value)

Parameters

value

ThemableColor

The value.

SetFormat(CellValueFormat)

Applies the specified number format pattern to the selection and updates cell values to respect the new format.

Declaration

cs-api-definition
public void SetFormat(CellValueFormat value)

Parameters

value

CellValueFormat

The value.

SetHorizontalAlignment(RadHorizontalAlignment)

Applies the specified horizontal alignment to the selection, clearing indent if the alignment is incompatible.

Declaration

cs-api-definition
public void SetHorizontalAlignment(RadHorizontalAlignment value)

Parameters

value

RadHorizontalAlignment

The value.

SetIndent(int)

Applies the specified indentation level to the selection, which must be between 0 and 250, and ensures compatible horizontal alignment.

Declaration

cs-api-definition
public void SetIndent(int value)

Parameters

value

int

The value.

SetIsBold(bool)

Applies or removes bold formatting on the selection.

Declaration

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

Parameters

value

bool

The value.

SetIsItalic(bool)

Applies or removes italic formatting on the selection.

Declaration

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

Parameters

value

bool

The value.

SetIsLocked(bool)

Locks or unlocks the selection for editing when worksheet protection is enabled.

Declaration

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

Parameters

value

bool

The value.

SetIsWrapped(bool)

Enables or disables text wrapping for the selection.

Declaration

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

Parameters

value

bool

The value.

SetStyleName(string)

Applies the specified named cell style to the selection, clearing locally-set properties that conflict with the style definition.

Declaration

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

Parameters

value

string

The value.

SetTextRotation(int)

Applies the specified rotation angle to the selection, which must be between -90 and 90 degrees.

Declaration

cs-api-definition
public void SetTextRotation(int value)

Parameters

value

int

The rotation degree in the range -90 to 90.

SetUnderline(UnderlineType)

Applies the specified underline style to the selection.

Declaration

cs-api-definition
public void SetUnderline(UnderlineType value)

Parameters

value

UnderlineType

The value.

SetVerticalAlignment(RadVerticalAlignment)

Applies the specified vertical alignment to the selection.

Declaration

cs-api-definition
public void SetVerticalAlignment(RadVerticalAlignment value)

Parameters

value

RadVerticalAlignment

The value.