alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class SfSpreadsheet

    Represents the Spreadsheet component, exposing events for editing, clipboard, saving, and other interactions.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    SfBaseComponent
    SfSpreadsheet
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(bool)
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnAfterRenderAsync(bool)
    SfBaseComponent.OnObservableChange(string, object, bool, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicenseByUICategory()
    Namespace: Syncfusion.Blazor.Spreadsheet
    Assembly: Syncfusion.Blazor.Spreadsheet.dll
    Syntax
    public class SfSpreadsheet : SfBaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    SfSpreadsheet()

    Declaration
    public SfSpreadsheet()

    Properties

    ActiveSheetIndex

    Gets or sets the index of the active sheet in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public int ActiveSheetIndex { get; set; }
    Property Value
    Type Description
    int

    An int representing the zero-based index of the active sheet. The default value is 0.

    Remarks

    This property allows you to programmatically set which sheet should be the active sheet in the spreadsheet.

    Key points to note:

    • The index is zero-based, meaning 0 represents the first sheet, 1 represents the second sheet, and so on.
    • The active sheet will change when this property is set. For example, setting it to 2 will make the third sheet (Sheet3) the active sheet.
    • If an invalid index is provided (e.g., an index that is out of range of the available sheets), the ActiveSheetIndex will be automatically set to 0, making the first sheet active. For example, if a spreadsheet has 3 sheets and you set ActiveSheetIndex = 5, it will be automatically corrected to 0, making the first sheet active.

    AllowAutofill

    Gets or sets a value indicating whether Autofill functionality is enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowAutofill { get; set; }
    Property Value
    Type Description
    bool

    true if Autofill is enabled; otherwise, false. The default value is true.

    Remarks

      Autofill is a feature that automatically extends data patterns or formulas when you drag the fill handle  (the small square at the bottom-right corner of a selected cell or range). 

     

    When this property is set to true:

     
    • User can drag the fill handle to automatically fill adjacent cells based on patterns in the selected range.
    • The Autofill functionality works for numbers, dates, and more.
     

    When set to false:

     
    • The Autofill feature is disabled.
    • The fill handle will not be shown.
     

    Disabling this feature can be useful in scenarios where you want to prevent user from accidentally  modifying data through Autofill or when you need more control over data entry. 

    AllowCellFormatting

    Gets or sets a value indicating whether cell formatting—such as font styles, colors, borders, alignment, and wrap text— can be applied through the user interface or programmatically in the SfSpreadsheet.

    Declaration
    [Parameter]
    public bool AllowCellFormatting { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether cell formatting is enabled. The default value is true.

    Remarks

    When enabled (true), the spreadsheet allows formatting operations through both the ribbon interface and API methods such as SetBorders. Additionally, formatting from imported Excel files is preserved and rendered in the UI.

    When disabled (false), all formatting controls in the ribbon are deactivated, and programmatic formatting requests are ignored. Content from imported files is displayed without applying any formatting styles.

    This setting functions independently of worksheet protection. Even if AllowCellFormatting is false, formatting operations are globally restricted regardless of individual sheet protection settings.

    Disabling cell formatting is beneficial in scenarios such as:

    • Enforcing a consistent visual style across all spreadsheet instances.
    • Restricting visual customization in data entry–focused applications.
    • Presenting read-only reports where formatting changes are unnecessary.

    AllowConditionalFormat

    Gets or sets a value indicating whether conditional formatting rules—such as highlight cells rules, top/bottom value rules, data bars, color scales, and icon sets— can be applied or cleared through the user interface or programmatically in the SfSpreadsheet.

    Declaration
    [Parameter]
    public bool AllowConditionalFormat { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether conditional formatting is enabled. The default value is true.

    Remarks

    When enabled (true), users can apply and clear conditional formatting rules using the ribbon interface and programmatic API methods. Existing conditional formatting is rendered and visible on cells.

    When disabled (false), all conditional formatting operations are blocked:

    • The Conditional Formatting ribbon controls are deactivated.
    • Programmatic methods for adding, clearing, and clearing all conditional formats are blocked.
    • The Conditional Formatting dialog cannot be opened.
    • Existing conditional formats continue to render on cells but cannot be modified or removed.

    This setting operates independently of worksheet protection. Even if AllowConditionalFormat is false, conditional formatting operations are globally restricted regardless of individual sheet protection settings.

    Use cases for disabling conditional formatting:

    • Preventing users from modifying conditional formatting in read-only or controlled environments.
    • Ensuring pre-configured conditional formatting cannot be accidentally changed.
    • Simplifying the user interface for data entry scenarios where conditional formatting is not required.
    Examples
    <SfSpreadsheet DataSource="DataSourceBytes" AllowConditionalFormat="false></SfSpreadsheet> 
    @code { 
        private byte[] DataSourceBytes { get; set; } 
    
        protected override async Task OnInitializedAsync() { 
        { 
                string filePath = "D:/files/datasource.xlsx"; 
                DataSourceBytes = File.ReadAllBytes(filePath); 
        } 
    }

    AllowDelete

    Gets or sets a value indicating whether the Delete Sheets functionalities are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowDelete { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether delete functionality is enabled.
    The default value is true.

    Remarks

    This property controls whether users can sheets in the spreadsheet using the context menu or programmatic API methods.

    Key behaviors based on this property's value:

    • When true: Delete-related options are available in the context menu, allowing users to remove sheets as required.
    • When false: Delete options are disabled from the context menu respectively, preventing users from deleting sheets via the user interface or API methods.
    • IMPORTANT: When disabled, both UI interactions and programmatic API methods related to deleting sheets will not function.

    Use cases for disabling Delete functionality:

    • Preventing users from deleting sheets that are essential to the predefined structure of template-based spreadsheets.
    • Protecting critical or computed data by disallowing structural delete operations in regulated,auditing, or reporting scenarios.
    • Simplifying the user interface by removing delete sheets,reducing accidental data loss and improving user focus on data entry or review.

    AllowEditing

    Gets or sets a value indicating whether editing is allowed in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowEditing { get; set; }
    Property Value
    Type Description
    bool

    true if editing is allowed; otherwise, false. The default value is true.

    Remarks

    This property controls the editability of the spreadsheet. When set to true, user can:

    • Add new data to empty cells
    • Modify existing cell contents
    • Delete cell contents

    When set to false, the spreadsheet enters a read-only mode where:

    • User cannot add new data to cells
    • Existing cell contents cannot be modified
    • Cell contents cannot be deleted

    Setting this property to false is useful in scenarios where you want to display data without allowing user to make changes, such as in reporting applications or when presenting finalized data.

    AllowFiltering

    Gets or sets a value indicating whether filtering functionality is enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowFiltering { get; set; }
    Property Value
    Type Description
    bool

    true if filtering is allowed; otherwise, false. The default value is true.

    Remarks

    This property controls the availability of data filtering features within the spreadsheet. When set to true:

    • User can filter data based on various criteria such as text, numbers, or dates.
    • Filtering options are available in the user interface (e.g., column header filter buttons).
    • Programmatic filtering through the API remains functional.

    When set to false:

    • All filtering features are disabled.
    • Filter buttons are removed from column headers.
    • Filtering options are removed from the context menu and disabled in the ribbon, modifying the user interface.
    • Applying filters programmatically is not supported.

    Disabling filtering can be useful in scenarios where:

    • You want user to always see the complete dataset.
    • The spreadsheet is used primarily for data entry rather than data analysis.
    • You want to simplify the user interface by removing filtering options.

    AllowHyperlink

    Gets or sets a value indicating whether the Hyperlink feature and its related functionalities are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowHyperlink { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether hyperlink functionality is enabled. The default value is true.

    Remarks

    This property controls whether users can add, remove and interact with Hyperlinks in the spreadsheet cells using the context menu, ribbon, or programmatic API methods.

    Key behaviors based on this property's value:

    • When true: The Hyperlink option is available in the context menu and ribbon for applicable cells, allowing users to create and manage Hyperlinks.
    • When false:: The Hyperlink option is hidden and disabled from the context menu and ribbon respectively, preventing users from creating or managing Hyperlinks via the user interface or API methods.
    • IMPORTANT: When disabled, both UI interactions and programmatic API methods for hyperlink manipulation will not function.
    • IMPORTANT: Regardless of this property's value, hyperlinks will always be loaded and displayed when opening any Excel file.

    Use cases for disabling Hyperlinks:

    • Preventing users from adding external links in controlled environments.
    • Simplifying the user interface for specific data entry scenarios.
    • Maintaining data consistency in template-based spreadsheets.

    AllowImage

    Gets or sets a value indicating whether images can be inserted into the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowImage { get; set; }
    Property Value
    Type Description
    bool

    true if image insertion is allowed; otherwise, false. The default value is true.

    Remarks

    This property controls the ability to insert images into the spreadsheet. When set to true:

    • User can insert images through the user interface.
    • Existing images in the spreadsheet remain visible and can be manipulated.

    When set to false:

    • The option to insert images is disabled in the user interface.
    • Existing images in the spreadsheet remain visible and can be manipulated.

    AllowInsert

    Gets or sets a value indicating whether the Insert row, column, and Sheets functionalities are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowInsert { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether insert functionality is enabled. The default value is true.

    Remarks

    This property controls whether users can insert rows, columns and sheets in the spreadsheet using the context menu or programmatic API methods.

    Key behaviors based on this property's value:

    • When true: Insert-related options are available in the context menu , allowing users to add rows, columns and sheets as required.
    • When false: Insert options are disabled from the context menu respectively,preventing users from inserting rows, columns or sheets via the user interface or API methods.
    • IMPORTANT: When disabled, both UI interactions and programmatic API methods related to inserting rows, columns, cells, or sheets will not function.

    Use cases for disabling Insert functionality:

    • Preventing users from inserting rows, columns, or sheets that could alter the predefined layout or structure of template-based spreadsheets.
    • Ensuring data integrity by restricting structural insert operations in controlled data entry,auditing, or reporting scenarios where a fixed worksheet layout is required.
    • Simplifying the user interface by removing insert-related options for rows, columns, and sheets,reducing complexity for end users focused only on data input or review.

    AllowMerge

    Gets or sets a value indicating whether cell merging operations are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowMerge { get; set; }
    Property Value
    Type Description
    bool

    true if merge and unmerge operations are enabled; otherwise, false. The default value is true.

    Remarks

    This property controls the availability of Merge Cells, Merge Across, Merge & Center, and Unmerge features in both the user interface (e.g., ribbon) and the programmatic API.

    When set to true:

    • Users can merge and unmerge cells using the ribbon.
    • Programmatic merging via methods such as Merge and Unmerge is allowed.
    • Merged regions render with appropriate rowspan/colspan and follow Excel-like behavior.

    When set to false:

    • All merge-related UI commands are hidden/disabled.
    • Programmatic merge and unmerge calls are ignored or blocked.
    • Existing merged cells continue to render as-is but cannot be modified.

    Notes:

    • Workbook or sheet protection may still prevent merging even when this property is true.
    • Sorting/filtering and clipboard operations follow merge constraints; turning this property off does not change those rules.
    • Behavior aligns with Microsoft Excel: only the anchor (top-left) cell retains value and is editable in a merged region.
    Examples
    <SfSpreadsheet DataSource="DataSourceBytes" AllowMerge="false></SfSpreadsheet> 
    @code { 
        private byte[] DataSourceBytes { get; set; } 
    
        protected override async Task OnInitializedAsync() { 
        { 
                string filePath = "D:/files/datasource.xlsx"; 
                DataSourceBytes = File.ReadAllBytes(filePath); 
        } 
    }

    AllowNumberFormatting

    Gets or sets a value indicating whether number formatting—such as General, Number, Currency, Accounting, Date/Time, Percentage, Fraction, Scientific, and Text— can be applied through the user interface or programmatically in the SfSpreadsheet.

    Declaration
    [Parameter]
    public bool AllowNumberFormatting { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether number formatting is enabled. The default value is true.

    Remarks

    When enabled (true), users can apply number formats using the ribbon dropdown and programmatically via methods such as NumberFormatAsync(string, string).

    When disabled (false), the Number Format ribbon control is deactivated, and all programmatic formatting requests are ignored.

    This setting operates independently of worksheet protection. Even if AllowNumberFormatting is false, number formatting is globally restricted regardless of individual sheet protection settings.

    AllowOpen

    Gets or sets a value indicating whether the Open feature is enabled for the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowOpen { get; set; }
    Property Value
    Type Description
    bool

    true if opening/importing workbooks is allowed; otherwise, false. The default value is true.

    Remarks

    When set to true:

    • The Open/import command and file picker are available to users and programmatic calls are allowed.
    • Workbooks can be loaded or imported into the component.

    When set to false:

    • The Open/import UI and API are hidden or ignored.
    • Existing data already loaded remains unaffected.

    Notes:

    • Use this setting to disable client-side imports in read-only deployments.
    Examples
    <!-- Disable open/import UI in the component -->
    <SfSpreadsheet DataSource="DataSourceBytes" AllowOpen="false>
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet> 
    @code { 
        private byte[] DataSourceBytes { get; set; } 
    
        protected override async Task OnInitializedAsync() { 
        { 
                string filePath = "wwwroot/Sample.xlsx";
                DataSourceBytes = File.ReadAllBytes(filePath);
        } 
    }

    AllowResizing

    Gets or sets a value indicating whether resizing of columns and rows is allowed in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowResizing { get; set; }
    Property Value
    Type Description
    bool

    true if resizing of columns and rows is allowed; otherwise, false. The default value is true.

    Remarks

    This property controls the ability to resize columns and rows in the spreadsheet. When set to true:

    • User can manually resize columns by dragging the column header boundaries.
    • User can manually resize rows by dragging the row header boundaries.

    When set to false:

    • Manual resizing of columns and rows is disabled.
    • The resize handles on column and row headers will not be displayed.

    Disabling resizing can be useful in scenarios where:

    • You want to maintain a consistent layout across all users views of the spreadsheet.
    • The spreadsheet is part of a form with a fixed layout.
    • You want to prevent accidental resizing that might affect data visibility or printing layouts.

    AllowSave

    Gets or sets a value indicating whether the Save feature is enabled for the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowSave { get; set; }
    Property Value
    Type Description
    bool

    true if saving/exporting workbooks is allowed; otherwise, false. The default value is true.

    Remarks

    When set to true:

    • Save and export commands are available in the UI and can be invoked programmatically.
    • Users can download or export the workbook in supported formats.

    When set to false:

    • Save and export UI controls and API methods are hidden or ignored.
    • Attempts to save/export programmatically will be no-ops.

    Notes:

    • Use this flag to restrict client-side export capabilities in scenarios where file downloads should be prevented.
    Examples
    <!-- Disable save/export UI in the component -->
    <SfSpreadsheet DataSource="DataSourceBytes" AllowSave="false>
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet> 
    @code { 
        private byte[] DataSourceBytes { get; set; } 
    
        protected override async Task OnInitializedAsync() { 
        { 
                string filePath = "wwwroot/Sample.xlsx";
                DataSourceBytes = File.ReadAllBytes(filePath);
        } 
    }

    AllowSorting

    Gets or sets a value indicating whether sorting functionality is enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowSorting { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether sorting functionality is enabled. The default value is true.

    Remarks

    This property controls the availability of sorting features within the spreadsheet. When set to true:

    • User can sort data in ascending or descending order.
    • Sorting options are available in the user interface (e.g., context menus, ribbon).
    • Programmatic sorting through the API remains functional.

    When set to false:

    • All sorting features are disabled.
    • Sorting options are removed from the context menu and disabled in the ribbon, modifying the user interface.
    • Applying sorting programmatically is not supported.

    Disabling sorting can be useful in scenarios where:

    • Data order must be preserved for accuracy or consistency reasons.
    • The spreadsheet is part of a form or data entry interface where sorting could disrupt the workflow.
    • You want to simplify the user interface by removing sorting options.

    AllowTextWrap

    Gets or sets a value indicating whether the text wrapping functionality is enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowTextWrap { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether text wrapping is enabled.
    The default value is true.

    Remarks

    This property controls whether cell content can be wrapped within cells when the text exceeds the column width, instead of overflowing or being clipped.

    Key behaviors based on this property's value:

    • When true: Text wrapping options are enabled, allowing cell content to automatically wrap onto multiple lines within the same cell, adjusting row height as needed.
    • When false: Text wrapping is disabled, and long text remains on a single line,potentially overflowing into adjacent cells or being clipped based on layout.

    Use cases for enabling or disabling text wrapping:

    • Improving readability of long text values such as descriptions, comments,or notes by displaying the full content within a cell.
    • Maintaining a compact and consistent worksheet layout by disabling wrapping when fixed row heights or aligned grids are required.
    • Controlling visual presentation and performance in large spreadsheets by restricting automatic row height adjustments.

    AllowUndoRedo

    Gets or sets a value indicating whether the Undo and Redo functionalities are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool AllowUndoRedo { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether undo and redo functionality is enabled.
    The default value is true.

    Remarks

    This property controls whether users can undo or redo their actions in the spreadsheet, including data edits, formatting changes, and structural operations that support undo and redo functionality.

    Key behaviors based on this property's value:

    • When true: Undo and Redo options are enabled, allowing users to easily revert or reapply their recent actions using toolbar buttons, keyboard shortcuts, or programmatic API methods.
    • When false: Undo and Redo options are disabled, preventing users from reverting or reapplying any changes made through the user interface or API methods.

    Use cases for disabling Undo and Redo functionality:

    • Enforcing strict data entry workflows where changes must be committed immediately without the possibility of reversal.
    • Improving performance and reducing memory usage in large spreadsheets by disabling action history tracking.
    • Preventing accidental rollback of critical data changes in controlled or regulated environments.

    AutofillActionBegin

    Gets or sets an event callback that is raised before an Autofill operation is performed.

    Declaration
    [Parameter]
    [JsonIgnore]
    public EventCallback<AutofillActionBeginEventArgs> AutofillActionBegin { get; set; }
    Property Value
    Type Description
    EventCallback<AutofillActionBeginEventArgs>

    An event callback function that is triggered before an autofill operation.

    Remarks

    This event is triggered before an autofill action takes place. The event handler receives a AutofillActionBeginEventArgs object, which provides details of the autofill action. You can cancel the action by setting the Cancel property to true.

    Examples
    <SfSpreadsheet AutofillActionBegin="OnAutofillActionBegin"> 
    </SfSpreadsheet>
    
    @code { 
      public void OnAutofillActionBegin(AutofillActionBeginEventArgs args) 
      { 
          // Prevents the autofill action. 
          args.Cancel = true;
      } 
    }

    AutofillActionEnd

    Gets or sets an event callback that is raised after an Autofill operation is performed.

    Declaration
    [Parameter]
    [JsonIgnore]
    public EventCallback<AutofillActionEndEventArgs> AutofillActionEnd { get; set; }
    Property Value
    Type Description
    EventCallback<AutofillActionEndEventArgs>

    An event callback function that is triggered after an autofill operation.

    Remarks

    This event is triggered after an autofill action takes place. The event handler receives a AutofillActionEndEventArgs object, which provides details of the autofill action.

    Examples
    <SfSpreadsheet AutofillActionEnd="OnAutofillActionEnd"> 
    </SfSpreadsheet>
    
    @code { 
      public void OnAutofillActionEnd(AutofillActionEndEventArgs args) 
      { 
          // Implement the logic here. 
    
      } 
    }

    BeforeSave

    Gets or sets an event callback that is raised before saving the spreadsheet workbook.

    Declaration
    [Parameter]
    public EventCallback<BeforeSaveEventArgs> BeforeSave { get; set; }
    Property Value
    Type Description
    EventCallback<BeforeSaveEventArgs>

    An event callback that occurs immediately before the workbook is saved.

    Remarks

    This event handler receives a BeforeSaveEventArgs object with details of the pending save operation. You can cancel the save by setting Cancel to true, modify the output file name using FileName, or change the export format through SaveType.

    When exporting to PDF, additional layout options can be configured using PdfLayoutSettings to control page orientation, scaling, and sheet fitting behavior.

    Examples
    <SfSpreadsheet BeforeSave="OnBeforeSave">
    </SfSpreadsheet>
    
    @code {
        private void OnBeforeSave(BeforeSaveEventArgs args)
        {
            args.FileName = $"Report_{DateTime.UtcNow:yyyyMMdd_HHmm}";
    
            // Cancel the save to display custom UI and retry later if required
            args.Cancel = false;
    
            // Force PDF export
            args.SaveType = SaveType.Pdf;
    
            // Configure PDF layout options
            args.PdfLayoutSettings = new PdfLayoutSettings
            {
                FitSheetOnOnePage = true,
                Orientation = PdfPageOrientation.Landscape
            };
        }
    }

    CalculationMode

    Gets or sets the calculation mode that determines how formulas are recalculated in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public string CalculationMode { get; set; }
    Property Value
    Type Description
    string

    A string representing the calculation mode.
    The default value is "Automatic".

    Remarks

    This property controls when and how formula recalculations occur in the spreadsheet.It affects performance and data accuracy depending on the selected mode.

    Supported calculation modes and their behaviors:

    • "Automatic": Formulas are recalculated automatically whenever dependent cell values change, ensuring results are always up to date.
    • "Manual": Formulas are recalculated only when explicitly triggered through programmatic API calls, providing better performance for large or complex worksheets.

    Use cases for configuring the CalculationMode:

    • Improving performance in large spreadsheets by switching to manual calculationwhen frequent data updates are performed.
    • Ensuring real-time accuracy of formula results in data-driven or interactive spreadsheets by using automatic calculation mode.
    • Gaining explicit control over when calculations occur in scenarios such as bulk data imports or controlled recalculation workflows.

    CellEditing

    Gets or sets an event callback that is raised before a cell enters edit mode.

    Declaration
    [Parameter]
    [JsonIgnore]
    public Action<CellEditingEventArgs> CellEditing { get; set; }
    Property Value
    Type Description
    Action<CellEditingEventArgs>

    An Action<T> that represents the event handler for when cell editing begins. The default value is null.

    Remarks

    This event is triggered before a cell enters edit mode, providing an opportunity to cancel the operation.

    The event handler receives a CellEditingEventArgs object containing details about the cell being edited, including its address, current value, and position indices.

    Use this event to implement custom validation or to prevent editing in certain cells based on application logic.

    Examples

    This example shows how to handle the event to prevent editing in the first row.

    <SfSpreadsheet CellEditing="OnCellEditing">
    </SfSpreadsheet>
    
    @code {
        private void OnCellEditing(CellEditingEventArgs args)
        {
            // Prevents editing in the first row.
            if (args.RowIndex == 0)
            {
                args.Cancel = true;
            }
        }
    }

    CellSaved

    Gets or sets an event callback that is raised after a cell's value has been successfully saved, triggered by actions such as Edit, Cut, Paste, Autofill, etc.

    Declaration
    [Parameter]
    [JsonIgnore]
    public Action<CellSavedEventArgs> CellSaved { get; set; }
    Property Value
    Type Description
    Action<CellSavedEventArgs>

    An Action<T> that represents the event handler for the cell saved event. The default value is null.

    Remarks

    This event is triggered after a cell value is saved, providing details about the change.

    The event handler receives a CellSavedEventArgs object, which includes the cell's address, old and new values, and the action that triggered the save.

    Use this event to perform actions like logging changes, custom validation, or updating other parts of the application based on the new cell value.

    Examples

    This example demonstrates how to handle the cell saved event to log changes.

    <SfSpreadsheet CellSaved="OnCellSaved">
    </SfSpreadsheet>
    
    @code {
        private void OnCellSaved(CellSavedEventArgs args)
        {
            // Log the cell change, including the action that triggered it.
            Console.WriteLine($"Cell {args.Address} changed from '{args.OldValue}' to '{args.Value}' by {args.Action}.");
        }
    }

    ColumnCount

    Gets or sets the number of columns to be rendered in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public int ColumnCount { get; set; }
    Property Value
    Type Description
    int

    An integer representing the number of columns. The default value is 200.

    Remarks

    The ColumnCount property determines the number of columns that will be rendered in the Spreadsheet. This affects the horizontal size of the sheet and the amount of data that can be displayed at once.

    Important considerations:

    • When no data is provided, an empty sheet is rendered based on this value.
    • When data is provided (via byte array or imported file), additional empty columns are rendered to meet this count if necessary.
    • This property is used to implement finite scrolling, limiting the rendering of unnecessary empty cells.

    Adjusting this property impacts the rendering behavior and can affect performance. It's recommended to set it to a value that balances the amount of data to be displayed and the performance requirements of the application.

    ColumnResized

    Gets or sets an event callback that is raised when the column resizing ends.

    Declaration
    [Parameter]
    public EventCallback<ColumnResizedEventArgs> ColumnResized { get; set; }
    Property Value
    Type Description
    EventCallback<ColumnResizedEventArgs>

    An event callback function triggered when column resizing is completed.

    Remarks

    This event handler receives a ColumnResizedEventArgs object which provides the details of the resized column.

    Examples
    <SfSpreadsheet ColumnResized="OnColumnResized">
    </SfSpreadsheet>
    
    @code {
     public void OnColumnResized(ColumnResizedEventArgs args)
     {
        // Implement the logic here.
     }
    }

    ColumnResizing

    Gets or sets an event callback that is raised when column resizing starts.

    Declaration
    [Parameter]
    public EventCallback<ColumnResizingEventArgs> ColumnResizing { get; set; }
    Property Value
    Type Description
    EventCallback<ColumnResizingEventArgs>

    An event callback function triggered when column resizing begins.

    Remarks

    This event handler receives a ColumnResizingEventArgs object which provides the details of the resizing column.  You can prevent the resize action using Cancel event argument.

    Examples
    <SfSpreadsheet ColumnResizing="OnColumnResizing">  
    </SfSpreadsheet> 
    
    @code {  
        public void OnColumnResizing(ColumnResizingEventArgs args)  
        { 
          // Prevents the column resize.
            args.Cancel = true;  
        }  
    }

    CssClass

    Gets or sets the CSS class or classes to be applied to the Syncfusion.Blazor.Spreadsheet's root element.

    Declaration
    [Parameter]
    public string CssClass { get; set; }
    Property Value
    Type Description
    string

    A string containing one or more CSS class names separated by spaces. The default value is string.Empty.

    Remarks

    This property allows for customization of the appearance of the Spreadsheet component by applying CSS classes to its root element. The property can be used to add custom styles or override default styles.

    CustomFonts

    Gets or sets the collection of custom font file paths (relative to wwwroot ) used when exporting to PDF in WASM.

    Declaration
    [Parameter]
    public List<string> CustomFonts { get; set; }
    Property Value
    Type Description
    List<string>

    A List<T> of font file paths (for example: "Fonts/Arial.ttf").

    Remarks

    In WebAssembly (WASM) builds:

    • The component downloads the specified TTF/OTF files via HttpClient at export time.
    • The byte streams are provided to the PDF renderer so applied fonts are preserved in exported PDFs.

    On server renderings:

    • System-installed fonts are used instead of downloading custom ones.

    Notes:

    • Use this setting to ensure consistent font embedding in WASM deployments where client-side rendering requires explicit font files.
    Examples
    <!-- Configure custom fonts for PDF export -->
    <SfSpreadsheet @ref="SpreadsheetRef"
                   DataSource="@DataSourceBytes" CustomFonts="@CustomFonts">
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetRef;
        private byte[] DataSourceBytes { get; set; }
        private List<string> CustomFonts { get; set; }
    
        protected override async Task OnInitializedAsync()
        {
            // Local fonts (wwwroot/Fonts)
            CustomFonts = new List<string> { "Fonts/Arial.ttf", "Fonts/Georgia.ttf" };
    
            string filePath = "wwwroot/Sample.xlsx";
            DataSourceBytes = File.ReadAllBytes(filePath);
        }
    }

    CutCopyActionBegin

    Gets or sets an event callback that is raised before the copy or cut operation is performed.

    Declaration
    [Parameter]
    [JsonIgnore]
    public EventCallback<CutCopyActionBeginEventArgs> CutCopyActionBegin { get; set; }
    Property Value
    Type Description
    EventCallback<CutCopyActionBeginEventArgs>

    An event callback function that is triggered before the copy or cut operation.

    Remarks

    This event is triggered before the copy or cut action takes place. The event handler receives a CutCopyActionBeginEventArgs object, which provides details of the intended copy or cut action. You can cancel the action by setting the Cancel property to true.

    Examples
    <SfSpreadsheet CutCopyActionBegin="OnCutCopyActionBegin">
    </SfSpreadsheet>
    
    @code {
      public void OnCutCopyActionBegin(CutCopyActionBeginEventArgs args)
      {
          // Prevents the cut action.
          if (args.Action == "Cut")
          {
              args.Cancel = true;
          }
      }
    }

    DataSource

    Gets or sets the data source items to be used by the spreadsheet component. This property is used to render the Spreadsheet data while loading the component. It accepts byte arrays that can be generated from a file path or a base64 string.

    Declaration
    [Parameter]
    public byte[] DataSource { get; set; }
    Property Value
    Type Description
    byte[]

    A byte array (byte[]) representing the data from an Excel sheet. This byte array is processed and rendered in the UI.

    Remarks

    The DataSource property accepts a byte array that can be generated from:

    1. A base64 string converted to byte array
    2. A file path by reading the file as bytes This property is used to render the Spreadsheet data while loading the component, allowing users to interact with Excel data directly in the Blazor application.
    Examples
    <SfSpreadsheet DataSource="DataSourceBytes"></SfSpreadsheet>
    @code {
        private byte[] DataSourceBytes { get; set; }
    
        protected override async Task OnInitializedAsync() {
        {
                // Method 1: Reading from a file path
                string filePath = "D:/files/datasource.xlsx";
                DataSourceBytes = File.ReadAllBytes(filePath);
    
                // Method 2: Converting base64 string to byte array
                string base64String = "base64StringFromServer";
                DataSourceBytes = Convert.FromBase64String(base64String);
        }
    }

    EnableClipboard

    Gets or sets a value indicating whether clipboard operations (cut, copy, and paste) are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool EnableClipboard { get; set; }
    Property Value
    Type Description
    bool

    true if clipboard operations are enabled; otherwise, false. The default value is true.

    Remarks

    This property controls the availability of clipboard operations within the Spreadsheet. When set to true:

    • User can cut cells or ranges, copying their content to the clipboard and removing it from the source.
    • User can copy cells or ranges to the clipboard without affecting the source.
    • User can paste content from the clipboard into the Spreadsheet.
    • Clipboard operations are available through both user interface (e.g., context menus, keyboard shortcuts) and programmatic methods.

    When set to false:

    • All clipboard operations (cut, copy, and paste) are disabled.
    • Clipboard-related options have been removed from the context menu and disabled in the ribbon, modifying the user interface.
    • Standard keyboard shortcuts for clipboard operations (e.g., Ctrl+X, Ctrl+C, Ctrl+V) are non-functional within the Spreadsheet.
    • Attempts to perform clipboard operations programmatically are not supported.

    EnableContextMenu

    Gets or sets a value indicating whether the context menu option is enabled for the spreadsheet.

    Declaration
    [Parameter]
    public bool EnableContextMenu { get; set; }
    Property Value
    Type Description
    bool

    true if the context menu is enabled; otherwise, false. The default value is true.

    Remarks

    When enabled, the context menu will be available for the following elements:

    • Row headers
    • Column headers
    • Sheet tabs
    • Cells
    Disabling this property will remove the context menu from all these elements.

    EnableKeyboardNavigation

    Gets or sets a value indicating whether keyboard navigation is enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool EnableKeyboardNavigation { get; set; }
    Property Value
    Type Description
    bool

    true if keyboard navigation is enabled; otherwise, false. The default value is true.

    Remarks

    This property controls the ability to navigate within the spreadsheet using the keyboard. When set to true:

    • Users can move between cells using arrow keys, Tab, Shift+Tab, Enter, and Shift+Enter.
    • Keyboard-based cell selection and focus management are supported.
    • Navigation integrates seamlessly with other keyboard-enabled interactions such as editing and shortcuts.

    When set to false:

    • Keyboard-based navigation between cells is disabled.
    • Users must use mouse or touch interactions to change the active cell or selection.

    Disabling keyboard navigation can be useful in scenarios where:

    • You want to limit spreadsheet interaction to controlled UI elements.
    • Custom navigation logic is implemented externally.
    • Keyboard input should not affect focus movement within the spreadsheet.

    EnableKeyboardShortcut

    Gets or sets a value indicating whether keyboard shortcuts are enabled in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool EnableKeyboardShortcut { get; set; }
    Property Value
    Type Description
    bool

    true if keyboard shortcuts are enabled; otherwise, false. The default value is true.

    Remarks

    This property controls the availability of keyboard-based interactions within the spreadsheet. When set to true:

    • Shortcut keys enhance productivity by allowing faster interaction without relying on the mouse.

    When set to false:

    • All predefined keyboard shortcuts in the spreadsheet are disabled.
    • Users must rely on mouse interactions or UI controls to perform actions.

    Disabling keyboard shortcuts can be useful in scenarios where:

    • You want to restrict user interactions to prevent accidental actions.
    • The spreadsheet is embedded in an environment where keyboard input is centrally managed.
    • Accessibility or custom key-handling requirements conflict with default shortcuts.

    Height

    Gets or sets the height of the entire Syncfusion.Blazor.Spreadsheet component.

    Declaration
    [Parameter]
    public string Height { get; set; }
    Property Value
    Type Description
    string

    A string representing any valid CSS height value (e.g., "500px", "50vh", "100%"). The default value is auto.

    Remarks

    This property defines the vertical size of the spreadsheet component.

    Usage examples:

    • Set to a fixed pixel value: "500px"
    • Set to a percentage of the viewport height: "50vh"
    • Set to fill the parent container: "100%"
    • Allow the component to determine its own height: "auto"

    HyperlinkClick

    Event callback that triggers before a hyperlink is clicked, providing access to the HyperlinkClickEventArgs event arguments.

    Declaration
    [Parameter]
    public EventCallback<HyperlinkClickEventArgs> HyperlinkClick { get; set; }
    Property Value
    Type Description
    EventCallback<HyperlinkClickEventArgs>

    An event callback function triggered when a hyperlink is clicked.

    Remarks

    This callback enables the implementation of custom logic when a hyperlink is clicked. Properties of the HyperlinkClickEventArgs can be accessed and modified to control hyperlink click behavior.

    Examples
    <SfSpreadsheet HyperlinkClick="OnHyperlinkClick"> 
    </SfSpreadsheet> 
    
    @code { 
        private void OnHyperlinkClick(HyperlinkClickEventArgs args) 
        { 
            // Implement the logic here. 
        } 
    }

    HyperlinkCreated

    Event callback that triggers after a hyperlink is successfully inserted, providing access to the HyperlinkCreatedEventArgs event arguments.

    Declaration
    [Parameter]
    public EventCallback<HyperlinkCreatedEventArgs> HyperlinkCreated { get; set; }
    Property Value
    Type Description
    EventCallback<HyperlinkCreatedEventArgs>

    An event callback function triggered after a hyperlink is created.

    Remarks

    This callback enables post-processing actions following hyperlink creation.
    It occurs after the hyperlink is inserted and therefore cannot be used to prevent or modify the initial creation process.
    To intercept or modify hyperlink creation, use the HyperlinkCreating event instead.

    Examples
    <SfSpreadsheet HyperlinkCreated="OnHyperlinkCreated"> 
    </SfSpreadsheet> 
    
    @code { 
        private void OnHyperlinkCreated(HyperlinkCreatedEventArgs args) 
        { 
            // Implement the logic here.
        } 
    }

    HyperlinkCreating

    Event callback that triggers before a hyperlink is inserted, providing access to the HyperlinkCreatingEventArgs event arguments.

    Declaration
    [Parameter]
    public EventCallback<HyperlinkCreatingEventArgs> HyperlinkCreating { get; set; }
    Property Value
    Type Description
    EventCallback<HyperlinkCreatingEventArgs>

    An event callback function triggered before inserting a hyperlink.

    Remarks

    This callback enables the addition of custom logic prior to hyperlink creation, such as modifying the hyperlink target, or cancelling the creation process entirely. It facilitates interception and potential modification of the hyperlink insertion workflow.

    Examples
    <SfSpreadsheet HyperlinkCreating="OnHyperlinkCreating"> 
    </SfSpreadsheet> 
    
    @code { 
        private void OnHyperlinkCreating(HyperlinkCreatingEventArgs args) 
        { 
            // Implement the logic here.
        } 
    }

    ID

    Gets or sets the unique identifier for the Syncfusion.Blazor.Spreadsheet component.

    Declaration
    [Parameter]
    public string ID { get; set; }
    Property Value
    Type Description
    string

    A string representing the unique ID of the component. A random ID is generated by default.

    Remarks

    The ID property allows you to set a custom ID for the spreadsheet component in your Blazor application. This ID can be useful for targeting the spreadsheet in JavaScript operations (e.g., DOM manipulation, event handling) or for applying custom CSS styles. If no value is explicitly set, a random ID is automatically generated and used.

    Pasting

    Gets or sets an event callback that is raised before the paste operation is performed.

    Declaration
    [Parameter]
    [JsonIgnore]
    public EventCallback<PastingEventArgs> Pasting { get; set; }
    Property Value
    Type Description
    EventCallback<PastingEventArgs>

    An event callback function that is triggered before the paste operation.

    Remarks

    This event is triggered before the paste action takes place. The event handler receives a PastingEventArgs object, which provides details about the paste operation. You can cancel the paste action by setting the Cancel property to true.

    Examples
    <SfSpreadsheet Pasting="OnPasting">
    </SfSpreadsheet>
    
    @code {
      public void OnPasting(PastingEventArgs args)
      {
          // Prevents the paste action.
          if (args.PasteRange == "A1:B2")
          {
              args.Cancel = true;
          }
      }
    }

    RowCount

    Gets or sets the number of rows to be rendered in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public int RowCount { get; set; }
    Property Value
    Type Description
    int

    An integer representing the number of rows. The default value is 1000.

    Remarks

    The RowCount property determines the number of rows that will be rendered in the Spreadsheet. This affects the vertical size of the sheet and the amount of data that can be displayed at once.

    Important considerations:

    • When no data is provided, an empty sheet is rendered based on this value.
    • When data is provided (via byte array or imported file), additional empty rows are rendered to meet this count if necessary.
    • This property is used to implement finite scrolling, limiting the rendering of unnecessary empty cells.

    Adjusting this property impacts the rendering behavior and can affect performance. It's recommended to set it to a value that balances the amount of data to be displayed and the performance requirements of the application.

    RowResized

    Gets or sets an event callback that is raised when the row resizing ends.

    Declaration
    [Parameter]
    public EventCallback<RowResizedEventArgs> RowResized { get; set; }
    Property Value
    Type Description
    EventCallback<RowResizedEventArgs>

    An event callback function triggered when row resizing is completed.

    Remarks

    This event handler receives a RowResizedEventArgs object which provides the details of the resized row.

    Examples
    <SfSpreadsheet RowResized="OnRowResized">
    </SfSpreadsheet>
    
    @code {
     public void OnRowResized(RowResizedEventArgs args)
     {
        // Implement the logic here.
     }
    }

    RowResizing

    Gets or sets an event callback that is raised when row resizing starts.

    Declaration
    [Parameter]
    public EventCallback<RowResizingEventArgs> RowResizing { get; set; }
    Property Value
    Type Description
    EventCallback<RowResizingEventArgs>

    An event callback function triggered when row resizing begins.

    Remarks

    This event handler receives a RowResizingEventArgs object which provides the details of the resizing row. You can prevent the resize action using Cancel.

    Examples
    <SfSpreadsheet RowResizing="OnRowResizing">
    </SfSpreadsheet>
    
    @code {
     public void OnRowResizing(RowResizingEventArgs args)
     {
        // Prevents the row resize.
        args.Cancel = true;
     }
    }

    Selected

    Gets or sets an event callback that is raised after a cell or range selection operation is performed in the spreadsheet.

    Declaration
    [Parameter]
    [JsonIgnore]
    public EventCallback<SelectedEventArgs> Selected { get; set; }
    Property Value
    Type Description
    EventCallback<SelectedEventArgs>

    An event callback function triggered after the selection operation occurs.

    Remarks

    This event is triggered following the selection of a cell or range.
    The event handler receives a SelectedEventArgs object containing details about the selection operation.

    Examples
    <SfSpreadsheet Selected="OnSelected"> 
    </SfSpreadsheet>
    
    @code { 
      public void OnSelected(SelectedEventArgs args) 
      { 
          // Implement custom logic here.
      } 
    }

    ShowAggregate

    Gets or sets a value indicating whether aggregate values—such as sum, average, count, minimum, and maximum calculations— can be displayed or hidden in the Footer component of the SfSpreadsheet.

    Declaration
    [Parameter]
    public bool ShowAggregate { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether aggregate values are displayed. The default value is true.

    Remarks

    When enabled (true), aggregate calculations are computed and displayed in the Footer component with an accessible Aggregate DropDown Button. Users can interact with aggregates through the user interface.

    When disabled (false), aggregate operations are restricted:

    • The Aggregate DropDown Button is hidden from the UI.
    • Aggregate calculations are not displayed in the Footer component.
    • Programmatic aggregate operations are blocked.
    Examples
    <SfSpreadsheet DataSource="DataSourceBytes" ShowAggregate="false">
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    @code {
        private byte[] DataSourceBytes { get; set; }
    
        protected override async Task OnInitializedAsync() {
            string filePath = "wwwroot/Sample.xlsx";
            DataSourceBytes = File.ReadAllBytes(filePath);
        }
    }

    ShowFormulaBar

    Gets or sets a value indicating whether the formula bar is displayed in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool ShowFormulaBar { get; set; }
    Property Value
    Type Description
    bool

    A bool indicating whether the formula bar is shown. The default value is true.

    Remarks

    This property controls the visibility of the formula bar in the spreadsheet.

    When set to true, the formula bar is displayed, allowing users to view and edit cell formulas and values.

    When set to false, the formula bar is hidden, potentially simplifying the user interface for scenarios where formula editing is not required.

    The formula bar provides a dedicated area for viewing and editing cell contents, particularly useful when working with complex formulas.

    ShowSheetTabs

    Gets or sets a value indicating whether the sheet tabs are visible in the Syncfusion.Blazor.Spreadsheet.

    Declaration
    [Parameter]
    public bool ShowSheetTabs { get; set; }
    Property Value
    Type Description
    bool

    true if the sheet tab bar is displayed; otherwise, false. The default value is true.

    Remarks

    When set to true:

    • The sheet tab bar is visible, allowing users to switch between sheets using the UI.
    • Sheet-management actions in the tab area (for example add/rename/delete) are available if the related features are enabled.

    When set to false:

    • The sheet tab bar is hidden and users cannot switch sheets via tabs in the UI.
    • Sheet-management UI in the tab area is not available; sheets can still be changed programmatically via the API.
    Examples
    <SfSpreadsheet DataSource="DataSourceBytes" ShowSheetTabs="false>
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet> 
    @code { 
        private byte[] DataSourceBytes { get; set; } 
    
        protected override async Task OnInitializedAsync() { 
        { 
                string filePath = "wwwroot/Sample.xlsx";
                DataSourceBytes = File.ReadAllBytes(filePath);
        } 
    }

    Width

    Gets or sets the width of the entire Syncfusion.Blazor.Spreadsheet component.

    Declaration
    [Parameter]
    public string Width { get; set; }
    Property Value
    Type Description
    string

    A string representing any valid CSS width value (e.g., "100%", "800px", "75vw"). The default value is auto.

    Remarks

    This property defines the horizontal size of the spreadsheet component.

    Usage examples:

    • Set to fill the parent container: "100%"
    • Set to a fixed pixel value: "800px"
    • Set to a percentage of the viewport width: "75vw"
    • Allow the component to determine its own width: "auto"

    WorksheetAdding

    Gets or sets an event callback that is raised when new sheet is inserted.

    Declaration
    [Parameter]
    public EventCallback<WorksheetAddingEventArgs> WorksheetAdding { get; set; }
    Property Value
    Type Description
    EventCallback<WorksheetAddingEventArgs>

    An event callback function triggered before new sheet inserts.

    Remarks

    This event handler receives a WorksheetAddingEventArgs object which provides the details of the new sheet insert. You can prevent the sheet insert action using Cancel event argument. You can change the sheet name using Name event argument. You can change the sheet inserting index by using Index event argument.

    Examples
    <SfSpreadsheet WorksheetAdding="OnWorkSheetAdding">
    </SfSpreadsheet>
    
    @code {
       public void OnWorkSheetAdding(WorksheetAddingEventArgs args)
       {
         // Changes the sheet name
         args.Name = "Blazor":
    
         // Changes the sheet inserting index
         args.Index = 3;
    
         // Prevents the sheet insertion for Index 2.
         if(args.Index == 2){
            args.Cancel = true;
         }
    
       }
    }

    Methods

    AddDefinedNameAsync(string, string, string)

    Adds a defined name (named range) to the spreadsheet that references a specific cell or range.

    Declaration
    public Task AddDefinedNameAsync(string name, string range, string scope = null)
    Parameters
    Type Name Description
    string name

    The name for the defined range. The name must be unique within the specified scope and follow naming conventions (e.g., alphanumeric characters and underscores, cannot start with a number).

    string range

    The cell range or cell reference that the defined name will reference. Supported formats include:

    • Single cell reference (e.g., "A1" or "Sheet1!B2")
    • Range reference (e.g., "A1:B10" or "Sheet1!C1:D20")
    • Non-contiguous ranges (e.g., "A1:A5,C1:C5")
    string scope

    Optional. The scope of the defined name. Supported values:

    • "Workbook" - Available throughout the entire workbook (default)
    • Sheet name (e.g., "Sheet1") - Available only on the specified sheet
    If null or empty, defaults to "Workbook" scope.
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method adds a defined name to the spreadsheet with the specified reference and scope. Named ranges simplify formulas, improve readability, and enhance spreadsheet usability by allowing users to reference ranges by meaningful names instead of cell addresses.

    The method will return false and not perform the operation if any of these conditions are met:

    • The name parameter is null, empty, or contains invalid characters.
    • The range parameter is null or empty.
    • The specified range is invalid or out of worksheet boundaries.
    • A defined name with the same name already exists in the specified scope.
    • The workbook or worksheets collection is null or empty.
    • The specified scope sheet does not exist in the workbook.

    After successful addition, the defined name is immediately available for use in formulas throughout the spreadsheet (or sheet-specific scope if specified).

    Examples
    <SfButton OnClick="AddDefinedNameHandler" Content="Add Named Range"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task AddDefinedNameHandler()
        {
            // Add a defined name to reference a single cell with workbook scope
            await SpreadsheetInstance.AddDefinedNameAsync("CompanyName", "Sheet1!B2");
    
            // Add a defined name to reference a range with default workbook scope
            await SpreadsheetInstance.AddDefinedNameAsync("SalesData", "A1:B10");
    
            // Add a defined name with sheet-specific scope
            await SpreadsheetInstance.AddDefinedNameAsync("LocalRange", "C1:D20", "Sheet1");
    
            // Add a defined name for a non-contiguous range
            await SpreadsheetInstance.AddDefinedNameAsync("SelectedCells", "A1:A5,C1:C5");
        }
    }

    AddFileMenuItems(List<MenuItem>, int)

    Adds new items to the File menu in the ribbon.

    Declaration
    public void AddFileMenuItems(List<MenuItem> menuItems, int index)
    Parameters
    Type Name Description
    List<MenuItem> menuItems

    A collection of MenuItem objects to add to the File menu.

    • Invalid or null items are silently ignored.
    • An empty collection will result in no items being added.
    int index

    The zero-based index at which to insert the menu items within the File menu.

    Remarks

    This method allows dynamic addition of custom menu items to the File menu at runtime. Items are inserted at the specified index position.

    If the index is out of range, the operation is silently ignored without throwing an error.

    Added menu items are immediately visible in the File menu interface and become available for user interaction.

    Examples

    The following example demonstrates how to add items to the File menu:

     <SfButton OnClick="AddAtPositionHandler" Content="Add At Position"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
    
         private void AddAtPositionHandler()
         {
             // Add Export as CSV menu item at index 2
             var items = new List<MenuItem>
             {
                 new MenuItem { Text = "Export as CSV", Id = "exportCsv" }
             };
             SpreadsheetInstance.AddFileMenuItems(items, index: 2);
         }
     }

    AddHyperlinkAsync(string, string, string)

    Adds a hyperlink to a specified cell or range of cells in the spreadsheet.

    Declaration
    public Task AddHyperlinkAsync(string cellAddress, string uri, string displayText = null)
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell or range of cells where the hyperlink will be inserted. This can be:

    string uri

    The URI representing either a web address or a cell reference. This can point to an external website or to a specific cell within the same sheet or across different sheets.

    string displayText

    The text to be displayed in the cell. This is an optional parameter. If not provided, the cell's existing value will be used as the display text. If the cell is empty, the hyperlink URL will be used as the display text by default.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of adding the hyperlink to the specified cell or range.

    Remarks

    The method allows adding a hyperlink to a specified cell or range of cells in the spreadsheet.

    • The cellAddress parameter determines the location where the hyperlink will be added, using standard cell notation (e.g., "A1") or an explicit sheet reference (e.g., "Sheet1!A1").
    • The uri parameter defines the link target. It can be a URL or a reference to another cell, either within the same sheet or on a different sheet.
    • The optional displayText parameter allows specifying custom display text. If omitted, the existing cell value will be used; if the cell is empty, the hyperlink itself will be displayed as the text.

    This operation requires the AllowHyperlink property to be set to true. If AllowHyperlink is set to false, this method will not add hyperlinks to the spreadsheet.

    Sheet protection affects hyperlink insertion. If the sheet is protected, hyperlinks can only be added if:

    • The "Insert Hyperlinks" option is checked in the Sheet Protection Options dialog
    • The target cell or range is in an unlocked area of the protected sheet

    The method will validate the sheet name and cell address before adding any hyperlink. If an invalid sheet name or cell address is provided, the hyperlink will not be added, and no error will be thrown.

    Examples
    // Example: Adding a hyperlink to a cell with a custom display text.
    await spreadsheet.AddHyperlinkAsync("A4", "https://example.com", "Click here");
    
    // Example: Adding a hyperlink to another sheet within the same spreadsheet.
    await spreadsheet.AddHyperlinkAsync("Sheet2!B2", "https://example.com");
    
    // Example: Adding a hyperlink without specifying display text (will use the cell value or hyperlink as the display text).
    await spreadsheet.AddHyperlinkAsync("A8", "https://example.com");
    
    // Example: Adding a hyperlink to a range of cells.
    await spreadsheet.AddHyperlinkAsync("A1:A5", "https://example.com", "Range Link");
    
    // Example: Setting AllowHyperlink property
    spreadsheet.AllowHyperlink = true; // Enable hyperlinks
    await spreadsheet.AddHyperlinkAsync("A10", "https://example.com", "Enabled Link");
    
    spreadsheet.AllowHyperlink = false; // Disable hyperlinks
    // This call won't add a hyperlink because AllowHyperlink is false
    await spreadsheet.AddHyperlinkAsync("A11", "https://example.com", "This won't work");

    AddRibbonItems(string, List<RibbonItem>, int, RibbonGroup)

    Adds ribbon items to a specified tab at the designated collection index.

    Declaration
    public void AddRibbonItems(string tabName, List<RibbonItem> items, int index, RibbonGroup group = null)
    Parameters
    Type Name Description
    string tabName

    The ribbon tab name to target. Tab names are case-insensitive and match the localized text (e.g., "Home", "Insert").

    List<RibbonItem> items

    A collection of RibbonItem objects to add to the ribbon tab.

    int index

    The zero-based collection index where items should be inserted within the tab.

    RibbonGroup group

    An RibbonGroup to create before adding the items. If null, items are added to an existing group at the specified index. The default value is null.

    Remarks

    This method adds custom ribbon items to a specified tab at runtime. Items are inserted at the specified index position within the tab's collection.

    If a group is provided, a new ribbon group is created before adding the items. If no group is provided, items are added to an existing group at the specified index.

    Added items become immediately visible in the ribbon interface. You can handle item click events to customize actions by setting the Clicked property of button settings or configuring other item-specific event handlers.

    If the specified tab name or index does not exist, the operation is silently ignored without throwing an error.

    Examples

    The following example demonstrates how to add ribbon items with custom click actions:

    <SfButton OnClick="AddCustomButton" Content="Add Custom Button"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance">
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private void AddCustomButton()
        {
            // Create a button with custom click action using EventCallback
            var item = new RibbonItem
            {
                ID = "Sheet Analysis",
                Type = RibbonItemType.Button,
                ButtonSettings = new RibbonButtonSettings
                {
                    Content = "Full Sheet Analysis",
                    // Wire click action using EventCallback.Factory.Create
                    OnClick = EventCallback.Factory.Create<MouseEventArgs>(this, OnSheetClicked)
                }
            };
    
            // Add item at index 3 in the Home tab
            SpreadsheetInstance.AddRibbonItems("Home", new List<RibbonItem> { item }, index: 3);
        }
    
        private void OnSheetClicked(MouseEventArgs args)
        {
            // Custom analysis logic here
            Console.WriteLine("Sheet Analysis button clicked");
            // Perform sheet analysis operations
        }
    }

    AddRibbonTab(RibbonTab, int)

    Adds a new custom tab to the spreadsheet ribbon.

    Declaration
    public void AddRibbonTab(RibbonTab tab, int index)
    Parameters
    Type Name Description
    RibbonTab tab

    The RibbonTab model to add to the ribbon. The tab can contain custom groups and items.

    int index

    The zero-based index at which to insert the new tab within the ribbon.

    Remarks

    This method adds a custom ribbon tab at the specified index position. The tab can contain custom groups and items for extending the ribbon functionality.

    Added tabs become immediately visible in the ribbon interface and are accessible for user interaction.

    This method does not affect the File menu dropdown, as it is a menu component rather than a ribbon tab.

    Examples

    The following example demonstrates how to add custom tabs to the ribbon:

    <SfButton OnClick="AddTabAtPosition" Content="Add Tab At Position"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance">
         <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private void AddTabAtPosition()
        {
            // Add a custom tab at index 2 (third position)
            var tab = new RibbonTab { Header = "My Tools", Id = "myToolsTab" };
            SpreadsheetInstance.AddRibbonTab(tab, index: 2);
        }
    }

    AutofillAsync(string, string?)

    Performs an auto-fill operation in the active sheet.

    Declaration
    public Task AutofillAsync(string fillRange, string? dataRange = null)
    Parameters
    Type Name Description
    string fillRange

    The address of the range to fill. This must be a valid cell range address (e.g., "A1:A10").

    string dataRange

    The address of the range containing the data to use for filling. If null, the active cell is used as the data source.

    Returns
    Type Description
    Task

    A Task representing the asynchronous auto-fill operation.

    Remarks

    This method performs the auto-fill operation and refreshes the content of the spreadsheet after completion.

    The method will not perform the operation if any of these conditions are met:

    • The worksheet is password protected
    • The range is outside the worksheet boundaries
    • Invalid range addresses are provided
    • The AllowAutofill property is set to false
    • If fillRange and dataRange are in lowercase like this a1:a1
    Examples
    <SfButton OnClick="AutofillHandler" Content="Auto Fill"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task AutofillHandler()
        {
            // Auto-fills the range A1:A10 downward using the value from cell A1.
             await SpreadsheetInstance.AutofillAsync("A1:A10", "A1");
    
            // Auto-fills the range B1:E1 rightward using the value from cell B1.
             await SpreadsheetInstance.AutofillAsync("B1:E1", "B1");
    
            // Uses the active cell as the data source with default direction (Down)
            await SpreadsheetInstance.AutofillAsync("C1:C10");
        }
    }

    BuildRenderTree(RenderTreeBuilder)

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

    CalculateAsync()

    Asynchronously recalculates all formulas across all worksheets in the workbook.

    Declaration
    public Task CalculateAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method iterates through all worksheets in the workbook and recalculates all uncalculated formulas in each worksheet.

    The operation is skipped if the workbook or worksheets collection is null, or if there are no worksheets available in the workbook.

    Examples

    The following example demonstrates how to recalculate all formulas in the entire workbook:

    <SfButton OnClick="RecalculateWorkbookHandler" Content="Calculate Workbook"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task RecalculateWorkbookHandler()
        {
            // Recalculate all formulas in all worksheets
            await SpreadsheetInstance.CalculateAsync();
        }
    }

    CalculateAsync(int)

    Asynchronously recalculates all formulas in the worksheet at the specified index.

    Declaration
    public Task CalculateAsync(int sheetIndex)
    Parameters
    Type Name Description
    int sheetIndex

    The zero-based index of the worksheet to calculate.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method recalculates all uncalculated formulas in the worksheet at the specified sheetIndex.

    The operation is skipped if the workbook or worksheets collection is null, or if the sheetIndex is outside the valid range (less than 0 or exceeds the worksheet count).

    Examples

    The following example demonstrates how to recalculate formulas in a specific worksheet by index:

    <SfButton OnClick="RecalculateSheetHandler" Content="Calculate Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task RecalculateSheetHandler()
        {
            // Recalculate formulas in the first sheet (index 0)
            await SpreadsheetInstance.CalculateAsync(0);
    
            // Recalculate formulas in the second sheet (index 1)
            await SpreadsheetInstance.CalculateAsync(1);
        }
    }

    CalculateAsync(string)

    Asynchronously recalculates all formulas in the specified worksheet.

    Declaration
    public Task CalculateAsync(string sheetName)
    Parameters
    Type Name Description
    string sheetName

    The name of the worksheet to calculate. The comparison is case-insensitive.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method recalculates all uncalculated formulas in the worksheet that matches the specified sheetName.

    The operation is skipped if the workbook, worksheets collection is null, or if no worksheet matches the provided name.

    Examples

    The following example demonstrates how to recalculate formulas in a specific worksheet by name:

    <SfButton OnClick="RecalculateSheetHandler" Content="Calculate Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task RecalculateSheetHandler()
        {
            // Recalculate all formulas in Sheet1
            await SpreadsheetInstance.CalculateAsync("Sheet1");
    
            // Recalculate all formulas in Sheet2 (case-insensitive)
            await SpreadsheetInstance.CalculateAsync("sheet2");
        }
    }

    CellFormatAsync(CellFormat, string)

    Applies a set of style attributes to the specified cell or range of cells on the active worksheet by using a CellFormat. This method allows you to customize the visual appearance of cells including font properties, colors, alignment, and text decoration.

    Declaration
    public Task CellFormatAsync(CellFormat style, string cellRange = null)
    Parameters
    Type Name Description
    CellFormat style

    A CellFormat object containing the style attributes to apply. Supported properties include:

    • BackgroundColor: Cell background color in hexadecimal or named CSS color format (e.g., "#4B5366", "red")
    • Color: Font color in hexadecimal or named CSS color format (e.g., "#FFFFFF", "blue")
    • FontFamily: Font family (e.g., Arial, TimesNewRoman)
    • FontSize: Font size with unit (e.g., "14pt", "12px")
    • FontWeight: Font weight (e.g., Bold, Normal)
    • FontStyle: Font style (e.g., Italic, Normal)
    • TextDecoration: Text decoration (e.g., Underline, LineThrough)
    • TextAlign: Horizontal text alignment (e.g., Center, Left, Right)
    • VerticalAlign: Vertical text alignment (e.g., Middle, Top, Bottom)
    string cellRange

    A string representing the A1 or A1:A10 range to which the style should be applied.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method applies cell formatting while respecting feature switches and worksheet protection. It returns early without taking any action if formatting is disabled.

    • Returns immediately if AllowCellFormatting is false.
    • If the target sheet is protected and cell formatting is restricted, the operation is blocked.
    • If style is null, the method returns without applying any formatting.
    • If cellRange contains lowercase cell references (e.g., "a1:b2"), the operation will fail silently.
    • If an invalid range address or an out-of-range value is provided, a validation dialog is displayed, and the operation returns without applying any styles.
    • The range parameter is case-sensitive and should use uppercase cell references (e.g., "A1:B5", not "a1:b5").

    If cellRange is null or empty, the style is applied to the current selection or active cell.

    When FontSize or FontFamily properties are modified, row height is automatically adjusted to accommodate the new font dimensions for the affected range.

    Examples

    Demonstrates applying custom cell styles using CellFormatAsync(CellFormat, string):

    • A header style with bold font and centered alignment to a specific range on current active sheet.
    • A custom font style to the current selection.
    • A background color style to a single cell.
    <SfButton OnClick="ApplyStyles" Content="Apply Cell Styles"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ApplyStyles()
        {
            // Apply header style to range A1:C1 on current active sheet.
            var headerStyle = new CellFormat
            {
                BackgroundColor = "#4B5366",
                Color = "#FFFFFF",
                FontStyle = FontStyle.Italic,
                FontSize = "14pt",
                FontWeight = FontWeight.Bold,
                TextAlign = TextAlign.Center,
                VerticalAlign = VerticalAlign.Middle,
                FontFamily = FontFamily.Arial,
                TextDecoration = TextDecoration.Underline
            };
            await SpreadsheetInstance.CellFormatAsync(headerStyle, "A1:C1");
    
            // Apply custom font style to current selection
            var customStyle = new CellFormat
            {
                FontFamily = FontFamily.Calibri,
                FontSize = "12pt",
                Color = "#2196F3"
            };
            await SpreadsheetInstance.CellFormatAsync(customStyle);
    
            // Apply background color to cell D1
            var highlightStyle = new CellFormat
            {
                BackgroundColor = "#FFEB3B"
            };
            await SpreadsheetInstance.CellFormatAsync(highlightStyle, "D1");
        }
    }

    ClearAllFiltersAsync()

    Clears all filters applied to the active sheet.

    Declaration
    public Task ClearAllFiltersAsync()
    Returns
    Type Description
    Task

    A task representing the asynchronous clear all filters operation.

    Remarks

    This method removes all filters applied to any column in the active worksheet.

    After clearing all filters, it updates the user interface to show all previously hidden rows.

    This method will not work if the AllowFiltering property is set to false.

    This method will not work if the sheet is protected and the Filter option is disabled in sheet protection options.

    Examples
    <SfButton OnClick="ClearAllFilters" Content="Clear All Filters"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ClearAllFilters()
        {
            await SpreadsheetInstance.ClearAllFiltersAsync();
        }
    }

    ClearAsync(ClearOperationType, string)

    Asynchronously clears contents, formatting, hyperlinks, or all aspects of the specified range or current selection in the spreadsheet.

    Declaration
    public Task ClearAsync(ClearOperationType options, string range = null)
    Parameters
    Type Name Description
    ClearOperationType options

    Specifies the type of clear operation to perform:

    • ClearContents clears only the cell values.
    • ClearFormats clears only the cell formatting.
    • ClearHyperlinks removes hyperlinks from cells.
    • ClearAll clears contents, formatting, and hyperlinks.
    string range

    The A1-style range to clear in the format "SheetName!CellAddress" (for example, "Sheet1!A1:B5"). Sheet names are case-insensitive. If null or empty, the current selection will be used.

    Returns
    Type Description
    Task

    A Task representing the asynchronous clear operation.

    Remarks

    This method parses the provided range and resolves the target worksheet and range before performing the clear operation.

    If range is null or empty, the operation is applied to the current selection.

    The clear operation is applied using the internal controller, which handles history tracking and UI refresh.

    The operation will not be performed under the following conditions: the range cannot be parsed into a valid sheet index or address, the specified range is invalid for the target worksheet, or the target selection could not be prepared successfully.

    Examples

    The following example demonstrates how to clear different aspects of cells in the spreadsheet:

    <SfButton OnClick="ClearHandler" Content="Clear Cells"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ClearHandler()
        {
            // Clears only contents from range A1:A10 on Sheet1
            await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearContents, "Sheet1!A1:A10");
    
            // Clears only formats from the current selection
            await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearFormats);
    
            // Clears hyperlinks from range B1:B10 on Sheet2
            await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearHyperlinks, "Sheet2!B1:B10");
    
            // Clears all (contents, formats, and hyperlinks) from range C1:C10 on Sheet2
            await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearAll, "Sheet2!C1:C10");
        }
    }

    ClearConditionalFormatsAsync(string)

    Removes conditional formatting rules from a worksheet range asynchronously.

    Declaration
    public Task ClearConditionalFormatsAsync(string range = null)
    Parameters
    Type Name Description
    string range

    An optional A1-style range address (for example, "A1:B10") from which conditional formatting rules should be removed. If null or empty, all conditional formatting rules on the active worksheet will be cleared.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of removing conditional formatting rules.

    Remarks

    This method removes conditional formatting rules applied to the specified range or the entire active worksheet. When a range is provided, only rules affecting that range are removed. If no range is specified, all rules on the active worksheet are cleared.

    The operation will not be performed if any of the following conditions are met:

    • AllowConditionalFormat is set to false
    • AllowCellFormatting is set to false
    • The worksheet is protected and does not allow formatting changes
    • The specified range is invalid or outside worksheet bounds

    After successful removal, the worksheet is refreshed to reflect the updated formatting state.

    Examples
    <SfButton OnClick="ClearConditionalRules" Content="Clear Conditional Rules"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private async Task ClearConditionalRules()
        {
            // Remove conditional formatting rules from a specific range
            await SpreadsheetInstance.ClearConditionalFormatsAsync("A1:A10");
    
            // Remove all conditional formatting rules from the active worksheet
            await SpreadsheetInstance.ClearConditionalFormatsAsync();
        }
    }

    ClearFilterAsync(int)

    Clears the filter applied to a specific column in the active sheet.

    Declaration
    public Task ClearFilterAsync(int columnIndex)
    Parameters
    Type Name Description
    int columnIndex

    The zero-based index of the column whose filter is to be cleared.

    Returns
    Type Description
    Task

    A task representing the asynchronous clear filter operation.

    Remarks

    This method removes any filters applied to the specified column index in the active sheet.

    After clearing the filter, it updates the user interface to show previously hidden rows.

    This method will not work if the AllowFiltering property is set to false.

    This method will not work if the sheet is protected and the Filter option is disabled in sheet protection options.

    Examples
    <SfButton OnClick="ClearColumnFilter" Content="Clear Filter"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ClearColumnFilter()
        {
            // Clear filter from Column A (Index = 0).
            await SpreadsheetInstance.ClearFilterAsync(0);
        }
    }

    ConditionalFormatAsync(ConditionalFormatRule)

    Adds a conditional formatting rule to a worksheet range asynchronously.

    Declaration
    public Task ConditionalFormatAsync(ConditionalFormatRule rule)
    Parameters
    Type Name Description
    ConditionalFormatRule rule

    A ConditionalFormatRule object that defines the conditional formatting rule to apply. If the Range property is null or empty, the currently selected range from the active worksheet will be used.

    The rule definition may include the following important properties:

    • ConditionalFormatType - Specifies the type of rule (e.g., greater than, less than, between, equal to, iconsets etc..)
    • Value - The comparison value(s) used by the rule
    • Range - Target cell range for the rule
    • Format - A CellFormat object specifying styles such as colors or font
    • ConditionalFormatColor - Preset style for highlight and top/bottom rules
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of applying the conditional formatting rule.

    Remarks

    This method applies a conditional formatting rule to the specified or active range in the worksheet. Conditional formatting enhances spreadsheet readability by automatically applying visual styles based on cell values or expressions.

    Supported rule categories include:

    • Highlight Rules (e.g., GreaterThan, LessThan, Between, EqualTo, Duplicate, Unique)
    • Top/Bottom Rules (e.g., Top10Items, Bottom10Percent)
    • Data Bars - Visual bars representing relative values
    • Color Scales - Gradient-based coloring based on cell values
    • Icon Sets - Icons representing value ranges

    The operation will not be performed if any of the following conditions are met:

    • rule is null
    • AllowCellFormatting is set to false
    • AllowConditionalFormat is set to false
    • The worksheet is protected and does not allow cell formatting
    • The specified range is invalid or outside worksheet bounds
    • The rule contains invalid criteria or improperly formatted values

    The worksheet is automatically refreshed after applying the rule to reflect updated formatting. Multiple rules can be applied to the same range and are evaluated based on their order of creation.

    Examples
    <SfButton OnClick="ApplyConditionalRule" Content="Apply Conditional Rule"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private async Task ApplyConditionalRule()
        {
            var rule = new ConditionalFormatRule
            {
                ConditionalFormatType = ConditionalFormatType.GreaterThan,
                PrimaryValue = "100",
                Range = "A1:A10",
                Format = new CellFormat { BackgroundColor = "#FFCDD2" }
            };
    
            await SpreadsheetInstance.ConditionalFormatAsync(rule);
        }
    }

    CopyCellAsync(string)

    Copies the specified cell or range and its properties, such as value, format, style, etc., to the clipboard asynchronously. This operation will not work if the sheet is protected or if the EnableClipboard property is set to false.

    Declaration
    public Task CopyCellAsync(string cellAddress = "")
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell or range to be copied. The parameter accepts various formats:

    - Single cell reference (e.g., "A1")

    - Cell range (e.g., "A1:B5")

    - Sheet-specific reference (e.g., "Sheet1!A1" or "Sheet2!A1:C5")

    If no address is provided, the last selected range will be used. If no range was previously selected, the active cell will be copied.

    Returns
    Type Description
    Task

    A Task that represents the asynchronous copy operation.

    Remarks

    This method will not work if the sheet is protected or if the EnableClipboard property is set to false.

    When calling without a cell address parameter, the operation uses the last selected range. If no selection exists, it defaults to the active cell.

    This operation will not execute if invalid cell references or out-of-boundary ranges are provided. Ensure all cell addresses are within the valid worksheet boundaries.

    Examples

    The following example demonstrates how to copy cells in a spreadsheet:

    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public List<Order> Orders { get; set; }
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task CopyActiveCell()
        {
            // To copy from the current cell.
            await SpreadsheetInstance.CopyCellAsync();
        }
    
        public async Task CopyValues()
        {
            // To copy from the specified cell.
            await SpreadsheetInstance.CopyCellAsync("A2");
        }
    
        public async Task CopyCell()
        {
            // The address, along with the sheet name, to be copied.
            await SpreadsheetInstance.CopyCellAsync("Sheet1!B2");
        }
    
        public async Task CopyRange()
        {
            // To copy a range of cells.
            await SpreadsheetInstance.CopyCellAsync("A1:D10");
        }
    
        public async Task CopyRangeFromSpecificSheet()
        {
            // To copy a range from a specific sheet.
            await SpreadsheetInstance.CopyCellAsync("Sheet2!B3:E8");
        }
    }

    CutCellAsync(string)

    Cuts the specified cell or range and its properties, such as value, format, style, etc., to the clipboard asynchronously. This operation will not work if the sheet is protected or if the EnableClipboard property is set to false.

    Declaration
    public Task CutCellAsync(string cellAddress = "")
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell or range to be cut. The parameter accepts various formats:

    - Single cell reference (e.g., "A1")

    - Cell range (e.g., "A1:B5")

    - Sheet-specific reference (e.g., "Sheet1!A1" or "Sheet2!A1:C5")

    If no address is provided, the last selected range will be used. If no range was previously selected, the active cell will be cut.

    Returns
    Type Description
    Task

    A Task that represents the asynchronous cut operation.

    Remarks

    This method will not work if the sheet is protected or if the EnableClipboard property is set to false.

    When calling without a cell address parameter, the operation uses the last selected range. If no selection exists, it defaults to the active cell.

    This operation will not execute if invalid cell references or out-of-boundary ranges are provided. Ensure all cell addresses are within the valid worksheet boundaries.

    Examples
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public List<Order> Orders { get; set; }
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task CutActiveCell()
        {
            // To cut from the current cell.
            await SpreadsheetInstance.CutCellAsync();
        }
        public async Task CutValues()
        {
            // To cut from the specified cell.
            await SpreadsheetInstance.CutCellAsync("A2");
        }
        public async Task CutCell()
        {
            // The address, along with the sheet name, to be cut.
            await SpreadsheetInstance.CutCellAsync("Sheet1!B2");
        }
        public async Task CutRange()
        {
            // To cut a range of cells.
            await SpreadsheetInstance.CutCellAsync("A1:D10");
        }
        public async Task CutRangeFromSpecificSheet()
        {
            // To cut a range from a specific sheet.
            await SpreadsheetInstance.CutCellAsync("Sheet2!B3:E8");
        }
    }

    DeleteSheetAsync(int?)

    Deletes a worksheet at the specified index from the spreadsheet. If no index is specified, deletes the active sheet.

    Declaration
    public Task DeleteSheetAsync(int? sheetIndex = null)
    Parameters
    Type Name Description
    int? sheetIndex

    The zero-based index of the worksheet to delete. If null, the currently active sheet will be deleted.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of deleting the specified worksheet.

    Remarks

    This method performs the following operations:

    If the specified sheet index is invalid, the method returns without performing any operation.

    If there is only one sheet in the spreadsheet, the deletion will not proceed to ensure at least one sheet always remains.

    Additionally, if the workbook is protected, the sheet deletion operation will not be performed.

    When the AllowDelete property is set to false, the method returns silently.

    Examples
    <SfButton OnClick="DeleteSheetHandler" Content="Delete Current Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task DeleteSheetHandler()
        {
            // Delete the active sheet.
            await SpreadsheetInstance.DeleteSheetAsync();
        }
    
        public async Task DeleteSpecificSheetHandler()
        {
            // Delete the sheet at index 2 (the third sheet).
            await SpreadsheetInstance.DeleteSheetAsync(2);
        }
    }

    DeleteSheetAsync(string)

    Deletes a worksheet with the specified name from the spreadsheet. If the specified sheet is the only worksheet in the spreadsheet, the deletion will not proceed to maintain at least one worksheet at all times.

    Declaration
    public Task DeleteSheetAsync(string sheetName)
    Parameters
    Type Name Description
    string sheetName

    The name of the worksheet to delete. Case-insensitive comparison is used to find the matching worksheet.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of deleting the specified worksheet.

    Remarks

    This method performs the following operations:

    If the sheet name is not found, the method returns without performing any operation.

    If there is only one sheet in the spreadsheet, the deletion will not proceed to ensure at least one sheet always remains.

    Additionally, if the workbook is protected, the sheet deletion operation will not be performed.

    Examples
    <SfButton OnClick="DeleteNamedSheetHandler" Content="Delete Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task DeleteNamedSheetHandler()
        {
            // Delete a sheet by name.
            await SpreadsheetInstance.DeleteSheetAsync("Sheet1");
        }
    }

    DisableContextMenuItems(List<string>)

    Disables the specified context menu items in the spreadsheet.

    Declaration
    public void DisableContextMenuItems(List<string> Items)
    Parameters
    Type Name Description
    List<string> Items

    A collection of context menu item identifiers or display texts to disable (e.g., "Cut", "Copy", "Paste").

    Remarks
    • The operation is ignored if Items is null or empty.
    • Invalid or non-existent item identifiers are silently ignored.
    • Disabled items remain visible in the context menu but cannot be selected or used.
    Examples
    <SfButton OnClick="DisableMenuItems" Content="Disable Items"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void DisableMenuItems()
        {
            // Disable Cut and Copy menu items
            SpreadsheetInstance.DisableContextMenuItems(new List<string> { "Cut", "Copy" });
    
            // Disable Delete menu item
            SpreadsheetInstance.DisableContextMenuItems(new List<string> { "Delete" });
        }
    }

    DisableFileMenuItems(List<string>)

    Disables the specified File menu items by their display text or ID.

    Declaration
    public void DisableFileMenuItems(List<string> menuItemIds)
    Parameters
    Type Name Description
    List<string> menuItemIds

    A collection of menu item display texts or IDs to target. Display text matching is case-insensitive. For separators, pass their ID.

    • Invalid or non-existent menu item texts are silently ignored.
    • An empty collection will result in no items being affected.
    • Matching is case-insensitive for display text, so "Save", "save", and "SAVE" all refer to the same menu item.
    Remarks

    This method allows dynamic control over File menu item availability at runtime. When items are disabled, they appear grayed out but remain visible in the menu.

    Menu item targeting is performed by display text or ID. Display text matching is case-insensitive for flexibility.

    If a specified text or ID does not exist in the File menu, the operation ignores it without throwing an error and proceeds with the remaining items.

    Disabled menu items remain functional through keyboard shortcuts or programmatic API calls. only the menu interface interaction is restricted.

    Examples

    The following example demonstrates how to disable File menu items:

     <SfButton OnClick="DisableFileItemsHandler" Content="Disable File Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
    
         private void DisableFileItemsHandler()
         {
             // Disable New and Save As menu items
             SpreadsheetInstance.DisableFileMenuItems(new List<string> { "New", "Save As" });
         }
     }

    DisableRibbonItems(List<string>)

    Disables ribbon items by their item IDs using standardized names.

    Declaration
    public void DisableRibbonItems(List<string> itemIds)
    Parameters
    Type Name Description
    List<string> itemIds
    Remarks

    This method disables ribbon items by their IDs. When items are disabled, they appear grayed out but remain visible in the ribbon interface.

    Item IDs support standardized naming conventions (e.g., "bold", "italic") for consistency and ease of use.

    • Item ID matching is case-insensitive
    Examples

    The following example demonstrates how to disable ribbon items:

     <SfButton OnClick="DisableItems" Content="Disable Items"></SfButton>
     <SfSpreadsheet @ref="SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         public SfSpreadsheet SpreadsheetInstance { get; set; }
    
         public void DisableItems()
         {
             SpreadsheetInstance.DisableRibbonItems(new List<string> { "bold", "italic" });
         }
     }

    DisableRibbonTabs(List<string>)

    Disables the specified ribbon tabs in the spreadsheet component.

    Declaration
    public void DisableRibbonTabs(List<string> tabs)
    Parameters
    Type Name Description
    List<string> tabs

    An array of tab names to disable. The tab names are case-insensitive and are matched against the available ribbon tabs.

    • Invalid or non-existent tab names are silently ignored.
    • An empty array will result in no tabs being affected.
    Remarks

    This method allows dynamic control over ribbon tab state at runtime. When tabs are disabled, they appear grayed out in the ribbon interface and are not clickable.

    Tab name matching is case-insensitive, so "Home", "home", and "HOME" all refer to the same tab.

    If a tab name does not exist in the ribbon, the operation ignores it without throwing an error and proceeds with the remaining tabs.

    When the currently active tab is disabled, the focus automatically switches to the next available enabled tab to maintain a valid active state.

    Disabled tabs remain visible in the ribbon but with reduced opacity and no interactivity.

    Examples

    The following example demonstrates how to disable ribbon tabs:

     <SfButton OnClick="DisableTabsHandler" Content="Disable Review Tab"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
     @code {
         public SfSpreadsheet SpreadsheetInstance { get; set; }
    
         public void DisableTabsHandler()
         {
             // Disable the Insert and Data tabs.
             SpreadsheetInstance.DisableRibbonTabs(new List<string> { "Insert", "Data" });
         }
     }

    DuplicateSheetAsync(int?)

    Duplicates a sheet in the spreadsheet, creating an exact copy with a sequential naming convention.

    Declaration
    public Task DuplicateSheetAsync(int? sheetIndex = null)
    Parameters
    Type Name Description
    int? sheetIndex

    The zero-based index position of the sheet to duplicate within the spreadsheet's sheet collection. If null, the currently active sheet will be duplicated.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of duplicating the sheet.

    Remarks

    This method creates an exact copy of the specified sheet, including all data, formatting, formulas, and styling. The duplicated sheet is inserted immediately after the original sheet in the sheet collection.

    If the specified sheet index is out of range, the operation will fail silently. Ensure the index is within the valid range of existing sheets before calling this method.

    This operation will not be performed if the workbook is protected. Sheet duplication is disabled when workbook protection is enabled.

    Examples

    The following example demonstrates how to duplicate sheets in a spreadsheet component:

    <SfButton OnClick="DuplicateActiveSheet" Content="Duplicate Active Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        // Duplicate the currently active sheet
        private async Task DuplicateActiveSheet()
        {
            // Duplicates the active sheet.
            await SpreadsheetInstance.DuplicateSheetAsync();
        }
    
        // Duplicate a specific sheet by index
        private async Task DuplicateSpecificSheet()
        {
            // Duplicates the first sheet.
            await SpreadsheetInstance.DuplicateSheetAsync(0);
        }
    }

    DuplicateSheetAsync(string)

    Duplicates a sheet in the spreadsheet by its name, creating an exact copy with a sequential naming convention. The duplicated sheet preserves all content, formatting, formulas, and visual elements of the original.

    Declaration
    public Task DuplicateSheetAsync(string sheetName)
    Parameters
    Type Name Description
    string sheetName

    The name of the sheet to duplicate within the spreadsheet's sheet collection. The sheet name matching is case-insensitive.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of duplicating the sheet.

    Remarks

    This method creates an exact copy of the specified sheet identified by its name, including all data, formatting, formulas, and styling. The duplicated sheet is inserted immediately after the original sheet in the sheet collection.

    If the specified sheet name does not exist in the spreadsheet, the operation will fail silently. Ensure the sheet name exists before calling this method.

    This operation will not be performed if the workbook is protected. Sheet duplication is disabled when workbook protection is enabled.

    Examples

    The following example demonstrates how to duplicate a sheet by name in a spreadsheet component:

    <SfButton OnClick="DuplicateSheetHandler" Content="Duplicate Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private async Task DuplicateSheetHandler()
        {
            // Duplicate a sheet by name.
            await SpreadsheetInstance.DuplicateSheetAsync("Sheet1");
        }
    }

    EnableContextMenuItems(List<string>)

    Enables the specified context menu items in the spreadsheet.

    Declaration
    public void EnableContextMenuItems(List<string> Items)
    Parameters
    Type Name Description
    List<string> Items

    A collection of context menu item identifiers or display texts to enable (e.g., "Cut", "Copy", "Paste").

    Remarks
    • The operation is ignored if Items is null or empty.
    • Invalid or non-existent item identifiers are silently ignored.
    • Enabled items become selectable and functional in the context menu.
    Examples
    <SfButton OnClick="EnableMenuItems" Content="Enable Items"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void EnableMenuItems()
        {
            // Enable Cut and Copy menu items
            SpreadsheetInstance.EnableContextMenuItems(new List<string> { "Cut", "Copy" });
    
            // Enable Paste menu item
            SpreadsheetInstance.EnableContextMenuItems(new List<string> { "Paste" });
        }
    }

    EnableFileMenuItems(List<string>)

    Enables File menu items by their display text or ID.

    Declaration
    public void EnableFileMenuItems(List<string> menuItemIds)
    Parameters
    Type Name Description
    List<string> menuItemIds

    A collection of menu item display texts or IDs to target. Display text matching is case-insensitive. For separators, pass their ID.

    • Invalid or non-existent menu item texts are silently ignored.
    • An empty collection will result in no items being affected.
    • Matching is case-insensitive for display text, so "Save", "save", and "SAVE" all refer to the same menu item.
    Remarks

    This method allows dynamic control over File menu item availability at runtime. When items are enabled, they appear with normal appearance in the menu and are fully functional.

    Menu item targeting is performed by display text or ID. Display text matching is case-insensitive for flexibility.

    Enabled menu items are fully functional through the menu interface as well as keyboard shortcuts.

    Examples

    The following example demonstrates how to enable File menu items:

     <SfButton OnClick="EnableFileItemsHandler" Content="Enable File Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
    
         private void EnableFileItemsHandler()
         {
             // Enable New and Save As menu items
             SpreadsheetInstance.EnableFileMenuItems(new List<string> { "New", "Save As" });
         }
     }

    EnableRibbonItems(List<string>)

    Enables ribbon items by their item IDs using standardized names.

    Declaration
    public void EnableRibbonItems(List<string> itemIds)
    Parameters
    Type Name Description
    List<string> itemIds
    Remarks

    This method enables ribbon items by their IDs. When items are enabled, they appear with normal appearance and remain fully functional in the ribbon interface.

    Item IDs support standardized naming conventions (e.g., "bold", "italic") for consistency and ease of use.

    • Item ID matching is case-insensitive
    Examples

    The following example demonstrates how to enable ribbon items:

     <SfButton OnClick="EnableItems" Content="Enable Items"></SfButton>
     <SfSpreadsheet @ref="SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         public SfSpreadsheet SpreadsheetInstance { get; set; }
    
         public void EnableItems()
         {
             SpreadsheetInstance.EnableRibbonItems(new List<string> { "bold", "italic" });
         }
     }

    EnableRibbonTabs(List<string>)

    Enables the specified ribbon tabs in the spreadsheet component.

    Declaration
    public void EnableRibbonTabs(List<string> tabs)
    Parameters
    Type Name Description
    List<string> tabs

    A collection of tab names to enable. The tab names are case-insensitive and are matched against the available ribbon tabs.

    • Invalid or non-existent tab names are silently ignored.
    • An empty collection will result in no tabs being affected.
    Remarks

    This method allows dynamic control over ribbon tab state at runtime. When tabs are enabled, they appear with normal opacity in the ribbon interface and are fully clickable and functional.

    Tab name matching is case-insensitive, so "Home", "home", and "HOME" all refer to the same tab.

    If a tab name does not exist in the ribbon, the operation ignores it without throwing an error and proceeds with the remaining tabs.

    Enabled tabs are immediately interactive and accessible to users.

    Examples

    The following example demonstrates how to enable ribbon tabs:

     <SfButton OnClick="EnableTabsHandler" Content="Enable Tabs"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
     @code {
         public SfSpreadsheet SpreadsheetInstance { get; set; }
    
         public void EnableTabsHandler()
         {
             // Enable the Insert and Data tabs.
             SpreadsheetInstance.EnableRibbonTabs(new List<string> { "Insert", "Data" });
         }
     }

    FilterByCellValueAsync(string, object)

    Asynchronously filters a column in the active sheet based on a specific cell value. This method filters using the specified cell address as the filter criteria.

    Declaration
    public Task FilterByCellValueAsync(string cellAddress, object cellValue)
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell that contains the filter criteria. This must be a valid cell address (e.g., "A1").

    object cellValue

    The value to filter by. This must not be null.

    Returns
    Type Description
    Task

    A Task representing the asynchronous filter operation.

    Remarks

    This method applies a filter to the column specified by cellAddress using the provided cellValue.

    If no filter range is defined, it automatically sets the filter range to the used range of the worksheet.

    The filter operation will not proceed under the following conditions:

    • The AllowFiltering property is set to false.
    • If cellAddress is null, empty, or contains spaces.
    • If cellValue is null.
    • If the cell reference part of cellAddress is in lowercase (e.g., "a1").
    • If the value at cellAddress does not match cellValue.
    • If the cell address is outside valid worksheet boundaries.
    • If the worksheet is password-protected and filtering is not allowed for the specified range.
    • Multiple non-contiguous ranges are selected
    Examples
    <SfButton OnClick="ApplyFilter" Content="Filter by Value"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ApplyFilter()
        {
            // Applies a filter to Column A, displaying rows that contain the value "New York".
            await SpreadsheetInstance.FilterByCellValueAsync("A1", "New York");
        }
    }

    GetActiveWorksheet()

    Retrieves key properties of the active worksheet, such as its name, index, size, active cell, and the current selection.

    Declaration
    public Worksheet GetActiveWorksheet()
    Returns
    Type Description
    Worksheet

    A Worksheet populated with:

    • Name � Worksheet name
    • Index � Worksheet index
    • RowCount � Total number of rows
    • ColumnCount � Total number of columns
    • ActiveCell � Current active cell address
    • SelectedRange � Current selected range
    Returns null when no active Worksheet is available.
    Examples
    // Get the active sheet snapshot
    var active = spreadsheet.GetActiveWorksheet();
    if (active != null)
    {
        Console.WriteLine($"{active.Name} [{active.Index}] - Selected: {active.SelectedRange}");
    }

    GetData(string)

    Gets data for a single cell or a selected range and returns a map keyed by each cell's address. Each value is a CellData built from the corresponding worksheet cell, including value, format, formatted display text (when a format is applied), wrap state, lock state, optional hyperlink, and computed style.

    Declaration
    public Dictionary<string, CellData> GetData(string cellAddress)
    Parameters
    Type Name Description
    string cellAddress

    The cell or selected range to read. Supported forms:

    • Single cell (e.g., "A1")
    • Selected range (e.g., "A2:B5")
    • Sheet-qualified (e.g., "Sheet1!A1" or "Sheet1!A2:B5")
    When a worksheet name is included, data is read from that worksheet; otherwise, the active worksheet is used.
    Returns
    Type Description
    Dictionary<string, CellData>
    • Value � Raw/underlying cell value text
    • Format � Number format string, or null when it is "General"
    • DisplayText � displayText text that is displayed to the user in the cell's UI; otherwise
    • Hyperlink � Link address when present and the cell does not contain a formula
    • Wraptext � Whether wrap text is enabled
    • isLocked � Whether the cell is locked
    • Style � Computed style payload for the cell
    Returns null when cellAddress is null or whitespace.
    Remarks

    Number format "General" is treated as no explicit format; in that case, Format is null and FormattedText is not populated.

    Hyperlink is exposed only when the cell has a hyperlink and does not contain a formula.

    Keys in the returned dictionary use an OrdinalIgnoreCase comparer.

    Examples
    // Single cell
    var a1 = spreadsheet.GetData("A1");
    
    // Selected range
    var block = spreadsheet.GetData("B2:C4");
    
    // Sheet-qualified selected range
    var other = spreadsheet.GetData("Sheet2!D5:E6");

    GetDisplayText(string)

    Returns the display text representation of a cell based on its address.

    Declaration
    public string GetDisplayText(string cellAddress)
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell to retrieve display text from. Supported forms:

    • "A1" (active sheet)
    • "Sheet1!A1" (specific sheet) If invalid or not found, returns an empty string.
    Returns
    Type Description
    string

    A string containing the formatted display text of the cell. Falls back to the raw cell value if no formatting is applied.

    Remarks
    • Returns the cell's formatted display text if available; otherwise, returns the cell value converted to string.
    • Returns an empty string if the sheet name is not found or the cell address is invalid.
    • Supports both local cell addresses (e.g., "A1") and sheet-qualified addresses (e.g., "Sheet1!A1").
    Examples
    <SfButton OnClick="GetCellDisplayText" Content="Get Display Text"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void GetCellDisplayText()
        {
            // Get display text from active sheet
            var text1 = SpreadsheetInstance.GetDisplayText("A1");
    
            // Get display text from specific sheet
            var text2 = SpreadsheetInstance.GetDisplayText("Sheet1!B5");
    
            // Get display text for a cell with formatting
            var text3 = SpreadsheetInstance.GetDisplayText("Sheet2!C10");
        }
    }

    HideFileMenuItems(List<string>)

    Hides File menu items by their display text.

    Declaration
    public void HideFileMenuItems(List<string> menuItemIds)
    Parameters
    Type Name Description
    List<string> menuItemIds

    A collection of menu item display texts to target. Display text matching is case-insensitive. For separators, pass their ID.

    • Invalid or non-existent menu item texts are silently ignored.
    • An empty collection will result in no items being affected.
    • Matching is case-insensitive, so "Open", "open", and "OPEN" all refer to the same menu item.
    Remarks

    This method allows dynamic control over File menu item visibility at runtime. When items are hidden, they are completely removed from the menu interface.

    Menu item targeting is performed by display text. Display text matching is case-insensitive for flexibility.

    If a specified text does not exist in the File menu, the operation ignores it without throwing an error and proceeds with the remaining items.

    Hidden menu items remain functional through keyboard shortcuts or programmatic API calls. only the menu interface visibility is removed.

    Examples

    The following example demonstrates how to hide File menu items:

     <SfButton OnClick="HideFileItemsHandler" Content="Hide File Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
    
         private void HideFileItemsHandler()
         {
             // Hide Open and Print menu items
             SpreadsheetInstance.HideFileMenuItems(new List<string> { "Open", "Print" });
         }
     }

    HideRibbonItems(List<string>)

    Hides ribbon items by their item IDs using standardized names.

    Declaration
    public void HideRibbonItems(List<string> itemIds)
    Parameters
    Type Name Description
    List<string> itemIds
    Remarks

    This method allows dynamic control over ribbon item visibility at runtime. When items are hidden, they are completely removed from the ribbon interface.

    Item IDs support standardized naming conventions (e.g., "bold", "italic", "underline") for consistency and ease of use.

    Item IDs are case-insensitive for matching purposes. If an item ID does not exist, the operation ignores it without throwing an error and proceeds with the remaining IDs.

    Hidden items are only visually removed from the interface. The functionality remains available through keyboard shortcuts or programmatic API calls.

    Examples

    The following example demonstrates how to hide ribbon items:

     <SfButton OnClick="HideItemsHandler" Content="Hide Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
         private void HideItemsHandler()
         {
             // Hide specific items by ID
             SpreadsheetInstance.HideRibbonItems(new List<string> { "bold", "italic", "underline" });
         }
     }

    HideRibbonTabs(List<string>)

    Hides the specified ribbon tabs in the spreadsheet.

    Declaration
    public void HideRibbonTabs(List<string> tabs)
    Parameters
    Type Name Description
    List<string> tabs

    A collection of tab names to hide. Tab names are case-insensitive and match against available ribbon tabs (e.g., "Home", "Insert", "Formulas", "Data", "View").

    Remarks

    This method controls ribbon tab visibility at runtime. When tabs are hidden, they are completely removed from the ribbon interface but their functionality remains accessible through keyboard shortcuts or programmatic API calls.

    If tabs is null or empty, no tabs will be affected. Invalid or non-existent tab names are silently ignored without throwing an error.

    Tab name matching is case-insensitive, so "Home", "home", and "HOME" all refer to the same tab.

    This method does not affect the File menu dropdown, as it is a menu component rather than a ribbon tab.

    Examples

    The following example demonstrates how to hide ribbon tabs:

    <SfButton OnClick="HideTabsHandler" Content="Hide Tabs"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance">
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private void HideTabsHandler()
        {
            // Hide the Insert and View tabs
            SpreadsheetInstance.HideRibbonTabs(new List<string> { "Insert", "View" });
        }
    }

    InsertColumnAsync(int, int, object, ColumnPosition)

    Represents a method that inserts columns at the specified position in the SfSpreadsheet.

    Declaration
    public Task InsertColumnAsync(int columnIndex, int count, object sheet = null, ColumnPosition position = ColumnPosition.Right)
    Parameters
    Type Name Description
    int columnIndex

    The zero-based index where the columns should be inserted. If position is Right, columns will be inserted after this index. If position is Left, columns will be inserted at this index.

    int count

    The number of columns to insert. Must be greater than zero.

    object sheet

    The target worksheet where columns will be inserted. Accepts either a sheet index (integer) or sheet name (string). sheet name is case-insensitive If null, the active sheet will be used. When using an index, note that it is zero-based (i.e., the first sheet is index 0).

    ColumnPosition position

    Specifies the position relative to columnIndex where columns should be inserted. Valid values are Right or Left. The default value is Right.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of inserting columns.

    Remarks

    This method inserts the specified number of columns at the given position in the spreadsheet. When columns are inserted:

    • Existing columns at and after the insertion point are shifted to the right
    • Cell references, formulas, and formatting are automatically updated to reflect the new column positions
    • Selection is maintained and adjusted based on the insertion position

    Sheet protection affects column insertion. If the sheet is protected, columns can only be inserted if:

    • The "Insert Columns" is enabled in the sheet protection options
    • Otherwise, the operation will be silently ignored

    The method validates the sheet, columnIndex, and column count before performing any operation:

    • If the column count is less than or equal to zero, the method will return without performing any operation
    • If the column index is negative or exceeds the available columns, or the sheet index is out of range, the operation will be silently ignored without throwing an error
    • When theAllowInsert property is set to false, the method returns silently.

    For performance considerations, it is recommended to keep the columnCount value as low as possible when inserting multiple columns.

    Examples
    <SfButton OnClick="InsertColumnsHandler" Content="Insert Columns"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance;
    
        public async Task InsertColumnsHandler()
        {
            // Insert 2 columns to the right of column index 2
            await SpreadsheetInstance.InsertColumnAsync(2, 2);
    
            // Insert 3 columns to the left of column index 5
            await SpreadsheetInstance.InsertColumnAsync(5, 3, null, ColumnPosition.Left);
    
            // Insert 1 column to the right of column B in Sheet2
            await SpreadsheetInstance.InsertColumnAsync(1, 1, "Sheet2", ColumnPosition.Right);
    
            // Insert 4 columns to the left of column D in the sheet at index 3
            await SpreadsheetInstance.InsertColumnAsync(3, 4, 3, ColumnPosition.Left);
        }
    }

    InsertRowAsync(int, int, object, RowPosition)

    Inserts rows in the spreadsheet at a specified index, either above or below the target row.

    Declaration
    public Task InsertRowAsync(int rowIndex, int count, object sheet = null, RowPosition position = RowPosition.Above)
    Parameters
    Type Name Description
    int rowIndex

    The zero-based index where the rows should be inserted. If position is Below, rows will be inserted after this index. If position is Above, rows will be inserted at this index.

    int count

    The number of rows to insert. Must be greater than zero.

    object sheet

    The target worksheet where rows will be inserted. Accepts either a sheet index (integer) or sheet name (string). sheet name is case-insensitive. If null, the active sheet will be used. When using an index, note that it is zero-based (i.e., the first sheet is index 0).

    RowPosition position

    Specifies the position relative to rowIndex where rows should be inserted. Valid values are Above or Below. The default value is Above.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of inserting rows.

    Remarks

    This method inserts the specified number of rows at the given position in the spreadsheet. When rows are inserted:

    • Existing rows at and after the insertion point are shifted downward
    • Cell references, formulas, and formatting are automatically updated to reflect the new row positions
    • Selection is maintained and adjusted based on the insertion position

    Sheet protection affects row insertion. If the sheet is protected, rows can only be inserted if:

    • The "Insert Rows" option is enabled in the sheet protection
    • Otherwise, the row insertion will be silently ignored

    The method validates the sheet index, row index, and row count before performing any operation:

    • If the row count is less than or equal to zero, the method will return without performing any operation
    • If the row index is negative or exceeds the available rows, or the sheet index is out of range, the operation will be silently ignored without throwing an error
    • When theAllowInsert property is set to false, the method returns silently.

    For performance considerations, it is recommended to keep the count value as low as possible when inserting multiple rows.

    Examples
    <SfButton OnClick="InsertRowsHandler" Content="Insert Rows"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance;
    
        public async Task InsertRowsHandler()
        {
            // Insert 2 rows above row index 0 in the active sheet
            await SpreadsheetInstance.InsertRowAsync(0, 2);
    
            // Insert 3 rows below row index 2 in the sheet named "Sheet2"
            await SpreadsheetInstance.InsertRowAsync(2, 3, "Sheet2", RowPosition.Below);
    
            // Insert 1 row above row index 1 in the active sheet
            await SpreadsheetInstance.InsertRowAsync(1, 1, null, RowPosition.Above);
    
            // Insert 4 rows below row index 3 in the sheet at index 3
            await SpreadsheetInstance.InsertRowAsync(3, 4, 3, RowPosition.Below);
        }
    }

    InsertSheetAsync(int, string)

    Inserts a new sheet at the specified index with a custom name.

    Declaration
    public Task InsertSheetAsync(int index, string sheetName)
    Parameters
    Type Name Description
    int index

    The zero-based index at which to insert the new sheet. If this index is greater than the worksheet count, the method returns without performing any operation.

    string sheetName

    The name for the newly inserted sheet. This name will be assigned to the worksheet when created.

    Returns
    Type Description
    Task

    A Task representing the asynchronous insert sheet operation.

    Remarks

    This method provides a way to insert a new worksheet at a specific position with a predefined name, rather than using the default naming convention.

    If the index is negative, the method returns without performing any operation.

    This operation will not be executed if the workbook is protected. Sheet insertion is disabled when workbook protection is enabled.

    When theAllowInsert property is set to false, the method returns silently.

    Examples
    <SfButton OnClick="InsertNamedSheetHandler" Content="Insert Named Sheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task InsertNamedSheetHandler()
        {
            // Insert a sheet at index 4 (the 5th position) with a custom name
            await SpreadsheetInstance.InsertSheetAsync(4, "My New Sheet Name");
        }
    }

    InsertSheetAsync(int?, int)

    Inserts one or more new sheets in the spreadsheet.

    Declaration
    public Task InsertSheetAsync(int? index = null, int count = 1)
    Parameters
    Type Name Description
    int? index

    The zero-based index at which to start inserting new sheets. If null, new sheets will be added after the active sheet.

    int count

    The number of sheets to insert. The default value is 1.

    Returns
    Type Description
    Task

    A Task representing the asynchronous insert sheet operation.

    Remarks

    This method inserts the specified number of sheets starting at the given zero-based index. If the index is greater than the total number of worksheets or is negative, the method returns without performing any operation.

    If the count is negative or equals to zero, the method returns without performing any operation.

    This operation will not be executed if the workbook is protected. Sheet insertion is disabled when workbook protection is enabled.

    When theAllowInsert property is set to false, the method returns silently.

    Examples
    <SfButton OnClick="InsertSheetHandler" Content="Insert New Sheets"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task InsertSheetHandler()
        {
            await SpreadsheetInstance.InsertSheetAsync(2, 4);
        }
    }

    MergeAsync(MergeType, string)

    Merges cells within the specified range on a worksheet.

    Declaration
    public Task MergeAsync(MergeType mergeType = MergeType.Cells, string cellRange = null)
    Parameters
    Type Name Description
    MergeType mergeType

    The merge behavior. Default is Cells (standard merge into a single cell).

    string cellRange

    The address of the range to merge. Supported forms:

    • "A1:B2" (active sheet)
    • If null or empty, uses the current selection; if no selection exists, uses the active cell.
    Returns
    Type Description
    Task

    A Task representing the asynchronous merge operation.

    Remarks
    • The operation is ignored when the range is invalid, out of bounds, in lowercase (e.g., "a1:b2"), or the sheet is protected and the operation is not allowed.
    • When the range contains existing merged regions, behavior follows the underlying engine rules (overlaps may be disallowed).
    • After a successful merge, the worksheet content is refreshed.
    Examples
    <SfButton OnClick="MergeHandler" Content="Merge"></SfButton> 
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet> 
    
    @code { 
        public SfSpreadsheet SpreadsheetInstance { get; set; } 
    
        public async Task MergeHandler() 
        { 
            // Merge the range A1:B6. 
             await SpreadsheetInstance. MergeAsync (MergeType.Cells, "A1:B6"); 
    
            // Merge the range C1:E6 each row independently across its columns 
             await SpreadsheetInstance. MergeAsync (MergeType.Across, "C1:E6"); 
    
            // Merge the range C8:E15 and horizontally center value in the merged cell 
            await SpreadsheetInstance. MergeAsync (MergeType.Center, "C8:E15"); 
    
            // Merge current selected range. 
             await SpreadsheetInstance. MergeAsync (MergeType.Cells); 
        } 
    }

    MoveSheetAsync(int?, int)

    Moves a sheet to a new position within the spreadsheet's sheet collection.

    Declaration
    public Task MoveSheetAsync(int? sourceIndex, int destinationIndex)
    Parameters
    Type Name Description
    int? sourceIndex

    The zero-based index position of the sheet to move within the spreadsheet's sheet collection. If the value is null, currently active sheet will be moved.

    int destinationIndex

    The zero-based index position where the sheet should be moved to within the sheet collection. Must be a valid index within the range of existing sheets and not be a hidden sheet.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method repositions a sheet within the spreadsheet's sheet collection without modifying the sheet's content, formatting, or properties. The sheet maintains all its data, formulas, and styling after the move operation.

    If the source index is out of range or the destination index is invalid, the operation will fail silently. Ensure both indices are within the valid range of existing sheets before calling this method. The destination index should account for the removal of the source sheet during the move operation.

    The method will not perform any action if the source and destination indexes are the same. Additionally, if the workbook is protected, this method will not work.

    Examples

    The following example demonstrates how to move sheets to different positions in a spreadsheet component:

    <SfButton OnClick="MoveActiveSheetToFirst" Content="Move Active Sheet to First"></SfButton>
    <SfButton OnClick="MoveSpecificSheet" Content="Move Second Sheet to Last"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance;
    
        // Move the currently active sheet to the first position
        private async Task MoveActiveSheetToFirst()
        {
            await SpreadsheetInstance.MoveSheetAsync(null, 0);
        }
    
        // Move a specific sheet by index to a new position
        private async Task MoveSpecificSheet()
        {
            // Moves sheet at index 1 to index 2
            await SpreadsheetInstance.MoveSheetAsync(1, 2);
        }
    }

    MoveSheetAsync(string, string)

    Moves a sheet to a new position within the SfSpreadsheet component's sheet collection by sheet names.

    Declaration
    public Task MoveSheetAsync(string sourceSheetName, string destinationSheetName)
    Parameters
    Type Name Description
    string sourceSheetName

    The name of the sheet to move within the spreadsheet's sheet collection. The sheet name comparison is case-insensitive and not be a hidden sheet.

    string destinationSheetName

    The name of the sheet that will serve as the position reference. The source sheet will be moved to the position immediately after this destination sheet. The sheet name comparison is case-insensitive and not be a hidden sheet.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method repositions a sheet within the spreadsheet's sheet collection by using sheet names instead of indices. The source sheet maintains all its data, formulas, and styling after the move operation.

    The method locates both sheets by their names and calculates the appropriate indices for the move operation. The source sheet will be positioned immediately after the destination sheet in the sheet collection.

    If either sheet name does not exist in the spreadsheet, the operation will fail silently. Sheet name comparisons are case-insensitive, so "Sheet1" will match "SHEET1" or "sheet1".

    The method will not perform any action if the source and destination sheet names refer to the same sheet. Additionally, if the workbook is protected, this method will not work.

    Examples

    The following example demonstrates how to move sheets by name in a spreadsheet component:

    <SfButton OnClick="MoveSheetByName" Content="Move Sales Sheet After Summary"></SfButton>
    <SfSpreadsheet @ref="spreadsheet"></SfSpreadsheet>
    
    @code {
        SfSpreadsheet spreadsheet;
    
        // Move a sheet by name to position after another named sheet
        private async Task MoveSheetByName()
        {
            // Moves "Sales Data" after "Summary"
            await spreadsheet.MoveSheetAsync("Sheet1", "Sheet3");
        }
    }

    NumberFormatAsync(string, string)

    Applies a number format to the specified range or current selection. Supports custom Excel-like format codes.

    Declaration
    public Task NumberFormatAsync(string format, string range = null)
    Parameters
    Type Name Description
    string format

    A string representing the custom Excel-like number format string to apply (e.g., "#,##0.00", "0.00%", "m/d/yyyy", "$#,##0.00").

    string range

    A string representing the A1 range to which the format should be applied. May include a sheet name (e.g., "Sheet1!A1:B5"). The default value is null.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method applies number formatting while respecting feature switches and worksheet protection. It returns early without taking any action if formatting is disabled.

    • Returns immediately if AllowNumberFormatting or AllowCellFormatting is false.
    • If the target sheet is protected and cell formatting is restricted, the operation is blocked.

    If range is null or empty, the format is applied to the current selection or active cell.

    Examples

    Demonstrates applying custom number formats using NumberFormatAsync(string, string):

    • A custom currency format to a specific range on Sheet1.
    • A custom percentage format to the current selection.
    • A custom date format to a single cell on Sheet2.
    <SfButton OnClick="ApplyFormats" Content="Apply Number Formats"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ApplyFormats()
        {
            // Apply custom currency format to range B2:B10 on Sheet1
            await SpreadsheetInstance.NumberFormatAsync("$#,##0.00", "Sheet1!B2:B10");
    
            // Apply custom percentage format to current selection
            await SpreadsheetInstance.NumberFormatAsync("0.00%");
    
            // Apply custom short date format to cell D1 on Sheet2
            await SpreadsheetInstance.NumberFormatAsync("mm/dd/yyyy", "Sheet2!D1");
        }
    }

    OnInitializedAsync()

    Initializes the component asynchronously.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    Task
    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Called when component parameters have been set.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    Task

    A Task that completes when parameter processing finishes.

    Overrides
    ComponentBase.OnParametersSetAsync()
    Remarks

    When the incoming DataSource differs from the cached _dataSource, this method clears the current sheet collection, resets the workbook, updates the cached data source, completes initialization, notifies footer items to update, and initializes the spreadsheet view. It calls InitializeSpreadsheetView(false) to avoid running column-width configuration and filtered-column updates during parameter updates.

    OpenAsync(Stream)

    Opens a spreadsheet file from a stream asynchronously.

    Declaration
    public Task OpenAsync(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    A Stream containing the spreadsheet data to open. Supported formats include:

    • .xlsx (Excel 2007 and later)
    • .xls (Excel 97-2003)
    • .csv (Comma-separated values)
    • .tsv (Tab-separated values)
    The stream must be seekable and contain valid spreadsheet data.
    Returns
    Type Description
    Task

    A Task representing the asynchronous open operation.

    Remarks

    This method loads a spreadsheet from the provided stream and initializes the component with the loaded data.

    The method will not perform the operation if any of these conditions are met:

    • The stream parameter is null or empty.
    • The stream does not contain valid spreadsheet data.
    • The stream format is not supported by the spreadsheet component.
    • An error occurs during file parsing or initialization.

    After a successful load, the first sheet becomes the active sheet and the UI is updated to display the spreadsheet content.

    The caller is responsible for disposing the stream after the operation completes.

    Examples
    <SfButton OnClick="OpenFromStreamHandler" Content="Open Spreadsheet"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task OpenFromStreamHandler()
        {
            // Open an Excel file from a stream
            using (var stream = File.OpenRead("path/to/file.xlsx"))
            {
                await SpreadsheetInstance.OpenAsync(stream);
            }
        }
    
        public async Task OpenFromMemoryStream()
        {
            // Open spreadsheet from a memory stream
            var memoryStream = new MemoryStream();
            // ... populate memoryStream with spreadsheet data ...
            memoryStream.Position = 0;
            await SpreadsheetInstance.OpenAsync(memoryStream);
        }
    
        public async Task OpenCsvFile()
        {
            // Open a CSV file from a stream
            using (var stream = File.OpenRead("path/to/data.csv"))
            {
                await SpreadsheetInstance.OpenAsync(stream);
            }
        }
    }

    PasteCellAsync(string)

    Pastes the clipboard content into the specified cell or range asynchronously. This operation will not work if the sheet is protected or if the EnableClipboard property is set to false.

    Declaration
    public Task PasteCellAsync(string cellAddress = "")
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell where the content will be pasted. The parameter accepts various formats:

    - Single cell reference (e.g., "A1")

    - Sheet-specific reference (e.g., "Sheet1!A1")

    - Range reference (e.g., "A1:C3")

    If no address is provided, the last selected range will be used. If no range was previously selected, the active cell will be used as the paste destination.

    Returns
    Type Description
    Task

    A Task that represents the asynchronous paste operation.

    Remarks

    This method will not work if the sheet is protected or if the EnableClipboard property is set to false.

    When calling without a cell address parameter, the operation uses the last selected range. If no selection exists, it defaults to the active cell.

    When pasting between sheets, the operation does not require switching to the destination sheet first. Simply specify the target sheet in the cell address parameter.

    If the copied range is larger than the specified paste range, all copied content will still be pasted, expanding beyond the specified range as needed - mimicking Excel's behavior.

    The paste operation will not execute if invalid cell references or out-of-boundary ranges are provided. Ensure all cell addresses are within the valid worksheet boundaries.

    Examples

    The following example demonstrates how to paste content in a spreadsheet:

    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public List<Order> Orders { get; set; }
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task PasteActiveCell()
        {
            // To paste to the current cell.
            await SpreadsheetInstance.PasteCellAsync();
        }
    
        public async Task PasteValues()
        {
            // To paste to the specified cell.
            await SpreadsheetInstance.PasteCellAsync("A2");
        }
    
        public async Task PasteCell()
        {
            // The address, along with the sheet name, to be pasted.
            await SpreadsheetInstance.PasteCellAsync("Sheet1!B2");
        }
    
        // Scenario 1: Copy from one sheet and paste to another without switching sheets
        public async Task CopyBetweenSheets()
        {
            // Copy value from Sheet1
            await SpreadsheetInstance.CopyCellAsync("Sheet1!A1:A5");
    
            // Paste to Sheet2 without switching to it
            await SpreadsheetInstance.PasteCellAsync("Sheet2!C3");
        }
    
        // Scenario 2: Copy a large range and paste to smaller range
        public async Task CopyLargerRangeThanTarget()
        {
            // Copy a 7-row range
            await SpreadsheetInstance.CopyCellAsync("F3:F9");
    
            // Paste to a smaller 3-row range
            // All 7 rows will be pasted, extending beyond the specified range
            await SpreadsheetInstance.PasteCellAsync("A5:A7");
        }
    }

    ProtectSheetAsync(string)

    Protects a worksheet or the entire workbook using default protection settings without a password.

    Declaration
    public Task ProtectSheetAsync(string sheetName = null)
    Parameters
    Type Name Description
    string sheetName

    The name of the sheet to protect. Sheet name comparison is case-insensitive. If null or empty, the entire workbook (all sheets and the workbook structure) will be protected instead.

    Returns
    Type Description
    Task

    A Task representing the asynchronous protection operation.

    Remarks

    This method protects either a specific worksheet or the entire workbook using default protection settings. Protection prevents users from modifying cell content, inserting or deleting rows and columns, and formatting cells unless they possess the appropriate permissions. When protecting the workbook structure, users are also prevented from inserting, deleting, or renaming sheets. No password is applied, so any user with access to the workbook can unprotect the sheet or workbook.

    Sheet-level Protection: When a sheet name is specified, only that worksheet is protected. Users can still edit other unprotected sheets and modify the workbook structure.

    Workbook-level Protection: When no sheet name is provided, the entire workbook structure is protected, preventing users from inserting, deleting, or renaming sheets. Individual sheets may still be editable unless also protected separately.

    The method will not perform the operation if any of these conditions are met:

    • A sheet name is specified but does not exist in the workbook.
    • A worksheet with the specified name cannot be located (case-insensitive search).

    After successful protection, the worksheet or workbook structure is locked with standard restrictions applied. The protection status can be queried using the worksheet's or workbook's protection properties.

    Users can unprotect the sheet or workbook at any time using the UnprotectSheetAsync(string) method if no password was set.

    Examples
    <SfButton OnClick="ProtectHandler" Content="Protect"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ProtectHandler()
        {
            // Protect the entire workbook (structure and all sheets)
            await SpreadsheetInstance.ProtectSheetAsync();
    
            // Protect a specific sheet by name
            await SpreadsheetInstance.ProtectSheetAsync("Sheet1");
    
            // Protect multiple sheets individually
            await SpreadsheetInstance.ProtectSheetAsync("DataSheet");
            await SpreadsheetInstance.ProtectSheetAsync("Summary");
    
            // Protect the workbook structure and individual sheets
            await SpreadsheetInstance.ProtectSheetAsync(); // Protect workbook
            await SpreadsheetInstance.ProtectSheetAsync("ReportSheet"); // Protect specific sheet
        }
    }

    ReapplyFiltersAsync()

    Reapplies all existing filters in the active sheet.

    Declaration
    public Task ReapplyFiltersAsync()
    Returns
    Type Description
    Task

    A task that represents an asynchronous re-filtering operation.

    Remarks

    This method reapplies all filters that have been previously set in the active worksheet.

    It's useful when data has changed and you need to update the filter results without changing the filter criteria.

    The method performs the following operations:

    If the AllowFiltering property is set to false, this method will have no effect.

    The method has no effect when there are no active filters in the worksheet.

    This method will not work if the sheet is protected and the Filter option is disabled in sheet protection options.

    Examples
    <SfButton OnClick="ReapplyFilters" Content="Reapply Filters"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ReapplyFilters()
        {
            await SpreadsheetInstance.ReapplyFiltersAsync();
        }
    }

    Redo()

    Reapplies the most recently undone action if a redo operation is available.

    Declaration
    public void Redo()
    Remarks

    This method reapplies the most recently undone action by retrieving and executing the last entry from the redo history stack. This is typically used after one or more Undo() operations.

    The method will not perform the operation if:

    • The redo history stack is empty (no undone actions available)
    Examples
    <SfButton OnClick="RedoHandler" Content="Redo"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void RedoHandler()
        {
            // Attempt to redo the last undone action
            SpreadsheetInstance.Redo();
        }
    }

    RefreshAsync()

    Refreshes the spreadsheet component by updating the UI and re-rendering the content asynchronously.

    Declaration
    public Task RefreshAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous refresh operation.

    Remarks

    This method refreshes the component's visual representation and state to reflect any programmatic changes made to the spreadsheet.

    Use this method after making multiple changes to the spreadsheet programmatically when you need the UI to update immediately without waiting for the next automatic change detection cycle.

    The refresh operation triggers a state change notification that forces the component to re-render and display the latest data.

    Examples
    <SfButton OnClick="RefreshHandler" Content="Refresh Component"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task RefreshHandler()
        {
            // Refresh the spreadsheet component to update the UI.
            await SpreadsheetInstance.RefreshAsync();
        }
    }

    RemoveContextMenuItems(List<string>)

    Removes the specified context menu items from the spreadsheet context menu.

    Declaration
    public void RemoveContextMenuItems(List<string> Items)
    Parameters
    Type Name Description
    List<string> Items

    A collection of context menu item identifiers or display texts to remove (e.g., "Cut", "Copy", "Paste").

    Remarks
    • The operation is ignored if Items is null or empty.
    • Invalid or non-existent item identifiers are silently ignored.
    • Removed items are no longer rendered in the context menu and cannot be accessed.
    • This method removes items only for the current instance and does not affect other spreadsheet instances.
    Examples
    <SfButton OnClick="RemoveMenuItems" Content="Remove Items"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void RemoveMenuItems()
        {
            // Remove Cut and Copy menu items
            SpreadsheetInstance.RemoveContextMenuItems(new List<string> { "Cut", "Copy" });
    
            // Remove Delete menu item
            SpreadsheetInstance.RemoveContextMenuItems(new List<string> { "Delete" });
        }
    }

    RemoveDefinedNameAsync(string)

    Removes a defined name (named range) from the spreadsheet.

    Declaration
    public Task RemoveDefinedNameAsync(string name)
    Parameters
    Type Name Description
    string name

    The name of the defined range to remove. The name is case-insensitive and must match an existing defined name in the workbook.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

    This method removes a defined name (named range) from the spreadsheet's named ranges collection, making it no longer available for use in formulas or cell references.

    The method will return false and not perform the operation if any of these conditions are met:

    • The name parameter is null or empty.
    • A defined name with the specified name does not exist in the workbook.
    • The workbook or worksheets collection is null or empty.
    • The name is currently being used in active formulas (some implementations may restrict removal).

    After successful removal, any formulas that reference the removed defined name may display an error (typically #NAME?), as the name is no longer defined.

    If the same name exists in multiple scopes (workbook and sheet-specific), this method removes all instances of that name.

    Examples
    <SfButton OnClick="RemoveDefinedNameHandler" Content="Remove Named Range"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task RemoveDefinedNameHandler()
        {
            // Remove a defined name
            await SpreadsheetInstance.RemoveDefinedNameAsync("CompanyName");
    
            // Remove another defined name
            await SpreadsheetInstance.RemoveDefinedNameAsync("SalesData");
    
            // Remove a sheet-specific defined name
            await SpreadsheetInstance.RemoveDefinedNameAsync("LocalRange");
    
        }
    }

    RemoveHyperlinkAsync(string)

    Removes hyperlinks from a specified cell or range of cells in the spreadsheet.

    Declaration
    public Task RemoveHyperlinkAsync(string cellAddress)
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell or range of cells from which the hyperlinks should be removed. This can be:

    • A single cell reference, such as "A5" or "A100"
    • A cell in another sheet, for example, "Sheet3!A10"
    • A range of cells, such as "A1:A200" or "Sheet3!A10:A1000"
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of removing the hyperlinks from the specified cell or range.

    Remarks

    This method allows removing hyperlinks from a specified cell or range of cells in the spreadsheet.

    The cellAddress parameter determines the location from which hyperlinks will be removed, using standard cell notation (e.g., "A1") or an explicit sheet reference (e.g., "Sheet1!A1").

    This operation requires the AllowHyperlink property to be set to true. If AllowHyperlink is set to false, this method will not remove hyperlinks from the spreadsheet.

    Sheet protection affects hyperlink removal. If the sheet is protected, hyperlinks can only be removed if:

    • The target cell or range is in an unlocked area of the protected sheet

    The method will validate the sheet name and cell address before removing any hyperlink. If an invalid sheet name or cell address is provided, no hyperlinks will be removed, and no error will be thrown.

    After removing a hyperlink, the cell value remains unchanged - only the hyperlink functionality is removed.

    Examples
    // Example: Removing a hyperlink from a specific cell
    await spreadsheet.RemoveHyperlinkAsync("A4");
    
    // Example: Removing hyperlinks from a cell in a specific sheet
    await spreadsheet.RemoveHyperlinkAsync("Sheet2!B2");
    
    // Example: Removing hyperlinks from a range of cells
    await spreadsheet.RemoveHyperlinkAsync("A1:A5");
    
    // Example: Removing hyperlinks from a range in a specific sheet
    await spreadsheet.RemoveHyperlinkAsync("Sheet3!A10:A1000");
    
    // Example: Setting AllowHyperlink property
    spreadsheet.AllowHyperlink = true; // Enable hyperlink operations
    await spreadsheet.RemoveHyperlinkAsync("A10"); // This will work
    
    spreadsheet.AllowHyperlink = false; // Disable hyperlink operations
    // This call won't remove a hyperlink because AllowHyperlink is false
    await spreadsheet.RemoveHyperlinkAsync("A11");

    SaveAsStreamAsync()

    Returns the current workbook content as a MemoryStream for server-side operations.

    Declaration
    public Task<MemoryStream> SaveAsStreamAsync()
    Returns
    Type Description
    Task<MemoryStream>

    A Task<TResult> containing the workbook data.

    Remarks

    This method serializes the workbook into a stream. The caller is responsible for disposing the returned stream.

    Examples
    <SfButton OnClick="SaveToServer" Content="Save to Server"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SaveToServer()
        {
            using var stream = await SpreadsheetInstance.SaveAsStreamAsync();
        }
    }

    SaveAsync(SaveOptions)

    Saves the current spreadsheet as an exported .xlsx file based on the specified SaveOptions.

    Declaration
    public Task SaveAsync(SaveOptions options)
    Parameters
    Type Name Description
    SaveOptions options

    A SaveOptions object that controls the behavior of the save operation, including the file name.

    • SaveType: Must be Xlsx.
    • FileName: The file name to use for the exported workbook. The .xlsx extension is appended automatically.
    Returns
    Type Description
    Task

    A Task representing the asynchronous save operation.

    Remarks

    This method ensures that the active sheet index is correctly set before exporting the workbook as an .xlsx file.

    If options is null or only partially specified, the method uses the following defaults:

    • FileName: Spreadsheet (the downloaded file will be named Spreadsheet.xlsx)
    • SaveType: Supported formats are Xlsx, Xls,Csv, and Pdf. If not specified, the default format is Xlsx
    Examples
    <SfButton OnClick="SaveWorkbookHandler" Content="Save as Excel"></SfButton>
    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SaveWorkbookHandler()
        {
            // Export the workbook as "MonthlyReport.xlsx"
            await SpreadsheetInstance.SaveAsync(new SaveOptions
            {
                SaveType = SaveType.Xlsx,
                FileName = "MonthlyReport"
            });
        }
    }

    SelectRangeAsync(string)

    Selects a range of cells in the active sheet.

    Declaration
    public Task SelectRangeAsync(string cellAddress)
    Parameters
    Type Name Description
    string cellAddress

    The address of the range to select. The format can be a single range (e.g., "A1:B5") or multiple ranges separated by spaces (e.g., "A1:A10 B1:B10 C1:C10"). If null or empty string is provided, no cells will be selected.

    Returns
    Type Description
    Task

    A task that represents the asynchronous selection operation.

    Remarks

    This method updates the selected range of the active sheet and initializes the selection in the user interface.

    Multiple ranges can be selected by providing space-separated range addresses.

    If invalid range addresses are provided, no selection will occur.

    If null or an empty string is passed, the method will not select any cells.

    Examples
    <SfButton OnClick="SelectRangeHandler" Content="Select Range"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SelectRangeHandler()
        {
            // Selects the range A1:C3 on the active worksheet.
            await SpreadsheetInstance.SelectRangeAsync("A1:C3");
    
            // Selects multiple ranges simultaneously
            await SpreadsheetInstance.SelectRangeAsync("A1:A10 B1:B10 C1:C10");
    
            // Passing null or empty string won't select any cells
            await SpreadsheetInstance.SelectRangeAsync(null);
        }
    }

    SetBordersAsync(BorderType, ExcelLineStyle, string, string)

    Applies borders to the specified cell or range using the given border type, line style, and border color asynchronously.

    Declaration
    public Task SetBordersAsync(BorderType borderType, ExcelLineStyle lineStyle, string borderColor, string cellAddress = null)
    Parameters
    Type Name Description
    BorderType borderType

    A BorderType value that specifies the type of border to apply (e.g., OutsideBorders, AllBorders, TopBorder).

    ExcelLineStyle lineStyle

    A Syncfusion.XlsIO.ExcelLineStyle value that defines the line style of the border (e.g., Syncfusion.XlsIO.ExcelLineStyle.Thin, Syncfusion.XlsIO.ExcelLineStyle.Medium, Syncfusion.XlsIO.ExcelLineStyle.Dashed).

    string borderColor

    A string representing the border color in hexadecimal or named CSS color format (e.g., "#000000", "red", "#2196F3").

    string cellAddress

    Optional. A string representing the target cell or range in A1 notation. Supports:

    • Single cell (e.g., "A1")
    • Range (e.g., "A1:C5")
    • Sheet-specific reference (e.g., "Sheet2!B2:D4")
    If not specified, the operation targets the current selection or active cell within the active worksheet.
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of applying borders.

    Remarks

    When a sheet name is specified in cellAddress, the method identifies the corresponding worksheet, verifies the range, evaluates protection constraints, and applies the borders as requested.

    If the specified sheet or range does not exist, the method exits without performing any action. If the target sheet is protected and the FormatCells option is disabled, a protection error dialog is displayed and the operation is aborted.

    Examples

    The following example demonstrates how to apply borders in a spreadsheet:

    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task ApplyOutsideBorders()
        {
            // Apply thin black outside borders to the current selection
            await SpreadsheetInstance.SetBordersAsync(BorderType.OutsideBorders, Syncfusion.XlsIO.ExcelLineStyle.Thin, "#000000");
        }
    
        public async Task ApplyAllBordersToRange()
        {
            // Apply thin blue borders to all sides of cells in A1:C5
            await SpreadsheetInstance.SetBordersAsync(BorderType.AllBorders, Syncfusion.XlsIO.ExcelLineStyle.Thin, "#2196F3", "A1:C5");
        }
    
        public async Task ApplyTopBorderOnAnotherSheet()
        {
            // Apply medium red top border to B2:D2 on Sheet2
            await SpreadsheetInstance.SetBordersAsync(BorderType.TopBorder, Syncfusion.XlsIO.ExcelLineStyle.Medium, "#F44336", "Sheet2!B2:D2");
        }
    }

    SetColumnWidthAsync(double, int, int?)

    Sets the width of a column in the spreadsheet asynchronously.

    Declaration
    public Task SetColumnWidthAsync(double width, int columnIndex, int? sheetIndex = null)
    Parameters
    Type Name Description
    double width

    The new width of the column in pixels. Must be a positive number greater than zero. Invalid values (NaN, negative, or zero) will cause the method to exit without performing any operation.

    int columnIndex

    The zero-based index of the column whose width is to be set. For example, column A = 0, column B = 1, column C = 2, etc. Negative or out-of-bounds indexes will cause the method to exit without performing any operation.

    int? sheetIndex

    Optional. The zero-based index of the sheet where the column width will be set. If not specified, the width will be set on the currently active sheet. If the specified sheet index is invalid, the method will exit without performing any operation.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of setting the column width.

    Remarks

    This method applies the specified width to a column in the spreadsheet and updates all related UI components. The operation includes recording changes in the undo/redo history, updating virtual scroll dimensions, and refreshing the client-side UI.

    Protection Constraints:

    • If the workbook is protected against cell operations, this method will not execute.
    • If the target sheet is password-protected, the method will only execute if the protection settings allow column formatting or cell formatting.

    Validation: The method performs the following validations before applying the column width:

    • Validates that columnIndex is non-negative and within the column count of the target sheet.
    • Validates that width is a positive number (not NaN, zero, or negative).
    • Validates that sheetIndex (if provided) refers to a valid sheet in the workbook.

    Events: If subscribed, the ColumnResized event will be raised upon successful completion, providing details about the resized column including its index, new width, and name.

    Performance: Virtual scroll dimensions are updated using a delta calculation to avoid unnecessary full layout refreshes. Images positioned within the column are automatically updated to reflect the new column width.

    Examples

    The following example demonstrates how to set column widths in a spreadsheet:

    <SfSpreadsheet @ref="SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SetColumnWidthOnActiveSheet()
        {
            // Set the width of column A (index 0) to 150 pixels on the active sheet
            await SpreadsheetInstance.SetColumnWidthAsync(150, 0);
        }
    
        public async Task SetColumnWidthOnSpecificSheet()
        {
            // Set the width of column C (index 2) to 200 pixels on sheet 1
            await SpreadsheetInstance.SetColumnWidthAsync(200, 2, 1);
        }
    
        public async Task SetMultipleColumnWidths()
        {
            // Set widths for columns A, B, and C
            await SpreadsheetInstance.SetColumnWidthAsync(100, 0); // Column A
            await SpreadsheetInstance.SetColumnWidthAsync(150, 1); // Column B
            await SpreadsheetInstance.SetColumnWidthAsync(200, 2); // Column C
        }
    
        public async Task SetColumnWidthWithValidation()
        {
            double newWidth = 180;
            int columnIndex = 1;
    
            // Validate width before calling
            if (newWidth > 0 && columnIndex >= 0)
            {
                await SpreadsheetInstance.SetColumnWidthAsync(newWidth, columnIndex);
            }
        }
    }

    SetRowHeightAsync(double, int, int?)

    Sets the height of a specified row in the spreadsheet programmatically.

    Declaration
    public Task SetRowHeightAsync(double height, int rowIndex, int? sheetIndex = null)
    Parameters
    Type Name Description
    double height

    The height of the row in pixels. Must be greater than zero.

    int rowIndex

    The zero-based index of the row whose height needs to be updated.

    int? sheetIndex

    The zero-based index of the worksheet containing the row. If null, the active worksheet will be used.

    Returns
    Type Description
    Task

    A Task representing the asynchronous row height set operation.

    Remarks

    This method allows developers to programmatically set row heights, supporting responsive layouts, data-driven formatting, and automation workflows.

    The row height update behaves identically to UI-based row resizing operations, including:

    • Immediate UI reflection of height changes
    • Proper scrollbar and layout updates
    • History tracking for undo/redo support

    The method will not perform the operation if any of these conditions are met:

    • The row index is negative or exceeds the row count of the worksheet
    • The height value is less than or equal to zero
    • The worksheet index is out of range
    • The worksheet is password-protected and row resizing is not allowed
    • The workbook is in read-only mode

    The operation respects hidden row state:

    • If the target row is hidden, its height is updated internally without unhiding it
    • When the row is later unhidden, the updated height is applied correctly
    • No side-effects occur to row visibility or layout while the row remains hidden

    The operation does not alter cell content, formatting, merges, or formulas.

    Examples

    The following example demonstrates how to set row heights programmatically:

    <SfButton OnClick="SetRowHeightsHandler" Content="Set Row Heights"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SetRowHeightsHandler()
        {
            // Set row 1 to 30 pixels height in the active sheet
            await SpreadsheetInstance.SetRowHeightAsync(30, 1);
    
            // Set row 5 to 50 pixels height in sheet at index 1
            await SpreadsheetInstance.SetRowHeightAsync(50, 5, 1);
    
            // Set header row (row 0) to larger height for visibility
            await SpreadsheetInstance.SetRowHeightAsync(40, 0);
    
            // Set multiple rows with different heights
            for (int i = 1; i <= 10; i++)
            {
                await SpreadsheetInstance.SetRowHeightAsync(i, 25 + (i * 2));
            }
        }
    }

    ShowFileMenuItems(List<string>)

    Shows the specified File menu items by their display text or ID.

    Declaration
    public void ShowFileMenuItems(List<string> menuItemIds)
    Parameters
    Type Name Description
    List<string> menuItemIds

    A collection of menu item display texts to target. Display text matching is case-insensitive. For separators, pass their ID.

    • Invalid or non-existent menu item texts are silently ignored.
    • An empty collection will result in no items being affected.
    • Matching is case-insensitive, so "Open", "open", and "OPEN" all refer to the same menu item.
    Remarks

    This method allows dynamic control over File menu item visibility at runtime. When items are shown, they become visible in the menu interface.

    Menu item targeting is performed by display text or ID. Display text matching is case-insensitive for flexibility.

    Shown menu items are fully functional through the menu interface as well as keyboard shortcuts.

    Examples

    The following example demonstrates how to show File menu items:

     <SfButton OnClick="ShowFileItemsHandler" Content="Show File Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
    
         private void ShowFileItemsHandler()
         {
             // Show Open and Print menu items
             SpreadsheetInstance.ShowFileMenuItems(new List<string> { "Open", "Print" });
         }
     }

    ShowRibbonItems(List<string>)

    Shows ribbon items by their item IDs using standardized names.

    Declaration
    public void ShowRibbonItems(List<string> itemIds)
    Parameters
    Type Name Description
    List<string> itemIds
    Remarks

    This method allows dynamic control over ribbon item visibility at runtime. When items are shown, they become visible in the ribbon interface.

    Item IDs support standardized naming conventions (e.g., "bold", "italic", "underline") for consistency and ease of use.

    Shown items are fully functional and accessible through the ribbon interface as well as keyboard shortcuts.

    Examples

    The following example demonstrates how to show ribbon items:

     <SfButton OnClick="ShowItemsHandler" Content="Show Items"></SfButton>
     <SfSpreadsheet @ref="@SpreadsheetInstance">
     <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
     @code {
         private SfSpreadsheet SpreadsheetInstance { get; set; }
         private void ShowItemsHandler()
         {
             // Show specific items by ID
             SpreadsheetInstance.ShowRibbonItems(new List<string> { "bold", "italic", "underline" });
         }
     }

    ShowRibbonTabs(List<string>)

    Shows the specified ribbon tabs in the spreadsheet.

    Declaration
    public void ShowRibbonTabs(List<string> tabs)
    Parameters
    Type Name Description
    List<string> tabs

    A collection of tab names or ID to show. Tab names are case-insensitive and match against available ribbon tabs (e.g., "Home", "Insert", "Formulas", "Data", "View").

    Remarks

    This method controls ribbon tab visibility at runtime. When tabs are shown, they become visible in the ribbon interface and are fully functional.

    Tab name matching is case-insensitive, so "Home", "home", and "HOME" all refer to the same tab.

    This method does not affect the File menu dropdown, as it is a menu component rather than a ribbon tab.

    Examples

    The following example demonstrates how to show ribbon tabs:

    <SfButton OnClick="ShowTabsHandler" Content="Show Tabs"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance">
        <SpreadsheetRibbon></SpreadsheetRibbon>
    </SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        private void ShowTabsHandler()
        {
            // Show the Insert and View tabs
            SpreadsheetInstance.ShowRibbonTabs(new List<string> { "Insert", "View" });
        }
    }

    SortRangeAsync(string, SortDirection)

    Asynchronously sorts a range of cells on the active worksheet. This method sorts the selected range based on the first cell address of the selected range. For example, in range "B10:C10", sorting is based on column B.

    Declaration
    public Task SortRangeAsync(string selectedRange = "", SortDirection sortDirection = SortDirection.Ascending)
    Parameters
    Type Name Description
    string selectedRange

    The address of the range to be sorted. If not specified, the currently selected range will be used. This must be a valid cell range address (e.g., "B2:C5").

    SortDirection sortDirection

    The direction of the sort. Must be a value from the SortDirection enum. The default value is Ascending if not specified.

    Possible values include:

    • Ascending - Sorts data in ascending order
    • Descending - Sorts data in descending order
    Returns
    Type Description
    Task

    A Task representing the asynchronous sorting operation.

    Remarks

    The sorting is performed on the active sheet based on whether the selected range contains headers or not.

    The method will not perform the operation if any of these conditions are met:

    • The worksheet is protected
    • Multiple non-contiguous ranges are selected
    • The AllowSorting property is set to false
    Examples
    <SfButton OnClick="SortHandler" Content="Sort Data"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task SortHandler()
        {
            // Sorts the range B2:D5 in ascending order based on values in column B
            await SpreadsheetInstance.SortRangeAsync("B2:D5", SortDirection.Ascending);
    
            // Sorts the currently selected range in descending order
            await SpreadsheetInstance.SortRangeAsync(sortDirection: SortDirection.Descending);
        }
    }

    Undo()

    Reverts the most recent action if an undo operation is available.

    Declaration
    public void Undo()
    Remarks

    This method reverts the most recent user action or programmatic change to the spreadsheet by retrieving and executing the last entry from the undo history stack.

    The method will not perform the operation if:

    • The undo history stack is empty (no previous actions available)
    Examples
    <SfButton OnClick="UndoHandler" Content="Undo"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public void UndoHandler()
        {
            // Attempt to undo the last action
            SpreadsheetInstance.Undo();
        }
    }

    UnmergeAsync(string)

    Unmerges all merged cells within the specified range on a worksheet.

    Declaration
    public Task UnmergeAsync(string cellRange = null)
    Parameters
    Type Name Description
    string cellRange

    The address of the range to unmerge. Supported forms:

    • "A1:B2" (active sheet)
    • If null or empty, uses the current selection; if no selection exists, uses the active cell.
    Returns
    Type Description
    Task

    A Task representing the asynchronous unmerge operation.

    Remarks
    • The operation is ignored when the range is invalid, out of bounds, in lowercase (e.g., "a1:b2"), or the sheet is protected and the operation is not allowed.
    • Only merged regions intersecting the specified range are unmerged.
    • After a successful unmerge, the worksheet content is refreshed.
    Examples
    <SfButton OnClick="UnMergeHandler" Content="UnMerge"></SfButton> 
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet> 
    
    @code { 
        public SfSpreadsheet SpreadsheetInstance { get; set; } 
    
        public async Task UnMergeHandler() 
        {  
            // UnMerge the range A1:E15 
            await SpreadsheetInstance. UnmergeAsync("A1:E15"); 
        } 
    }

    UnprotectSheetAsync(string)

    Removes protection from a worksheet or the entire workbook, allowing unrestricted editing.

    Declaration
    public Task UnprotectSheetAsync(string sheetName = null)
    Parameters
    Type Name Description
    string sheetName

    The name of the sheet to unprotect. Sheet name comparison is case-insensitive. If null or empty, the entire workbook protection (structure and all sheets) will be removed instead.

    Returns
    Type Description
    Task

    A Task representing the asynchronous unprotection operation.

    Remarks

    This method removes all protection settings from either a specific worksheet or the entire workbook, restoring full editing capabilities. If the sheet or workbook was protected without a password using ProtectSheetAsync(string), this method will successfully unprotect it.

    Sheet-level Unprotection: When a sheet name is specified, only that worksheet's protection is removed. Workbook structure protection and other sheets remain protected if previously set.

    Workbook-level Unprotection: When no sheet name is provided, all workbook structure protection is removed, allowing users to insert, delete, and rename sheets. Individual sheet protections (if set) remain in effect.

    The method will not perform the operation if any of these conditions are met:

    • A sheet name is specified but does not exist in the workbook.
    • A worksheet with the specified name cannot be located (case-insensitive search).
    • The sheet or workbook is protected with a password and the password is required to unprotect.

    After successful unprotection, users have full access to modify cells, insert or delete rows and columns, apply formatting, and (if workbook protection is removed) manage sheets without restrictions.

    The protection status of the worksheet or workbook is immediately updated, and any UI elements reflecting the protection state are refreshed.

    Examples
    <SfButton OnClick="UnprotectHandler" Content="Unprotect"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        public SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task UnprotectHandler()
        {
            // Unprotect the entire workbook (structure and all sheets)
            await SpreadsheetInstance.UnprotectSheetAsync();
    
            // Unprotect a specific sheet by name
            await SpreadsheetInstance.UnprotectSheetAsync("Sheet1");
    
            // Unprotect multiple sheets individually
            await SpreadsheetInstance.UnprotectSheetAsync("DataSheet");
            await SpreadsheetInstance.UnprotectSheetAsync("Summary");
    
            // Unprotect workbook structure first, then individual sheets
            await SpreadsheetInstance.UnprotectSheetAsync(); // Unprotect workbook structure
            await SpreadsheetInstance.UnprotectSheetAsync("ReportSheet"); // Unprotect specific sheet
        }
    }

    UpdateCellAsync(string, object)

    Updates the value of a specified cell in the spreadsheet.

    Declaration
    public Task UpdateCellAsync(string cellAddress, object cellValue)
    Parameters
    Type Name Description
    string cellAddress

    The address of the cell to update, which must include the sheet name in the format "SheetName!CellAddress" (e.g., "Sheet1!A1"). This parameter is required and must follow the proper format. This must be a valid cell addresses (e.g., "A1", "B2").

    object cellValue

    The new value to assign to the cell. This can be a string, number, boolean, or any other compatible data type.

    Returns
    Type Description
    Task

    A Task representing the asynchronous update operation.

    Remarks

    This method enables updating a specific cell's value in a specified worksheet. The method requires the cell address to include the sheet name.

    The method performs validation to ensure the cell address is in the correct format before making any changes.

    The invalid cell address will be skipped during the update process.

    This method will not work if the sheet is protected or if the AllowEditing property is set to false.

    Even if the sheet is protected, this method will still work when targeting cells in unlocked ranges of the protected sheet.

    Examples

    The following example demonstrates how to update cells in a spreadsheet:

    <SfButton OnClick="UpdateCellValues" Content="Update Cell"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task UpdateCellValues()
        {
            // Update a text value in Sheet1
            await SpreadsheetInstance.UpdateCellAsync("Sheet1!A1", "New Value");
    
            // Update a numeric value in Sheet2
            await SpreadsheetInstance.UpdateCellAsync("Sheet2!B5", 42);
    
            // Update a boolean value
            await SpreadsheetInstance.UpdateCellAsync("Sheet1!C3", true);
        }
    }

    UpdateCellsAsync(List<CellUpdateItem>)

    Applies a batch update to multiple cells in a spreadsheet.

    Declaration
    public Task UpdateCellsAsync(List<CellUpdateItem> cellUpdates)
    Parameters
    Type Name Description
    List<CellUpdateItem> cellUpdates

    A collection of CellUpdateItem objects. Each item must include:

    • CellAddress: A valid cell reference in the format "SheetName!CellAddress" (e.g., "Sheet1!A1" or "Sheet1!A1:A10"). Sheet names are case-insensitive.
    • Value: The value to assign to the specified cell. Can be a string, number, or formula.
    Invalid or improperly formatted cell addresses will be ignored.
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation that applies the batch cell updates.

    Remarks

    This method enables efficient updates to multiple cells in a single operation, reducing the overhead of individual cell updates.

    Cells with invalid addresses are skipped during execution. Ensure all cell references include a valid sheet name and cell address.

    Performance may be impacted when updating a large number of cells simultaneously.

    This method does not apply updates if the target sheet is protected or if AllowEditing is set to false.

    However, updates will still apply to unlocked ranges within a protected sheet.

    Examples

    The following example demonstrates how to apply multiple cell updates in a single operation:

    <SfButton OnClick="UpdateMultipleCellsAsync" Content="Batch Update"></SfButton>
    <SfSpreadsheet @ref="@SpreadsheetInstance"></SfSpreadsheet>
    
    @code {
        private SfSpreadsheet SpreadsheetInstance { get; set; }
    
        public async Task UpdateMultipleCellsAsync()
        {
            var updates = new List<CellUpdateItem>
            {
                new CellUpdateItem { CellAddress = "Sheet1!A1", Value = "Header" },
                new CellUpdateItem { CellAddress = "Sheet1!B1", Value = "Value" },
                new CellUpdateItem { CellAddress = "Sheet1!A2", Value = 100 },
                new CellUpdateItem { CellAddress = "Sheet1!B2", Value = 200 },
                new CellUpdateItem { CellAddress = "Sheet1!C1", Value = "Total" },
                new CellUpdateItem { CellAddress = "Sheet1!C2", Value = "=SUM(A2:B2)" },
                // Applies "Batch Fill" to cells A1 through A10
                new CellUpdateItem { CellAddress = "Sheet1!A1:A10", Value = "Batch Fill" }
            };
    
            await SpreadsheetInstance.UpdateCellsAsync(updates);
        }
    }

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved