skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

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.

Inheritance
System.Object
SelectionBase
CellSelection
RowColumnSelectionBase
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Documents.Spreadsheet.Model
Assembly: Telerik.Windows.Documents.Spreadsheet.dll

Syntax

public abstract class SelectionBase

Properties

CellRanges

The collection of cell ranges included in this selection.

Declaration
public IEnumerable<CellRange> CellRanges { get; }
Property Value
System.Collections.Generic.IEnumerable<CellRange>

The cell ranges.

Worksheet

The worksheet containing this selection.

Declaration
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
protected void BeginUpdate()

Clear(ClearType)

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

Declaration
public void Clear(ClearType type)
Parameters
ClearType type

The type of clear.

ClearBorders()

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

Declaration
public void ClearBorders()

ClearFill()

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

Declaration
public void ClearFill()

ClearFontFamily()

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

Declaration
public void ClearFontFamily()

ClearFontSize()

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

Declaration
public void ClearFontSize()

ClearForeColor()

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

Declaration
public void ClearForeColor()

ClearFormat()

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

Declaration
public void ClearFormat()

ClearHorizontalAlignment()

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

Declaration
public void ClearHorizontalAlignment()

ClearIndent()

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

Declaration
public void ClearIndent()

ClearIsBold()

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

Declaration
public void ClearIsBold()

ClearIsItalic()

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

Declaration
public void ClearIsItalic()

ClearIsLocked()

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

Declaration
public void ClearIsLocked()

ClearIsWrapped()

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

Declaration
public void ClearIsWrapped()

ClearStyleName()

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

Declaration
public void ClearStyleName()

ClearTextRotation()

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

Declaration
public void ClearTextRotation()

ClearUnderline()

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

Declaration
public void ClearUnderline()

ClearVerticalAlignment()

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

Declaration
public void ClearVerticalAlignment()

DecreaseIndent()

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

Declaration
public void DecreaseIndent()

EndUpdate()

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

Declaration
protected void EndUpdate()

ExecuteForEachRange(Action<CellRange>)

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

Declaration
protected void ExecuteForEachRange(Action<CellRange> action)
Parameters
System.Action<CellRange> action

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
protected bool ExecuteForEachRange(IEnumerable<CellRange> cellRanges, Action<CellRange> action, Predicate<CellRange> canExecute = null)
Parameters
System.Collections.Generic.IEnumerable<CellRange> cellRanges

The cell ranges.

System.Action<CellRange> action

The action.

System.Predicate<CellRange> canExecute

The can execute.

Returns
System.Boolean

ExecuteForEachRangeInsideBeginEndUpdate(Action<CellRange>)

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

Declaration
protected void ExecuteForEachRangeInsideBeginEndUpdate(Action<CellRange> action)
Parameters
System.Action<CellRange> action

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
protected bool ExecuteForEachRangeInsideBeginEndUpdate(IEnumerable<CellRange> cellRanges, Action<CellRange> action, Predicate<CellRange> canExecute = null)
Parameters
System.Collections.Generic.IEnumerable<CellRange> cellRanges

The cell ranges.

System.Action<CellRange> action

The action.

System.Predicate<CellRange> canExecute

The can execute.

Returns
System.Boolean

GetBorders()

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

Declaration
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
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
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
public RangePropertyValue<double> GetFontSize()
Returns
RangePropertyValue<System.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
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
public RangePropertyValue<CellValueFormat> GetFormat()
Returns
RangePropertyValue<CellValueFormat>

The format for the selection.

GetHorizontalAlignment()

Retrieves the horizontal text alignment applied to the selection.

Declaration
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
public RangePropertyValue<int> GetIndent()
Returns
RangePropertyValue<System.Int32>

The indent for the selection.

GetIsBold()

Checks whether bold formatting is applied to the selection.

Declaration
public RangePropertyValue<bool> GetIsBold()
Returns
RangePropertyValue<System.Boolean>

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

GetIsItalic()

Checks whether italic formatting is applied to the selection.

Declaration
public RangePropertyValue<bool> GetIsItalic()
Returns
RangePropertyValue<System.Boolean>

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
public RangePropertyValue<bool> GetIsLocked()
Returns
RangePropertyValue<System.Boolean>

