Worksheet Class

Represents a sheet in a spreadsheet.

Inheritance

Object

Documents.Spreadsheet.Worksheet

Namespace: Radzen.Documents.Spreadsheet

Assembly: Radzen.Blazor.dll

Syntax

public class Worksheet

Constructors

Worksheetlink

Initializes a new instance of the Worksheet class with the specified number of rows and columns.

Declaration
public Worksheet(int rows, int columns)
Parameters
Type Name Description
int rows
int columns

Properties

AutoFilterlink

Gets the auto filter for this sheet. Always non-null. Set its Range property to enable or disable.

Declaration
public Documents.Spreadsheet.AutoFilter AutoFilter { get; }
Property Value
Type Description
Documents.Spreadsheet.AutoFilterGets the auto filter for this sheet. Always non-null. Set its Range property to enable or disable.

Cellslink

Gets the collection of cells in the sheet.

Declaration
public Documents.Spreadsheet.CellStore Cells { get; set; }
Property Value
Type Description
Documents.Spreadsheet.CellStoreGets the collection of cells in the sheet.

Chartslink

Gets the list of charts associated with the sheet.

Declaration
public IReadOnlyList<Documents.Spreadsheet.SheetChart> Charts { get; }
Property Value
Type Description
IReadOnlyList<Documents.Spreadsheet.SheetChart>Gets the list of charts associated with the sheet.

ColumnCountlink

Gets the number of columns in the sheet.

Declaration
public int ColumnCount { get; }
Property Value
Type Description
intGets the number of columns in the sheet.

Columnslink

Gets the column axis for the sheet, which defines the properties of the columns.

Declaration
public Documents.Spreadsheet.Axis Columns { get; }
Property Value
Type Description
Documents.Spreadsheet.AxisGets the column axis for the sheet, which defines the properties of the columns.

ConditionalFormatslink

Gets the conditional formatting store for the sheet.

Declaration
public Documents.Spreadsheet.ConditionalFormatStore ConditionalFormats { get; }
Property Value
Type Description
Documents.Spreadsheet.ConditionalFormatStoreGets the conditional formatting store for the sheet.

Filterslink

Gets the list of filters applied to the sheet.

Declaration
public IReadOnlyList<Documents.Spreadsheet.SheetFilter> Filters { get; }
Property Value
Type Description
IReadOnlyList<Documents.Spreadsheet.SheetFilter>Gets the list of filters applied to the sheet.

FunctionRegistrylink

Gets the registry of formula functions available in the sheet.

Declaration
public Documents.Spreadsheet.FunctionStore FunctionRegistry { get; }
Property Value
Type Description
Documents.Spreadsheet.FunctionStoreGets the registry of formula functions available in the sheet.

Imageslink

Gets the list of images associated with the sheet.

Declaration
public IReadOnlyList<Documents.Spreadsheet.SheetImage> Images { get; }
Property Value
Type Description
IReadOnlyList<Documents.Spreadsheet.SheetImage>Gets the list of images associated with the sheet.

MergedCellslink

Gets the store for merged cells in the sheet, which manages cell merging and unmerging.

Declaration
public Documents.Spreadsheet.MergedCellStore MergedCells { get; }
Property Value
Type Description
Documents.Spreadsheet.MergedCellStoreGets the store for merged cells in the sheet, which manages cell merging and unmerging.

Namelink

Gets the name of the sheet.

Declaration
public string Name { get; set; }
Property Value
Type Description
stringGets the name of the sheet.

Protectionlink

Gets or sets the sheet protection settings.

Declaration
public Documents.Spreadsheet.SheetProtection Protection { get; set; }
Property Value
Type Description
Documents.Spreadsheet.SheetProtectionGets or sets the sheet protection settings.

RowCountlink

Gets the number of rows in the sheet.

Declaration
public int RowCount { get; }
Property Value
Type Description
intGets the number of rows in the sheet.

Rowslink

Gets the row axis for the sheet, which defines the properties of the rows.

