You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/Excel/Spreadsheet/Blazor/cell-range.md
+106Lines changed: 106 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,112 @@ The following illustration demonstrates the use of autofill in the Spreadsheet c
102
102
103
103

104
104
105
+
## Events
106
+
107
+
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.
108
+
109
+
### AutofillActionBegin
110
+
111
+
The `AutofillActionBegin` event is triggered before an autofill operation is performed. This event provides an opportunity to validate the autofill operation and apply restrictions based on custom logic, such as preventing the operation under specific conditions.
112
+
113
+
**Purpose**
114
+
115
+
This event is useful for scenarios where autofill behavior needs to be controlled dynamically—such as restricting autofill in specific ranges or preventing autofill based on certain conditions.
116
+
117
+
**Event Arguments**
118
+
119
+
The event uses the [AutofillActionBeginEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionBeginEventArgs.html) class, which includes the following properties:
120
+
121
+
| Event Arguments | Description |
122
+
|----------------|-------------|
123
+
| FillRange (read-only) | The address of the target range for the autofill operation (e.g., "Sheet1!A2:A5"). |
124
+
| DataRange (read-only) | The source data range for the autofill operation (e.g., "Sheet1!A1:A1"). |
125
+
| Direction (read-only) | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |
126
+
| Cancel | A boolean value to cancel the autofill operation. |
public void OnAutofillActionBegin(AutofillActionBeginEventArgs args)
147
+
{
148
+
// Prevent autofill for a specific range.
149
+
if (args.FillRange == "A1:A10")
150
+
{
151
+
args.Cancel = true;
152
+
}
153
+
154
+
// Prevent autofill when dragging upward.
155
+
if (args.Direction == "Up")
156
+
{
157
+
args.Cancel = true;
158
+
}
159
+
}
160
+
}
161
+
162
+
{% endhighlight %}
163
+
{% endtabs %}
164
+
165
+
**AutofillActionEnd**
166
+
167
+
The `AutofillActionEnd` event is triggered after an autofill operation has been successfully completed. This event provides detailed information about the completed autofill action, enabling further processing or logging if required.
168
+
169
+
**Purpose**
170
+
171
+
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.
172
+
173
+
**Event Arguments**
174
+
175
+
The event uses the [AutofillActionEndEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.AutofillActionEndEventArgs.html) class, which includes the following properties:
176
+
177
+
| Event Arguments | Description |
178
+
|----------------|-------------|
179
+
| FillRange (read-only) | The address of the target range where the autofill was applied (e.g., "Sheet1!A2:A5"). |
180
+
| DataRange (read-only) | The source data range used for the autofill operation (e.g., "Sheet1!A1:A1"). |
181
+
| Direction (read-only) | The direction of the autofill operation ("Down", "Right", "Up", or "Left"). |
public void OnAutofillActionEnd(AutofillActionEndEventArgs args)
202
+
{
203
+
// Log or process the completed autofill operation.
204
+
Console.WriteLine($"Autofill completed for range: {args.FillRange}");
205
+
}
206
+
}
207
+
208
+
{% endhighlight %}
209
+
{% endtabs %}
210
+
105
211
## Clear
106
212
107
213
Clear support helps clear the cell contents (formulas and data) and formats (including number formats) in a Spreadsheet. When **Clear All** is applied, both the contents and the formats will be cleared simultaneously.
0 commit comments