Class
Worksheet

Two-dimensional grid organizing cells into rows and columns with filtering, sorting, formulas, and styling. Use to manage worksheet content, properties, and layout within a workbook.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public class Worksheet : Sheet, INotifyPropertyChanged, ISheet, IDisposable

Inheritance: objectNotifyPropertyChangedBaseSheetWorksheet

Implements: IDisposableINotifyPropertyChangedISheet

Inherited Members Sheet.SuspendLayoutUpdate()Sheet.ResumeLayoutUpdate()Sheet.BeginUndoGroup()Sheet.EndUndoGroup()Sheet.Dispose()Sheet.OnLayoutInvalidated()Sheet.OnIsProtectedChanged()Sheet.NameSheet.WorkbookSheet.VisibilitySheet.IsLayoutUpdateSuspendedSheet.IsProtectedSheet.LayoutInvalidatedSheet.NameChangedSheet.IsProtectedChangedNotifyPropertyChangedBase.OnPropertyChanged(string)NotifyPropertyChangedBase.OnPropertyChanged(PropertyChangedEventArgs)NotifyPropertyChangedBase.PropertyChanged

Properties

Cells

Provides access to the cell collection for reading and modifying cell content, formulas, and formatting.

Declaration

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

Property Value

Cells

The cells of the worksheet.

Charts

Provides access to charts visualizing data from the worksheet or other sources.

Declaration

cs-api-definition
public ChartCollection Charts { get; }

Property Value

ChartCollection

The charts.

Columns

Provides access to the column collection for managing column widths, visibility, and column-level formatting.

Declaration

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

Property Value

Columns

The columns of the worksheet.

Comments

Provides access to modern threaded comments attached to cells in the worksheet.

Declaration

cs-api-definition
public CommentCollection Comments { get; }

Property Value

CommentCollection

The comments.

DefaultColumnWidth

Controls the default column width applied to columns without explicit width settings.

Declaration

cs-api-definition
public ColumnWidth DefaultColumnWidth { get; set; }

Property Value

ColumnWidth

The default width of the column.

DefaultRowHeight

Controls the default row height applied to rows without explicit height settings.

Declaration

cs-api-definition
public RowHeight DefaultRowHeight { get; set; }

Property Value

RowHeight

The default height of the row.

Filter

Provides access to the auto-filter configuration for hiding rows based on column criteria.

Declaration

cs-api-definition
public AutoFilter Filter { get; }

Property Value

AutoFilter

The filtering of the worksheet.

GroupingProperties

Provides access to row and column grouping settings for outlining and collapsing data sections.

Declaration

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

Property Value

GroupingProperties

The grouping properties.

HeaderNameRenderingConverter

Controls how row and column headers are rendered, enabling custom labeling schemes beyond default A-Z and 1-N.

Declaration

cs-api-definition
public HeaderNameRenderingConverterBase HeaderNameRenderingConverter { get; set; }

Property Value

HeaderNameRenderingConverterBase

The header name rendering converter.

Provides access to the collection of hyperlinks defined in the worksheet for navigation and external references.

Declaration

cs-api-definition
public HyperlinkCollection Hyperlinks { get; }

Property Value

HyperlinkCollection

The hyperlinks.

Images

Provides access to floating images positioned on the worksheet.

Declaration

cs-api-definition
public ImageCollection Images { get; }

Property Value

ImageCollection

The images.

Names

Provides access to worksheet-scoped named ranges and constants that can be referenced in formulas.

Declaration

cs-api-definition
public NameCollection Names { get; }

Property Value

NameCollection

The collection of defined names of the worksheet.

Notes

Provides access to cell notes (legacy comments) attached to cells in the worksheet.

Declaration

cs-api-definition
public NoteCollection Notes { get; }

Property Value

NoteCollection

The notes.

ProtectionOptions

Controls which operations users can perform on a protected worksheet, such as inserting rows or formatting cells.

Declaration

cs-api-definition
public WorksheetProtectionOptions ProtectionOptions { get; }

Property Value

WorksheetProtectionOptions

The protection options.

Rows

Provides access to the row collection for managing row heights, visibility, and row-level formatting.

Declaration

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

Property Value

Rows

The rows of the worksheet.

SheetPageSetup

Returns the base page setup implementation for this sheet type.

Declaration

cs-api-definition
protected override sealed SheetPageSetupBase SheetPageSetup { get; }

Property Value

SheetPageSetupBase