Declaration
public Documents.Spreadsheet.Axis Rows { get; }
Property Value
Type Description
Documents.Spreadsheet.AxisGets the row axis for the sheet, which defines the properties of the rows.

SelectedChartlink

Gets or sets the currently selected chart.

Declaration
public Documents.Spreadsheet.SheetChart SelectedChart { get; set; }
Property Value
Type Description
Documents.Spreadsheet.SheetChartGets or sets the currently selected chart.

SelectedImagelink

Gets or sets the currently selected image.

Declaration
public Documents.Spreadsheet.SheetImage SelectedImage { get; set; }
Property Value
Type Description
Documents.Spreadsheet.SheetImageGets or sets the currently selected image.

Selectionlink

Gets the selection object that manages the selected cells in the sheet.

Declaration
public Documents.Spreadsheet.Selection Selection { get; }
Property Value
Type Description
Documents.Spreadsheet.SelectionGets the selection object that manages the selected cells in the sheet.

Tableslink

Gets the list of tables associated with the sheet.

Declaration
public IReadOnlyList<Documents.Spreadsheet.Table> Tables { get; }
Property Value
Type Description
IReadOnlyList<Documents.Spreadsheet.Table>Gets the list of tables associated with the sheet.

Validationlink

Gets the validation store for the sheet, which manages data validation rules and errors.

Declaration
public Documents.Spreadsheet.ValidationStore Validation { get; }
Property Value
Type Description
Documents.Spreadsheet.ValidationStoreGets the validation store for the sheet, which manages data validation rules and errors.

Workbooklink

Gets the workbook that contains this sheet.

Declaration
public Documents.Spreadsheet.Workbook Workbook { get; }
Property Value
Type Description
Documents.Spreadsheet.WorkbookGets the workbook that contains this sheet.

Methods

AddChartlink

Adds a chart to the sheet.

Declaration
public void AddChart(Documents.Spreadsheet.SheetChart chart)
Parameters
Type Name Description
Documents.Spreadsheet.SheetChart chart

AddFilterlink

Adds a filter to the sheet.

Declaration
public void AddFilter(Documents.Spreadsheet.SheetFilter filter)
Parameters
Type Name Description
Documents.Spreadsheet.SheetFilter filter

AddTablelink

Adds a table to the sheet.

Declaration
public Documents.Spreadsheet.Table AddTable(string name, Documents.Spreadsheet.RangeRef range, bool hasHeaders, bool totalsRowShown)
Parameters
Type Name Description
string name Unique table name (used in structured references like =SUM(Sales[Amount])).
Documents.Spreadsheet.RangeRef range The cell range covered by the table.
bool hasHeaders When true, the first row of range is treated as the header row.
bool totalsRowShown When true, the last row of range is treated as the totals row. Used by the XLSX reader; new tables typically toggle this via ShowTotals.
Returns
Type Description
Documents.Spreadsheet.TableThe created Table.

Batchlink

Runs action inside a single update batch: formula evaluation is suspended for the duration and runs once afterwards, even if action throws. Nests safely with other batches and direct Begin/EndUpdate calls.

Declaration
public void Batch(Action action)
Parameters
Type Name Description
Action action

Batchlink

Runs action inside a single update batch: formula evaluation is suspended for the duration and runs once afterwards, even if action throws. Nests safely with other batches and direct Begin/EndUpdate calls.

Declaration
public Documents.Spreadsheet.T Batch(Func<Documents.Spreadsheet.T> func)
Parameters
Type Name Description
Func<Documents.Spreadsheet.T> func
Returns
Type Description
Documents.Spreadsheet.T

BeginUpdatelink

Begins an update operation on the sheet, suspending formula evaluation until the matching EndUpdate. Calls nest: evaluation resumes only when the outermost EndUpdate runs.

Declaration
public void BeginUpdate()

ClearFilterslink

Clears all filters and shows all rows.

Declaration
public void ClearFilters()

DeleteColumnlink

