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

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

Allows drag-to-fill (autofill) gestures.

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

AllowCellFormattinglink

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

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

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

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

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

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

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

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

Allows cell merge and unmerge commands.

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

AllowResizinglink

Allows row and column resize gestures.

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

AllowSortinglink

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

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

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.

CanRedolink

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

CanUndolink

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

CellTypeslink

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

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

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

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

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

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

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.

SelectedToolsetIndexlink

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

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

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

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

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

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

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

Accepts the current edit in the spreadsheet.

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

BuildRenderTreelink

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

ExecuteAsynclink

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

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

IsFeatureAllowedlink

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

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

OnAfterRenderAsynclink

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

OnAutofillPointerDownAsynclink

Invoked by JS interop when the autofill handle is pressed.

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

OnAutofillPointerMoveAsynclink

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

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

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

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

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

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

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

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

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

OnColumnResizePointerDownAsynclink

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

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

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

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

Declaration
public Task OnCopyAsync()
Returns
Type Description
Task

OnDrawingMovePointerDownAsynclink

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

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

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

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

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

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

Declaration
protected override void OnInitialized()

OnKeyDownAsynclink

Invoked by JS interop when a key is pressed down.

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

OnPasteAsynclink

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

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

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

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

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

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

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

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

Declaration
public void Redo()

ScrollToAsynclink

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

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

Undolink

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