The sheet page setup.

Overrides Sheet.SheetPageSetup

SortState

Provides access to the current sort configuration applied to the worksheet data.

Declaration

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

Property Value

SortState

The sort state.

Type

Returns the sheet type identifier, always SheetType.Worksheet for worksheet instances.

Declaration

cs-api-definition
public override SheetType Type { get; }

Property Value

SheetType

The type of the sheet.

Overrides Sheet.Type

UsedCellRange

Returns the bounding range encompassing all cells with content or formatting, indicating the worksheet's active data area.

Declaration

cs-api-definition
public CellRange UsedCellRange { get; }

Property Value

CellRange

The used cell range.

ViewState

Provides access to display settings including zoom, frozen panes, selection, and gridline visibility.

Declaration

cs-api-definition
public WorksheetViewState ViewState { get; }

Property Value

WorksheetViewState

The view state of the worksheet.

WorksheetPageSetup

Provides access to page layout settings for printing and PDF export, including margins, orientation, and paper size.

Declaration

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

Property Value

WorksheetPageSetup

The worksheet page setup.

Methods

CopyFrom(Worksheet)

Copies Worksheet contents from a source Worksheet into this instance. This Worksheet instance contents are overridden from the source Worksheet contents.

Declaration

cs-api-definition
public void CopyFrom(Worksheet sourceWorksheet)

Parameters

sourceWorksheet

Worksheet

The worksheet to copy from.

CreateViewState()

Creates a new WorksheetViewState instance initialized with default display settings.

Declaration

cs-api-definition
protected override ISheetViewState CreateViewState()

Returns

ISheetViewState

A new worksheet view state.

Overrides Sheet.CreateViewState()

Dispose(bool)

Disposes the specified disposing.

Declaration

cs-api-definition
protected override void Dispose(bool disposing)

Parameters

disposing

bool

The disposing.

Overrides Sheet.Dispose(bool)

Find(FindOptions)

Searches for the first occurrence of text in the worksheet matching the specified criteria and returns its location.

Declaration

cs-api-definition
public FindResult Find(FindOptions findOptions)

Parameters

findOptions

FindOptions

The find options.

Returns

FindResult

The first matching result, or null if not found.

FindAll(FindOptions)

Searches for all occurrences of text in the worksheet matching the specified criteria and returns their locations.

Declaration

cs-api-definition
public IEnumerable<FindResult> FindAll(FindOptions findOptions)

Parameters

findOptions

FindOptions

The find options.

Returns

IEnumerable<FindResult>

All matching results in the worksheet.

GetUsedCellRange(IEnumerable<IPropertyDefinition>)

Gets the used cell range for specific cell property definitions.

Declaration

cs-api-definition
public CellRange GetUsedCellRange(IEnumerable<IPropertyDefinition> propertyDefinitions)

Parameters

propertyDefinitions

IEnumerable<IPropertyDefinition>

The cell property definitions from CellPropertyDefinitions

Returns

CellRange

The used cell range for specific cell property definitions.

GetUsedCellRange(IPropertyDefinition)

Gets the used cell range for a specific cell property definition.

Declaration

cs-api-definition
public CellRange GetUsedCellRange(IPropertyDefinition propertyDefinition)

Parameters

propertyDefinition

IPropertyDefinition

The cell property definition from CellPropertyDefinitions

Returns

CellRange

The used cell range for specific cell property definitions.

Protect(string, WorksheetProtectionOptions)

Protects the worksheet.

Declaration

cs-api-definition
public void Protect(string password, WorksheetProtectionOptions options)

Parameters

password

string

The password.

options

WorksheetProtectionOptions

The protection options of the worksheet.

Replace(ReplaceOptions)

Executes replace action according to the specified replace options.

Declaration

cs-api-definition
public bool Replace(ReplaceOptions replaceOptions)

Parameters

replaceOptions

ReplaceOptions

The replace options.

Returns

bool

The value indicating whether a value was found to replace.

ReplaceAll(ReplaceOptions)

Executes replace all action according to the specified replace options.

Declaration

cs-api-definition
public int ReplaceAll(ReplaceOptions replaceOptions)

Parameters

replaceOptions

ReplaceOptions

The replace options.

Returns

int

The number of replacements made.

Unprotect(string)

Unprotects the worksheet.

Declaration

cs-api-definition
public bool Unprotect(string password)

Parameters

password

string

The password.

Returns

bool