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
6 changes: 6 additions & 0 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -5081,6 +5081,7 @@
<li><a href="/document-processing/excel/spreadsheet/asp-net-core/how-to/create-a-object-structure">Create a object structure </a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-core/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-core/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-core/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-core/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down Expand Up @@ -5131,6 +5132,7 @@
<li><a href="/document-processing/excel/spreadsheet/asp-net-mvc/how-to/create-a-object-structure">Create a object structure </a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-mvc/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-mvc/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-mvc/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/asp-net-mvc/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down Expand Up @@ -5183,6 +5185,7 @@
<li><a href="/document-processing/excel/spreadsheet/angular/how-to/create-a-object-structure">Create a object structure </a></li>
<li><a href="/document-processing/excel/spreadsheet/angular/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/angular/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/angular/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/angular/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down Expand Up @@ -5280,6 +5283,7 @@
<li><a href="/document-processing/excel/spreadsheet/vue/how-to/create-a-object-structure">Create a object structure </a></li>
<li><a href="/document-processing/excel/spreadsheet/vue/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/vue/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/vue/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/vue/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down Expand Up @@ -5329,6 +5333,7 @@
<li><a href="/document-processing/excel/spreadsheet/javascript-es5/how-to/create-a-object-structure">Create a JSON structure</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es5/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es5/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es5/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es5/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down Expand Up @@ -5377,6 +5382,7 @@
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/how-to/create-a-object-structure">Create a JSON structure</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/how-to/prevent-actions">Prevent Actions Without Read-Only and Sheet Protection</a></li>
</ul>
</li>
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/mobile-responsiveness">Mobile Responsiveness</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
layout: post
title: Prevent actions without read-only and sheet protection | Syncfusion
description: Learn here all about to prevent actions without read-only and sheet protection in ASP.NET Core Spreadsheet of Syncfusion Essential JS 2 and more.
control: Spreadsheet
platform: document-processing
documentation: ug
---

# Prevent actions without read-only and protection in Spreadsheet

In Syncfusion ASP.NET Core Spreadsheet, the [**read-only**](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-core/protect-sheet#make-cells-read-only-without-protecting-worksheet) feature makes a range of cells, rows, or columns completely non-editable and restricts all spreadsheet actions on those cells. Similarly, the [**sheet protection**](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-core/protect-sheet#protect-sheet) feature locks the entire sheet and restricts all spreadsheet actions on the sheet. It does not allow actions such as formatting cells, rows, or columns, selecting cells, or inserting hyperlinks—unless these options are explicitly enabled in the [`protectSettings`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/protectsettingsmodel).

If your requirement is to prevent actions (such as cut, paste, autofill, formatting, and validation) without locking the entire sheet using the [`protectSheet`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/index-default#protectsheet) method or making the cells read-only via the [`setRangeReadOnly`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/index-default#setrangereadonly) method, you can achieve this through event-based customization. This approach allows you to restrict specific actions on selected cells while keeping the rest of the sheet fully interactive.

**Events to Use**
To achieve this requirement, the following events can be used:

* [`cellEdit`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_CellEdit) → To prevent editing for specific cells.
* [`actionBegin`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_ActionBegin)→ To prevent spreadsheet actions such as cut, paste, autofill, formatting, etc.

**Step 1: Prevent editing for specific cells**

To prevent editing for specific cells, use the [`cellEdit`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_CellEdit) event, which triggers whenever a cell enters edit mode. By checking the column index and setting `args.cancel = true`, you can prevent editing for those columns. This ensures that users cannot modify the cell content in those columns.

**Step 2: Prevent specific spreadsheet actions**

To prevent specific action after preventing the cell editing, you need to use the [`actionBegin`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_ActionBegin) event. This event triggers before any action starts (such as cut, paste, autofill, formatting, etc.). In this event:

* Fetch the target address based on the type of action being performed using `args.action` property.
* Verify if the target range includes the restricted columns.
* If the column is in the restricted list, cancel the action by setting `args.cancel = true`.

This approach ensures that spreadsheet actions such as cut, paste, autofill, formatting, validation, and conditional formatting are prevented for specific cells without protecting the sheet or making the cells read-only.

> **Note:** In this example, we use column indexes to restrict actions. You can also use row indexes or cell addresses for the same purpose.

The following example demonstrates how to prevent actions such as cut, paste, autofill, formatting, validation, and conditional formatting for specific cells(in the first and third columns) in the spreadsheet without protecting the sheet or making the cells read-only. You can also restrict additional actions by following the same approach.

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/spreadsheet/asp-net-core/prevent-actions-cs1/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="PreventActionController.cs" %}
{% include code-snippet/spreadsheet/asp-net-mvc/prevent-actions-cs1/PreventActionController.cs %}
{% endhighlight %}
{% endtabs %}

## See Also

* [Protection](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-core/protect-sheet)
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
layout: post
title: Prevent actions without read-only and sheet protection | Syncfusion
description: Learn here all about to prevent actions without read-only and sheet protection in ASP.NET MVC Spreadsheet of Syncfusion Essential JS 2 and more.
control: Spreadsheet
platform: document-processing
documentation: ug
---

# Prevent actions without read-only and protection in Spreadsheet

In Syncfusion ASP.NET MVC Spreadsheet, the [**read-only**](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-mvc/protect-sheet#make-cells-read-only-without-protecting-worksheet) feature makes a range of cells, rows, or columns completely non-editable and restricts all spreadsheet actions on those cells. Similarly, the [**sheet protection**](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-mvc/protect-sheet#protect-sheet) feature locks the entire sheet and restricts all spreadsheet actions on the sheet. It does not allow actions such as formatting cells, rows, or columns, selecting cells, or inserting hyperlinks—unless these options are explicitly enabled in the [`protectSettings`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/protectsettingsmodel).

If your requirement is to prevent actions (such as cut, paste, autofill, formatting, and validation) without locking the entire sheet using the [`protectSheet`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/index-default#protectsheet) method or making the cells read-only via the [`setRangeReadOnly`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/index-default#setrangereadonly) method, you can achieve this through event-based customization. This approach allows you to restrict specific actions on selected cells while keeping the rest of the sheet fully interactive.

**Events to Use**
To achieve this requirement, the following events can be used:

* [`cellEdit`](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_CellEdit) → To prevent editing for specific cells.
* [`actionBegin`](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_ActionBegin)→ To prevent spreadsheet actions such as cut, paste, autofill, formatting, etc.

**Step 1: Prevent editing for specific cells**

To prevent editing for specific cells, use the [`cellEdit`](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_CellEdit) event, which triggers whenever a cell enters edit mode. By checking the column index and setting `args.cancel = true`, you can prevent editing for those columns. This ensures that users cannot modify the cell content in those columns.

**Step 2: Prevent specific spreadsheet actions**

To prevent specific action after preventing the cell editing, you need to use the [`actionBegin`](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.spreadsheet.spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_ActionBegin) event. This event triggers before any action starts (such as cut, paste, autofill, formatting, etc.). In this event:

* Fetch the target address based on the type of action being performed using `args.action` property.
* Verify if the target range includes the restricted columns.
* If the column is in the restricted list, cancel the action by setting `args.cancel = true`.

This approach ensures that spreadsheet actions such as cut, paste, autofill, formatting, validation, and conditional formatting are prevented for specific cells without protecting the sheet or making the cells read-only.

> **Note:** In this example, we use column indexes to restrict actions. You can also use row indexes or cell addresses for the same purpose.

The following example demonstrates how to prevent actions such as cut, paste, autofill, formatting, validation, and conditional formatting for specific cells(in the first and third columns) in the spreadsheet without protecting the sheet or making the cells read-only. You can also restrict additional actions by following the same approach.

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/spreadsheet/asp-net-mvc/prevent-actions-cs1/razor %}
{% endhighlight %}
{% highlight c# tabtitle="PreventActionController.cs" %}
{% include code-snippet/spreadsheet/asp-net-mvc/prevent-actions-cs1/PreventActionController.cs %}
{% endhighlight %}
{% endtabs %}

## See Also

* [Protection](https://help.syncfusion.com/document-processing/excel/spreadsheet/asp-net-mvc/protect-sheet)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
layout: post
title: Prevent actions without read-only and sheet protection | Syncfusion
description: Learn here all about to prevent actions without read-only and sheet protection in Angular Spreadsheet component of Syncfusion Essential JS 2 and more.
control: Spreadsheet
platform: document-processing
documentation: ug
---

# Prevent actions without read-only and protection in Spreadsheet

In Syncfusion Angular Spreadsheet, the [**read-only**](https://help.syncfusion.com/document-processing/excel/spreadsheet/angular/protect-sheet#make-cells-read-only-without-protecting-worksheet) feature makes a range of cells, rows, or columns completely non-editable and restricts all spreadsheet actions on those cells. Similarly, the [**sheet protection**](https://help.syncfusion.com/document-processing/excel/spreadsheet/angular/protect-sheet#protect-sheet) feature locks the entire sheet and restricts all spreadsheet actions on the sheet. It does not allow actions such as formatting cells, rows, or columns, selecting cells, or inserting hyperlinks—unless these options are explicitly enabled in the [`protectSettings`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/protectsettingsmodel).

If your requirement is to prevent actions (such as cut, paste, autofill, formatting, and validation) without locking the entire sheet using the [`protectSheet`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#protectsheet) method or making the cells read-only via the [`setRangeReadOnly`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#setrangereadonly) method, you can achieve this through event-based customization. This approach allows you to restrict specific actions on selected cells while keeping the rest of the sheet fully interactive.

**Events to Use**
To achieve this requirement, the following events can be used:

* [`cellEdit`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#celledit) → To prevent editing for specific cells.
* [`actionBegin`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#actionbegin)→ To prevent spreadsheet actions such as cut, paste, autofill, formatting, etc.

**Step 1: Prevent editing for specific cells**

To prevent editing for specific cells, use the [`cellEdit`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#celledit) event, which triggers whenever a cell enters edit mode. By checking the column index and setting `args.cancel = true`, you can prevent editing for those columns. This ensures that users cannot modify the cell content in those columns.

**Step 2: Prevent specific spreadsheet actions**

To prevent specific action after preventing the cell editing, you need to use the [`actionBegin`](https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/index-default#actionbegin) event. This event triggers before any action starts (such as cut, paste, autofill, formatting, etc.). In this event:

* Fetch the target address based on the type of action being performed using `args.action` property.
* Verify if the target range includes the restricted columns.
* If the column is in the restricted list, cancel the action by setting `args.cancel = true`.

This approach ensures that spreadsheet actions such as cut, paste, autofill, formatting, validation, and conditional formatting are prevented for specific cells without protecting the sheet or making the cells read-only.

> **Note:** In this example, we use column indexes to restrict actions. You can also use row indexes or cell addresses for the same purpose.

The following example demonstrates how to prevent actions such as cut, paste, autofill, formatting, validation, and conditional formatting for specific cells(in the first and third columns) in the spreadsheet without protecting the sheet or making the cells read-only. You can also restrict additional actions by following the same approach.

{% tabs %}
{% highlight ts tabtitle="app.component.ts" %}
{% include code-snippet/spreadsheet/angular/prevent-actions-cs1/src/app.component.ts %}
{% endhighlight %}
{% highlight ts tabtitle="main.ts" %}
{% include code-snippet/spreadsheet/angular/prevent-actions-cs1/src/main.ts %}
{% endhighlight %}
{% endtabs %}


{% previewsample "/document-processing/code-snippet/spreadsheet/angular/prevent-actions-cs1" %}

## See Also

* [Protection](https://help.syncfusion.com/document-processing/excel/spreadsheet/angular/protect-sheet)
Loading