RadzenSpreadsheet Class

A spreadsheet component that allows users to view and edit workbooks. It supports features like cell selection, editing, and keyboard shortcuts. The component can display a workbook with multiple sheets and allows users to navigate through cells using keyboard shortcuts. It also supports mouse interactions for selecting and editing cells, rows, and columns.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenSpreadsheet

Implements

IComponent

IHandleEvent

IHandleAfterRender

ISpreadsheet

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenSpreadsheet : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, ISpreadsheet

Constructors

RadzenSpreadsheetLink to this section

A spreadsheet component that allows users to view and edit workbooks. It supports features like cell selection, editing, and keyboard shortcuts. The component can display a workbook with multiple sheets and allows users to navigate through cells using keyboard shortcuts. It also supports mouse interactions for selecting and editing cells, rows, and columns.

Declaration
public RadzenSpreadsheet()

Properties

AllowAutofillLink to this section

Allows drag-to-fill (autofill) gestures.

Declaration
public bool AllowAutofill { get; set; }
Property Value
Type Description
boolAllows drag-to-fill (autofill) gestures.

AllowCellFormattingLink to this section

Allows font, color, alignment, and border formatting commands.

Declaration
public bool AllowCellFormatting { get; set; }
Property Value
Type Description
boolAllows font, color, alignment, and border formatting commands.

AllowChartsLink to this section

Allows inserting, editing, moving, resizing, and deleting charts.

Declaration
public bool AllowCharts { get; set; }
Property Value
Type Description
boolAllows inserting, editing, moving, resizing, and deleting charts.

AllowClipboardLink to this section

Allows cut, copy, and paste through the system clipboard. Independent of ReadOnly, so view-only users can still copy unless this is set to false. Cut and paste also require AllowEditing.

Declaration
public bool AllowClipboard { get; set; }
Property Value
Type Description
boolAllows cut, copy, and paste through the system clipboard. Independent of ReadOnly, so view-only users can still copy unless this is set to false. Cut and paste also require AllowEditing.

AllowConditionalFormattingLink to this section

Allows adding and clearing conditional formatting rules.

Declaration
public bool AllowConditionalFormatting { get; set; }
Property Value
Type Description
boolAllows adding and clearing conditional formatting rules.

AllowDataValidationLink to this section

Allows adding and clearing data-validation rules.

Declaration
public bool AllowDataValidation { get; set; }
Property Value
Type Description
boolAllows adding and clearing data-validation rules.

AllowEditingLink to this section

Allows direct cell editing (type-to-edit, double-click, paste-into-cell, delete-key, autoaccept).

Declaration
public bool AllowEditing { get; set; }
Property Value
Type Description
boolAllows direct cell editing (type-to-edit, double-click, paste-into-cell, delete-key, autoaccept).

AllowFilteringLink to this section

Allows filter and auto-filter commands and the filter UI affordances.

Declaration
public bool AllowFiltering { get; set; }
Property Value
Type Description
boolAllows filter and auto-filter commands and the filter UI affordances.

AllowImagesLink to this section

Allows inserting, moving, resizing, and deleting images.

Declaration
public bool AllowImages { get; set; }
Property Value
Type Description
boolAllows inserting, moving, resizing, and deleting images.

AllowMergeLink to this section

Allows cell merge and unmerge commands.

Declaration
public bool AllowMerge { get; set; }
Property Value
Type Description
boolAllows cell merge and unmerge commands.

AllowResizingLink to this section

Allows row and column resize gestures.

Declaration
public bool AllowResizing { get; set; }
Property Value
Type Description
boolAllows row and column resize gestures.

AllowSortingLink to this section

Allows single- and multi-key sort commands.

Declaration
public bool AllowSorting { get; set; }
Property Value
Type Description
boolAllows single- and multi-key sort commands.

AllowTablesLink to this section

Allows creating, editing, and removing structured tables.

Declaration
public bool AllowTables { get; set; }
Property Value
Type Description
boolAllows creating, editing, and removing structured tables.

AllowUndoRedoLink to this section

Allows undo and redo of previously executed commands.

Declaration
public bool AllowUndoRedo { get; set; }
Property Value
Type Description
boolAllows undo and redo of previously executed commands.

AriaLabelLink to this section

Gets or sets the accessible label (aria-label) announced for the spreadsheet's role="application" region. Defaults to a localized "Spreadsheet".

Declaration
public string AriaLabel { get; set; }
Property Value
Type Description
stringGets or sets the accessible label (aria-label) announced for the spreadsheet's role="application" region. Defaults to a localized "Spreadsheet".

CanRedoLink to this section

Declaration
public bool CanRedo { get; }
Property Value
Type Description
bool

CanUndoLink to this section

