Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Document-Processing/Excel/Spreadsheet/Blazor/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ documentation: ug

# Accessibility in Blazor Spreadsheet

The [Blazor Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/blazor-spreadsheet-editor) follows accessibility guidelines and standards, including [ADA](https://www.ada.gov/), [Section 508](https://www.section508.gov/), [WCAG 2.2](https://www.w3.org/TR/WCAG22/), and [WAI-ARIA](https://www.w3.org/TR/wai-aria#roles) roles that are commonly used to evaluate accessibility.
The [Blazor Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/blazor-spreadsheet-editor) follows accessibility guidelines and standards, including [ADA](https://www.ada.gov/), [Section 508](https://www.section508.gov/), [WCAG 2.2](https://www.w3.org/TR/WCAG22/), and [WAI-ARIA](https://www.w3.org/TR/wai-aria#roles) roles commonly used to evaluate accessibility.

<style>
.post .post-content img {
display: inline-block;
margin: 0.5em 0;
}
</style>
The accessibility compliance for the Spreadsheet component is outlined below.
The accessibility compliance for the Spreadsheet component is outlined below. The icons in the table indicate the level of compliance: a full check means all features meet the requirement, a partial check means some features do not, and a cross means the requirement is not met. Click any criterion to learn more about the standard.
<div><img src="https://cdn.syncfusion.com/content/images/documentation/full.png" alt="Yes"> - All features of the component meet the requirement.</div>
<div><img src="https://cdn.syncfusion.com/content/images/documentation/partial.png" alt="Intermediate"> - Some features of the component do not meet the requirement.</div>
<div><img src="https://cdn.syncfusion.com/content/images/documentation/not-supported.png" alt="No"> - The component does not meet the requirement.</div>
Expand All @@ -33,16 +34,16 @@ The accessibility compliance for the Spreadsheet component is outlined below.
| [Axe-core Accessibility Validation](https://blazor.syncfusion.com/documentation/common/accessibility#ensuring-accessibility) | <img src="https://cdn.syncfusion.com/content/images/documentation/partial.png" alt="Intermediate"> |

## WAI-ARIA attributes
The Syncfusion Blazor Spreadsheet follows [WAI-ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) patterns to meet accessibility standards. The following ARIA attributes are used in the Spreadsheet component:
The [Blazor Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/blazor-spreadsheet-editor) follows [WAI-ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) patterns to meet accessibility standards. The following ARIA attributes are used in the Spreadsheet component:

| Attributes | Purpose |
|---------------|-------------|
| `role=textbox` | Identifies an element as an input field that allows text entry.|
|---|---|
| `role=textbox` | Identifies an element as an input field that allows text entry. |
| `role=button` | Identifies an element that functions as a button. |
| `role=combobox` | Identifies a component that combines a text input with a popup listbox or tree. |
| `role=menu` | Defines a container for a collection of choices or commands presented in a contextual or dropdown format. |
| `role=alert` | Designates an element that displays important, time-sensitive information. |
| `aria-label`| This attribute describes the accessible name for the interactive elements. |
| `aria-label` | This attribute describes the accessible name for the interactive elements. |
| `aria-expanded` | Indicates whether a collapsible element (e.g., a dropdown) is currently expanded or collapsed. |
| `aria-live` | Defines a region as "live", meaning its content updates dynamically. Values include "off", "polite" (waits until idle), or "assertive" (announces immediately). |
| `aria-rowindex` | Defines the row index of a row with respect to the total number of rows in the Spreadsheet. |
Expand All @@ -52,7 +53,7 @@ The Syncfusion Blazor Spreadsheet follows [WAI-ARIA](https://www.w3.org/WAI/ARIA

## Keyboard interaction

The Syncfusion Blazor Spreadsheet follows [keyboard interaction](https://www.w3.org/WAI/ARIA/apg/patterns/alert#keyboardinteraction) guidelines, making it accessible for people who use assistive technologies (AT) and those who rely on keyboard navigation. The following keyboard shortcuts are supported by the Spreadsheet.
The [Blazor Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/blazor-spreadsheet-editor) follows [keyboard interaction](https://www.w3.org/WAI/ARIA/apg/patterns/alert#keyboardinteraction) guidelines, making it accessible for people who use assistive technologies (AT) and those who rely on keyboard navigation. The following keyboard shortcuts are supported by the Spreadsheet.

<b>Clipboard</b>

Expand Down Expand Up @@ -80,7 +81,7 @@ The Syncfusion Blazor Spreadsheet follows [keyboard interaction](https://www.w3.

| Windows | MAC | Actions |
|-----|----- | -----|
| <kbd>Page Up</kbd> / <kbd>Page Down</kbd> | <kbd>Fn</kbd> + <kbd>↑</kbd> / <kbd>↓</kbd> |Scrolls up or down one screen at a time.|
| <kbd>Page Up</kbd> / <kbd>Page Down</kbd> | <kbd>Page Up</kbd> / <kbd>Page Down</kbd> (or <kbd>Fn</kbd> + <kbd>↑</kbd> / <kbd>↓</kbd> on older keyboards) |Scrolls up or down one screen at a time.|
| <kbd>Arrow keys</kbd> | <kbd>Arrow keys</kbd> | Navigates between adjacent cells in the direction of the arrow key.|
| <kbd>Enter</kbd> | <kbd>Enter</kbd> | Moves the active cell down one row.|
| <kbd>Shift</kbd> + <kbd>Enter</kbd> | <kbd>⇧</kbd> + <kbd>Enter</kbd> | Moves the active cell up one row.|
Expand Down Expand Up @@ -108,11 +109,11 @@ The Syncfusion Blazor Spreadsheet follows [keyboard interaction](https://www.w3.

| Windows | MAC | Actions |
|-----|----- | -----|
| <kbd>Ctrl</kbd> + <kbd>Click</kbd> | <kbd>⌘</kbd> + <kbd>Click</kbd> | Open the link in the selected cell.|
| <kbd>Ctrl</kbd> + <kbd>Click</kbd> | <kbd>⌘</kbd> + <kbd>Click</kbd> | Opens the link in the selected cell.|
| <kbd>Ctrl</kbd> + <kbd>K</kbd> | <kbd>⌘</kbd> + <kbd>K</kbd> | Opens the hyperlink dialog to insert a new link or edit an existing one.|

> * The <kbd>Command</kbd> and <kbd>Control</kbd> keys on Mac devices can be interchanged. When this switch occurs, use the <kbd>Command</kbd> key in place of the <kbd>Control</kbd> key for the above listed key interactions with Mac devices.
N> The <kbd>Command</kbd> and <kbd>Control</kbd> keys on Mac devices can be interchanged. When this switch occurs, use the <kbd>Command</kbd> key in place of the <kbd>Control</kbd> key for the above listed key interactions with Mac devices.

## See also

* [Accessibility in Syncfusion Blazor](https://blazor.syncfusion.com/documentation/common/accessibility)
* [Accessibility in Syncfusion Blazor](https://blazor.syncfusion.com/documentation/common/accessibility)
133 changes: 106 additions & 27 deletions Document-Processing/Excel/Spreadsheet/Blazor/cell-range.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
---
layout: post
title: Managing Cell Ranges in the Blazor Spreadsheet Component | Syncfusion
description: Check out and learn to manage cell range features such as formatting, autofill, and clear options in the Syncfusion Blazor Spreadsheet component and more.
description: Learn how to manage cell range features such as formatting, autofill, and clear options in the Syncfusion Blazor Spreadsheet component and more.
platform: document-processing
control: Spreadsheet
documentation: ug
---

# Managing Cell Ranges in Blazor Spreadsheet component
# Managing Cell Ranges in the Blazor Spreadsheet Component

A cell range is a set of selected cells in a Spreadsheet, typically specified using A1 notation (for example, `A1:B10`). A range may be a single cell or a contiguous block of cells that can be manipulated or processed collectively.

## Cell formatting

To know more about cell formatting, refer [here](./formatting#text-and-cell-formatting).
The Spreadsheet component supports a wide range of cell-formatting operations—including text styling (font family, size, color, and weight), cell fill, borders, alignment, number formats, and conditional formatting—that can be applied to a single cell, a selected range, or the entire worksheet. For more details, refer to the [Text and Cell Formatting](./formatting#text-and-cell-formatting) documentation.

## Autofill

Autofill is used to fill cells with data that follows a pattern or is based on data in other cells. It helps avoid entering repetitive data manually. The [AllowAutofill](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AllowAutofill) property can be used to enable or disable this feature.
The Autofill feature automatically populates adjacent cells with data that follows a pattern or extends values from the source cells. It helps avoid entering repetitive data manually. The [AllowAutofill](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AllowAutofill) property can be used to enable or disable this feature.

* The default value of the [AllowAutofill](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AllowAutofill) property is **true**.

To enable or disable autofill declaratively, set the `AllowAutofill` property on the `SfSpreadsheet` component. For example:

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}

@using Syncfusion.Blazor.Spreadsheet

<SfSpreadsheet AllowAutofill="true">
<SpreadsheetRibbon></SpreadsheetRibbon>
</SfSpreadsheet>

{% endhighlight %}
{% endtabs %}

Autofill can be performed in one of the following ways:

* Drag and drop the cell using the fill handle element.
* Select the source cell or range, then drag and drop the selection using the fill handle element to extend the values to adjacent cells.
* Use the [AutofillAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AutofillAsync_System_String_System_String_) method programmatically.

### Autofill options

Autofill supports multiple behaviors that control how adjacent cells are populated when using the fill handle. The available options are:
Autofill supports multiple behaviors that control how adjacent cells are populated when using the fill handle. After dragging the fill handle, the **AutoFillOptions** menu appears as a popup near the destination range. You can also right-click the destination range and select **AutoFillOptions** to access the same options. The available options are:

- Copy Cells
- Fill Series
Expand All @@ -48,13 +63,13 @@ Applies only the source styling—number format, font, fill color, borders, and

#### Fill Without Formatting

Continues the detected series into the destination range but retains the destinations existing formatting. After dragging the fill handle, choose **Fill Without Formatting** from the **AutoFillOptions** menu to apply only the new values while keeping the target style intact.
Continues the detected series into the destination range but retains the destination's existing formatting. After dragging the fill handle, choose **Fill Without Formatting** from the **AutoFillOptions** menu to apply only the new values while keeping the target style intact.

The following illustration demonstrates the use of autofill in the Spreadsheet component.

![Autofill Illustration](images/autofill.gif)

The [AutofillAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AutofillAsync_System_String_System_String_) method accepts string parameters in A1 notation for `fillRange` and `dataRange`. The available parameters are:
The [AutofillAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_AutofillAsync_System_String_System_String_) method accepts string parameters in A1 notation for `fillRange` and `dataRange`. The following table lists the available parameters:

| Parameter | Type | Description |
| -- | -- | -- |
Expand All @@ -67,16 +82,17 @@ The [AutofillAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Sp
{% tabs %}
{% highlight razor tabtitle="Index.razor" %}

@page "/"
@using Syncfusion.Blazor.Spreadsheet

<button @onclick="AutofillRangeHandler">Autofill</button>
<SfSpreadsheet @ref="spreadsheetObj" DataSource="DataSourceBytes">
<SfSpreadsheet @ref="SpreadsheetInstance" DataSource="DataSourceBytes">
<SpreadsheetRibbon></SpreadsheetRibbon>
</SfSpreadsheet>

@code {
public byte[] DataSourceBytes { get; set; }
public SfSpreadsheet spreadsheetObj;
public SfSpreadsheet SpreadsheetInstance;

protected override void OnInitialized()
{
Expand All @@ -87,14 +103,14 @@ The [AutofillAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Sp
public async Task AutofillRangeHandler()
{
// Basic usage with only the fill range parameter.
await spreadsheetObj.AutofillAsync("B7:B8");
await SpreadsheetInstance.AutofillAsync("B7:B8");
}
}

{% endhighlight %}
{% endtabs %}

## Events
## Autofill Events

The Blazor Spreadsheet provides events that are triggered during autofill operations, such as [AutofillActionBegin](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionBeginEventArgs.html) and [AutofillActionEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionEndEventArgs.html). These events enable the execution of custom actions before and after an autofill operation, allowing for validation, customization, and response handling.

Expand All @@ -110,16 +126,17 @@ This event is useful for scenarios where autofill behavior needs to be controlle

The event uses the [AutofillActionBeginEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionBeginEventArgs.html) class, which includes the following properties:

| Event Arguments | Description |
|----------------|-------------|
| FillRange (read-only) | The address of the target range for the autofill operation (e.g., "Sheet1!A2:A5"). |
| DataRange (read-only) | The source data range for the autofill operation (e.g., "Sheet1!A1:A1"). |
| Direction (read-only) | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |
| Cancel | A boolean value to cancel the autofill operation. |
| Event Arguments | Type | Description |
|---|---|---|
| FillRange (read-only) | string | The address of the target range for the autofill operation (e.g., "Sheet1!A2:A5"). |
| DataRange (read-only) | string | The source data range for the autofill operation (e.g., "Sheet1!A1:A1"). |
| Direction (read-only) | string | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |
| Cancel | bool | A boolean value to cancel the autofill operation. |

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}

@page "/"
@using Syncfusion.Blazor.Spreadsheet

<SfSpreadsheet DataSource="DataSourceBytes" AutofillActionBegin="OnAutofillActionBegin">
Expand Down Expand Up @@ -160,21 +177,22 @@ The [AutofillActionEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.

**Purpose**

This event is useful for scenarios where `post-autofill` actions are needed, such as logging the autofill operation, updating related data, or triggering additional UI updates.
This event is useful for scenarios where actions after the autofill are needed, such as logging the autofill operation, updating related data, or triggering additional UI updates.

**Event Arguments**

The event uses the [AutofillActionEndEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionEndEventArgs.html) class, which includes the following properties:

| Event Arguments | Description |
|----------------|-------------|
| FillRange (read-only) | The address of the target range where the autofill was applied (e.g., "Sheet1!A2:A5"). |
| DataRange (read-only) | The source data range used for the autofill operation (e.g., "Sheet1!A1:A1"). |
| Direction (read-only) | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |
| Event Arguments | Type | Description |
|---|---|---|
| FillRange (read-only) | string | The address of the target range where the autofill was applied (e.g., "Sheet1!A2:A5"). |
| DataRange (read-only) | string | The source data range used for the autofill operation (e.g., "Sheet1!A1:A1"). |
| Direction (read-only) | string | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}

@page "/"
@using Syncfusion.Blazor.Spreadsheet

<SfSpreadsheet DataSource="DataSourceBytes" AutofillActionEnd="OnAutofillActionEnd">
Expand Down Expand Up @@ -202,13 +220,17 @@ The event uses the [AutofillActionEndEventArgs](https://help.syncfusion.com/cr/b

## Clear

The clear functionality helps remove cell contents (formulas and data), formats (including number formats), and hyperlinks from a selected range.
The Clear functionality removes cell contents (formulas and data), formats (including number formats), and hyperlinks from a selected range.

### Applying the clear functionality

The clear support can be applied using the following way:
Clearing can be performed through the user interface (UI) using any of the following methods:

You can apply the clear functionality by selecting the **Clear** icon in the **Ribbon** under the **Home** tab.
**Using the Ribbon**

- Select a cell or a range of cells to clear.
- In the **Home** tab of the **Ribbon**, click the **Clear** drop-down arrow.
- Select one of the following options from the drop-down menu:

| Option | Use |
| -- | -- |
Expand All @@ -220,3 +242,60 @@ You can apply the clear functionality by selecting the **Clear** icon in the **R
The following image displays the clear options available in the Ribbon toolbar under the **Home** tab of the Blazor Spreadsheet.

![Clear options in the Blazor Spreadsheet](images/clear-feature.png)

**Using the Context Menu**

- Select a cell or a range of cells to clear.
- Right-click the selected range to open the context menu.
- Select **Clear Contents** to remove only the formulas and data from the current selection.

### Clear programmatically

The [ClearAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_ClearAsync_Syncfusion_Blazor_Spreadsheet_ClearOperationType_System_String_) method clears contents, formatting, hyperlinks, or all aspects of the specified range or current selection in the spreadsheet.

The available parameters are:

| Parameter | Type | Description |
| -- | -- | -- |
| options | Enum | Specifies the type of clear operation to perform. The available values are: `ClearContents`, `ClearFormats`, `ClearHyperlinks`, and `ClearAll`|
| range | string | The A1-style range to clear |

**Remarks**

* The 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.

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}

@page "/"
@using Syncfusion.Blazor.Spreadsheet

<SfButton OnClick="ClearHandler" Content="Clear Cells"></SfButton>

<SfSpreadsheet @ref="SpreadsheetInstance" DataSource="DataSourceBytes">
<SpreadsheetRibbon></SpreadsheetRibbon>
</SfSpreadsheet>

@code {
public byte[] DataSourceBytes { get; set; }
public SfSpreadsheet SpreadsheetInstance { get; set; }

protected override void OnInitialized()
{
string filePath = "wwwroot/Sample.xlsx";
DataSourceBytes = File.ReadAllBytes(filePath);
}

public async Task ClearHandler()
{
// Clears only contents from range A1:A10 on Sheet1.
await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearContents, "Sample!A1:A10");

// Clears only formats from the current selection.
await SpreadsheetInstance.ClearAsync(ClearOperationType.ClearFormats);
}
}

{% endhighlight %}
{% endtabs %}
Loading