Deletes the specified column and shifts cells left. Updates formulas and decreases column count.

Declaration
public void DeleteColumn(int columnIndex)
Parameters
Type Name Description
int columnIndex

DeleteRowlink

Deletes the specified row and shifts cells up. Updates formulas and decreases row count.

Declaration
public void DeleteRow(int rowIndex)
Parameters
Type Name Description
int rowIndex

EndUpdatelink

Ends an update operation. When this balances the outermost BeginUpdate, all formulas are re-evaluated once and pending changes are flushed. An unmatched call (no open update) is a no-op.

Declaration
public void EndUpdate()

GetFilterlink

Retrieves a filter for the specified range.

Declaration
public Documents.Spreadsheet.SheetFilter GetFilter(Documents.Spreadsheet.RangeRef range)
Parameters
Type Name Description
Documents.Spreadsheet.RangeRef range
Returns

GetTableContaininglink

Gets the table containing the cell at the given row/column, or null if none.

Declaration
public Documents.Spreadsheet.Table GetTableContaining(int row, int column)
Parameters
Type Name Description
int row
int column
Returns

InsertColumnlink

Inserts one or more columns at the specified index and shifts existing cells right. Updates formulas and increases column count.

Declaration
public void InsertColumn(int columnIndex, int count)
Parameters
Type Name Description
int columnIndex
int count

InsertRowlink

Inserts one or more rows at the specified index and shifts existing cells down. Updates formulas and increases row count.

Declaration
public void InsertRow(int rowIndex, int count)
Parameters
Type Name Description
int rowIndex
int count

IsCellEditablelink

Returns true if the cell at the given address is editable (either protection is off or the cell is unlocked).

Declaration
public bool IsCellEditable(Documents.Spreadsheet.CellRef address)
Parameters
Type Name Description
Documents.Spreadsheet.CellRef address
Returns
Type Description
bool

RemoveChartlink

Removes a chart from the sheet.

Declaration
public bool RemoveChart(Documents.Spreadsheet.SheetChart chart)
Parameters
Type Name Description
Documents.Spreadsheet.SheetChart chart
Returns
Type Description
bool

RemoveFilterlink

Removes a specific filter from the sheet.

Declaration
public bool RemoveFilter(Documents.Spreadsheet.SheetFilter filter)
Parameters
Type Name Description
Documents.Spreadsheet.SheetFilter filter The filter to remove.
Returns
Type Description
boolTrue if the filter was found and removed; otherwise, false.

RemoveFilterAtlink

Removes a filter from the sheet at the specified index.

Declaration
public void RemoveFilterAt(int index)
Parameters
Type Name Description
int index The index of the filter to remove.

RemoveTablelink

Removes a table abstraction. Cell content is left in place.

Declaration
public bool RemoveTable(Documents.Spreadsheet.Table table)
Parameters
Type Name Description
Documents.Spreadsheet.Table table
Returns
Type Description
bool

Sortlink

Sorts the specified range using the given sort levels. Column indices in keys are relative to the range's left edge. Stable: rows with equal keys keep their input order.

Declaration
public void Sort(Documents.Spreadsheet.RangeRef range, Documents.Spreadsheet.SortKey[] keys)
Parameters
Type Name Description
Documents.Spreadsheet.RangeRef range
Documents.Spreadsheet.SortKey[] keys

Sortlink

Sorts the specified range using the given sort levels. Column indices in keys are relative to the range's left edge. Stable: rows with equal keys keep their input order.

Declaration
public void Sort(Documents.Spreadsheet.RangeRef range, SortOrder order, int keyIndex)
Parameters
Type Name Description
Documents.Spreadsheet.RangeRef range
SortOrder order
int keyIndex

Events

ChromeChangedlink

Raised when sheet chrome (table styling, custom cell types, validation, auto filter) changes and dependent cell views must refresh.

Declaration
public event Action ChromeChanged
An error has occurred. This app may no longer respond until reloaded. Reload 🗙