Declaration
public bool CanUndo { get; }
Property Value
Type Description
bool

CellTypesLink to this section

Gets or sets the custom cell type definitions. Maps cell type names to their renderer and editor component types.

Declaration
public Dictionary<string, Spreadsheet.SpreadsheetCellType> CellTypes { get; set; }
Property Value
Type Description
Dictionary<string, Spreadsheet.SpreadsheetCellType>Gets or sets the custom cell type definitions. Maps cell type names to their renderer and editor component types.

ChildContentLink to this section

Replaces the built-in toolsets. When set, the supplied content sits inside the toolbar's Tabs slot — each child should be a RadzenTabsItem. Add RadzenSpreadsheetTableDesignToolset to keep the contextual "Table Design" toolset.

Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type Description
RenderFragmentReplaces the built-in toolsets. When set, the supplied content sits inside the toolbar's Tabs slot — each child should be a RadzenTabsItem. Add RadzenSpreadsheetTableDesignToolset to keep the contextual "Table Design" toolset.

CommandExecutingLink to this section

Fires before a command is pushed onto the undo stack. Call PreventDefault from the handler to veto the command. Fires after ReadOnly, the matching Allow* flag, and the sheet's Protection have already approved the command.

Declaration
public EventCallback<Spreadsheet.SpreadsheetCommandEventArgs> CommandExecuting { get; set; }
Property Value
Type Description
EventCallback<Spreadsheet.SpreadsheetCommandEventArgs>Fires before a command is pushed onto the undo stack. Call PreventDefault from the handler to veto the command. Fires after ReadOnly, the matching Allow* flag, and the sheet's Protection have already approved the command.

CsvExportOptionsLink to this section

Options applied when the user exports the workbook as CSV. When null, defaults are used (comma separator, UTF-8 with BOM, CRLF line endings, RFC 4180 minimal quoting, active sheet only).

Declaration
public Documents.Spreadsheet.CsvExportOptions CsvExportOptions { get; set; }
Property Value
Type Description
Documents.Spreadsheet.CsvExportOptionsOptions applied when the user exports the workbook as CSV. When null, defaults are used (comma separator, UTF-8 with BOM, CRLF line endings, RFC 4180 minimal quoting, active sheet only).

CsvImportOptionsLink to this section

Options applied when the user opens a CSV file. When null, defaults are used (comma separator, UTF-8, value and formula auto-detection on).

Declaration
public Documents.Spreadsheet.CsvImportOptions CsvImportOptions { get; set; }
Property Value
Type Description
Documents.Spreadsheet.CsvImportOptionsOptions applied when the user opens a CSV file. When null, defaults are used (comma separator, UTF-8, value and formula auto-detection on).

ExportFileNameLink to this section

The name of the file to export the workbook to when using the export functionality. When the user picks "Save as CSV" the extension is replaced with .csv.

Declaration
public string ExportFileName { get; set; }
Property Value
Type Description
stringThe name of the file to export the workbook to when using the export functionality. When the user picks "Save as CSV" the extension is replaced with .csv.

ReadOnlyLink to this section

When true, the spreadsheet rejects every command that mutates the workbook. The user can still select cells, scroll, and copy. Defaults to false.

Declaration
public bool ReadOnly { get; set; }
Property Value
Type Description
boolWhen true, the spreadsheet rejects every command that mutates the workbook. The user can still select cells, scroll, and copy. Defaults to false.

SelectedSheetIndexLink to this section

The zero-based index of the active sheet. Supports two-way binding via @bind-SelectedSheetIndex. Values outside the sheet range are clamped. Setting it selects the matching sheet even when ShowSheetTabs is false; loading a different Workbook resets it to the bound value (or 0 when unbound).

Declaration
public int SelectedSheetIndex { get; set; }
Property Value
Type Description
intThe zero-based index of the active sheet. Supports two-way binding via @bind-SelectedSheetIndex. Values outside the sheet range are clamped. Setting it selects the matching sheet even when ShowSheetTabs is false; loading a different Workbook resets it to the bound value (or 0 when unbound).

SelectedSheetIndexChangedLink to this section

Fired when the active sheet changes. Used by @bind-SelectedSheetIndex.

Declaration
public EventCallback<int> SelectedSheetIndexChanged { get; set; }
Property Value
Type Description
EventCallback<int>Fired when the active sheet changes. Used by @bind-SelectedSheetIndex.

SelectedToolsetIndexLink to this section

The index of the active toolset in the toolbar. Defaults to 1 so the Home toolset is shown first. Supports two-way binding via @bind-SelectedToolsetIndex.