The value indicating whether the selection is locked.

GetIsWrapped()

Checks whether text wrapping is enabled for the selection.

Declaration
public RangePropertyValue<bool> GetIsWrapped()
Returns
RangePropertyValue<System.Boolean>

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
protected RangePropertyValue<T> GetPropertyValue<T>(Func<CellRange, RangePropertyValue<T>> getRangePropertyValue, IEnumerable<CellRange> cellRanges, T defaultValue)
Parameters
System.Func<CellRange, RangePropertyValue<T>> getRangePropertyValue

The get range property value.

System.Collections.Generic.IEnumerable<CellRange> cellRanges

The cell ranges.

T defaultValue

The default value.

Returns
RangePropertyValue<T>

Type Parameters
T

The type of the T.

GetStyleName()

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

Declaration
public RangePropertyValue<string> GetStyleName()
Returns
RangePropertyValue<System.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
public RangePropertyValue<int> GetTextRotation()
Returns
RangePropertyValue<System.Int32>

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
protected CellIndex GetTopLeftCellIndex()
Returns
CellIndex

GetUnderline()

Retrieves the underline style applied to the selection.

Declaration
public RangePropertyValue<UnderlineType> GetUnderline()
Returns
RangePropertyValue<UnderlineType>

The underline property for the selection.

GetVerticalAlignment()

Retrieves the vertical text alignment applied to the selection.

Declaration
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
public void IncreaseIndent()

SetBorders(CellBorders)

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

Declaration
public virtual void SetBorders(CellBorders value)
Parameters
CellBorders value

The value.

SetFill(IFill)

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

Declaration
public void SetFill(IFill value)
Parameters
IFill value

The value.

SetFontFamily(ThemableFontFamily)

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

Declaration
public void SetFontFamily(ThemableFontFamily value)
Parameters
ThemableFontFamily value

The value.

SetFontSize(Double)

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

Declaration
public void SetFontSize(double value)
Parameters
System.Double value

The value.

SetForeColor(ThemableColor)

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

Declaration
public void SetForeColor(ThemableColor value)
Parameters
ThemableColor value

The value.

SetFormat(CellValueFormat)

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

Declaration
public void SetFormat(CellValueFormat value)
Parameters
CellValueFormat value

The value.

SetHorizontalAlignment(RadHorizontalAlignment)

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

Declaration
public void SetHorizontalAlignment(RadHorizontalAlignment value)
Parameters
RadHorizontalAlignment value

The value.

SetIndent(Int32)

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

Declaration
public void SetIndent(int value)
Parameters
System.Int32 value

The value.

SetIsBold(Boolean)

Applies or removes bold formatting on the selection.

Declaration
public void SetIsBold(bool value)
Parameters
System.Boolean value

The value.

SetIsItalic(Boolean)

Applies or removes italic formatting on the selection.

Declaration
public void SetIsItalic(bool value)
Parameters
System.Boolean value

The value.

SetIsLocked(Boolean)

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

Declaration
public void SetIsLocked(bool value)
Parameters
System.Boolean value

The value.

SetIsWrapped(Boolean)

Enables or disables text wrapping for the selection.

Declaration
public void SetIsWrapped(bool value)
Parameters
System.Boolean value

The value.

SetStyleName(String)

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

Declaration
public void SetStyleName(string value)
Parameters
System.String value

The value.

SetTextRotation(Int32)

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

Declaration
public void SetTextRotation(int value)
Parameters
System.Int32 value

The rotation degree in the range -90 to 90.

SetUnderline(UnderlineType)

Applies the specified underline style to the selection.

Declaration
public void SetUnderline(UnderlineType value)
Parameters
UnderlineType value

The value.

SetVerticalAlignment(RadVerticalAlignment)

Applies the specified vertical alignment to the selection.

Declaration
public void SetVerticalAlignment(RadVerticalAlignment value)
Parameters
RadVerticalAlignment value

The value.

Getting Started
  • Getting Started
Support Resources
  • Documentation
Community
  • Forums
  • Blogs
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.