Declaration
public int SelectedToolsetIndex { get; set; }
Property Value
Type Description
intThe index of the active toolset in the toolbar. Defaults to 1 so the Home toolset is shown first. Supports two-way binding via @bind-SelectedToolsetIndex.

SelectedToolsetIndexChangedLink to this section

Fired when the active toolset changes. Used by @bind-SelectedToolsetIndex.

Declaration
public EventCallback<int> SelectedToolsetIndexChanged { get; set; }
Property Value
Type Description
EventCallback<int>Fired when the active toolset changes. Used by @bind-SelectedToolsetIndex.

ShowFormulaBarLink to this section

When true (the default) the formula bar is rendered between the toolbar and the grid.

Declaration
public bool ShowFormulaBar { get; set; }
Property Value
Type Description
boolWhen true (the default) the formula bar is rendered between the toolbar and the grid.

ShowSheetTabsLink to this section

When true (the default) the sheet tab strip is rendered below the grid.

Declaration
public bool ShowSheetTabs { get; set; }
Property Value
Type Description
boolWhen true (the default) the sheet tab strip is rendered below the grid.

ShowToolbarLink to this section

When true (the default) the toolbar is rendered above the grid. Set to false for kiosk or view-only embeds.

Declaration
public bool ShowToolbar { get; set; }
Property Value
Type Description
boolWhen true (the default) the toolbar is rendered above the grid. Set to false for kiosk or view-only embeds.

WorkbookLink to this section

The workbook to display in the spreadsheet.

Declaration
public Documents.Spreadsheet.Workbook Workbook { get; set; }
Property Value
Type Description
Documents.Spreadsheet.WorkbookThe workbook to display in the spreadsheet.

WorkbookChangedLink to this section

Event callback that is invoked when the workbook changes.

Declaration
public EventCallback<Documents.Spreadsheet.Workbook> WorkbookChanged { get; set; }
Property Value
Type Description
EventCallback<Documents.Spreadsheet.Workbook>Event callback that is invoked when the workbook changes.

Methods

AcceptAsyncLink to this section

Accepts the current edit in the spreadsheet.

Declaration
public Task<bool> AcceptAsync()
Returns
Type Description
Task<bool>

BuildRenderTreeLink to this section

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

ExecuteAsyncLink to this section

Declaration
public Task<bool> ExecuteAsync(Spreadsheet.ICommand command)
Parameters
Type Name Description
Spreadsheet.ICommand command
Returns
Type Description
Task<bool>

GetComponentCssClassLink to this section

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

IsFeatureAllowedLink to this section

Returns true when the given feature is enabled. ReadOnly forces every feature off except Clipboard, which stays governed solely by AllowClipboard so view-only users can still copy data unless the host explicitly opts out.

Declaration
public bool IsFeatureAllowed(Spreadsheet.SpreadsheetFeature feature)
Parameters
Type Name Description
Spreadsheet.SpreadsheetFeature feature The feature to check.
Returns
Type Description
bool

LoadWorkbookAsyncLink to this section

Declaration
public Task LoadWorkbookAsync(Documents.Spreadsheet.Workbook workbook)
Parameters
Type Name Description
Documents.Spreadsheet.Workbook workbook
Returns
Type Description
Task

OnAfterRenderAsyncLink to this section

Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type Name Description
bool firstRender
Returns
Type Description
Task

OnAutofillPointerDownAsyncLink to this section

Invoked by JS interop when the autofill handle is pressed.

Declaration
public void OnAutofillPointerDownAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args

OnAutofillPointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves during an autofill drag.

Declaration
public void OnAutofillPointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args

OnAutofillPointerUpAsyncLink to this section

Invoked by JS interop when the pointer is released after an autofill drag.

Declaration
public Task OnAutofillPointerUpAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnCellContextMenuAsyncLink to this section

Invoked by JS interop when a cell is right-clicked.

Declaration
public Task OnCellContextMenuAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task

OnCellDoubleClickAsyncLink to this section

Invoked by JS interop when a cell is double-clicked with the pointer.

Declaration
public Task OnCellDoubleClickAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task

OnCellPointerDownAsyncLink to this section

Invoked by JS interop when a cell is clicked with the pointer.

Declaration
public Task<bool> OnCellPointerDownAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task<bool>

OnCellPointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves over a cell.

Declaration
public Task OnCellPointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnColumnContextMenuAsyncLink to this section

Invoked by JS interop when a column header is right-clicked.

Declaration
public Task OnColumnContextMenuAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task

OnColumnPointerDownAsyncLink to this section

Invoked by JS interop when a column header is clicked with the pointer.

Declaration
public Task<bool> OnColumnPointerDownAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task<bool>

OnColumnPointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves over a column header.

Declaration
public Task OnColumnPointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnColumnResizeDoubleClickAsyncLink to this section

Invoked by JS interop when a column resize handle is double-clicked. Auto fits the column width to its displayed content.

Declaration
public Task OnColumnResizeDoubleClickAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args The column event arguments containing the target column index.
Returns
Type Description
Task

OnColumnResizePointerDownAsyncLink to this section

Invoked by JS interop when the column resize handle is pressed.

Declaration
public Task<bool> OnColumnResizePointerDownAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task<bool>

OnColumnResizePointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves while resizing a column.

Declaration
public Task OnColumnResizePointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnColumnResizePointerUpAsyncLink to this section

Invoked by JS interop when the pointer is released after resizing a column.

Declaration
public Task OnColumnResizePointerUpAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnCopyAsyncLink to this section

Invoked by JS interop to copy the current selection to the clipboard.

Declaration
public Task OnCopyAsync()
Returns
Type Description
Task

OnDrawingMovePointerDownAsyncLink to this section

Invoked by JS interop when a drawing body is pressed to start a move.

Declaration
public Task OnDrawingMovePointerDownAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnDrawingMovePointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves while dragging a drawing.

Declaration
public Task OnDrawingMovePointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnDrawingMovePointerUpAsyncLink to this section

Invoked by JS interop when the pointer is released after moving a drawing.

Declaration
public Task OnDrawingMovePointerUpAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnDrawingResizePointerDownAsyncLink to this section

Invoked by JS interop when a drawing resize handle is pressed.

Declaration
public Task<bool> OnDrawingResizePointerDownAsync(Spreadsheet.ImageResizeEventArgs args)
Parameters
Type Name Description
Spreadsheet.ImageResizeEventArgs args
Returns
Type Description
Task<bool>

OnDrawingResizePointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves while resizing a drawing.

Declaration
public Task OnDrawingResizePointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnDrawingResizePointerUpAsyncLink to this section

Invoked by JS interop when the pointer is released after resizing a drawing.

Declaration
public Task OnDrawingResizePointerUpAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnInitializedLink to this section

Declaration
protected override void OnInitialized()

OnKeyDownAsyncLink to this section

Invoked by JS interop when a key is pressed down.

Declaration
public Task OnKeyDownAsync(KeyboardEventArgs args, bool isGridContext)
Parameters
Type Name Description
KeyboardEventArgs args
bool isGridContext
Returns
Type Description
Task

OnPasteAsyncLink to this section

Invoked by JS interop to paste text from the clipboard into the current selection.

Declaration
public Task OnPasteAsync(string text)
Parameters
Type Name Description
string text
Returns
Type Description
Task

OnRowContextMenuAsyncLink to this section

Invoked by JS interop when a row header is right-clicked.

Declaration
public Task OnRowContextMenuAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task

OnRowPointerDownAsyncLink to this section

Invoked by JS interop when a row header is clicked with the pointer.

Declaration
public Task<bool> OnRowPointerDownAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task<bool>

OnRowPointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves over a row header.

Declaration
public Task OnRowPointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnRowResizePointerDownAsyncLink to this section

Invoked by JS interop when the row resize handle is pressed.

Declaration
public Task<bool> OnRowResizePointerDownAsync(Spreadsheet.CellEventArgs args)
Parameters
Type Name Description
Spreadsheet.CellEventArgs args
Returns
Type Description
Task<bool>

OnRowResizePointerMoveAsyncLink to this section

Invoked by JS interop when the pointer moves while resizing a row.

Declaration
public Task OnRowResizePointerMoveAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnRowResizePointerUpAsyncLink to this section

Invoked by JS interop when the pointer is released after resizing a row.

Declaration
public Task OnRowResizePointerUpAsync(PointerEventArgs args)
Parameters
Type Name Description
PointerEventArgs args
Returns
Type Description
Task

OnSelectionPointerUpAsyncLink to this section

Invoked by JS interop when the user releases the pointer after a cell, row, or column selection gesture. Fires RangeFinalized so subscribers (such as the range picker) can commit the user's pick.

Declaration
public Task OnSelectionPointerUpAsync()
Returns
Type Description
Task

RedoLink to this section

Declaration
public void Redo()

ScrollToAsyncLink to this section

Scrolls the spreadsheet to the specified cell address.

Declaration
public Task ScrollToAsync(Documents.Spreadsheet.CellRef address)
Parameters
Type Name Description
Documents.Spreadsheet.CellRef address
Returns
Type Description
Task

SetParametersAsyncLink to this section

Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
Type Name Description
ParameterView parameters
Returns
Type Description
Task

UndoLink to this section

Declaration
public void Undo()
An error has occurred. This app may no longer respond until reloaded. Reload 🗙