From f2150a525c03c8c12c5aac5b6d31571dd364d47b Mon Sep 17 00:00:00 2001 From: Moushmi Dhanislas Date: Mon, 29 Jun 2026 19:36:47 +0530 Subject: [PATCH] 1036262: Updated restrict editing md file --- .../asp-net-mvc/restrict-editing.md | 281 ++++++++++++++++-- 1 file changed, 259 insertions(+), 22 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/asp-net-mvc/restrict-editing.md b/Document-Processing/Word/Word-Processor/asp-net-mvc/restrict-editing.md index 537a77a84c..8c59bb6847 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-mvc/restrict-editing.md +++ b/Document-Processing/Word/Word-Processor/asp-net-mvc/restrict-editing.md @@ -1,36 +1,281 @@ --- layout: post -title: Restrict Editing in ASP.NET MVC Document Editor Component| Syncfusion -description: Learn here all about Restrict Editing in Syncfusion ASP.NET MVC Document Editor component of Syncfusion Essential JS 2 and more. -platform: document-processing +title: Restrict Editing in ASP.NET MVC DOCX Editor | Syncfusion +description: Learn how to enable Restrict Editing in the ASP.NET MVC DOCX Editor to securely manage document access and control user modifications. control: Restrict Editing documentation: ug --- -# Restrict Editing in Document Editor Component +# Restrict Editing in ASP.NET MVC DOCX Editor -Document Editor provides support to restrict editing. When the protected document includes range permission, then unique user or user group is only authorized to edit separate text area. +Syncfusion® ASP.NET MVC DOCX Editor (Document Editor) provides support for restricting editing within a document. It enables control over how and where content can be modified. This helps limit editing so only specific sections of the document can be changed. + +## Configure on client side + +Document Editor provides options to protect and unprotect a document using the [enforceProtection](https://ej2.syncfusion.com/documentation/api/document-editor/editor#enforceprotection) and [stopProtection](https://ej2.syncfusion.com/documentation/api/document-editor/editor#stopprotection) APIs, enabling various restricting editing operations. + +### Read only mode + +Document Editor supports protecting a document in read-only mode, where users can only view the content without making changes. + +The following example code illustrates how to enforce or remove read-only protection in the Document Editor. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +@Html.EJS().DocumentEditor("container") + .Height("600px") + .EnableToolbar(true) + .ServiceUrl("https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/") + .Created("onCreate") + .Render() + + + + + + +{% endhighlight %} +{% endtabs %} + +### Form filling mode + +Document Editor supports protecting a document with form-filling restrictions, allowing users to edit only form fields. + +The following example code illustrates how to enforce or remove form-filling restrictions in the Document Editor. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +@Html.EJS().DocumentEditor("container") + .Height("600px") + .EnableToolbar(true) + .ServiceUrl("https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/") + .Created("onCreate") + .Render() + + + + + + +{% endhighlight %} +{% endtabs %} + +### Comments only mode + +Document Editor supports protecting a document in comments-only mode, allowing users to add or edit comments only. + +The following example code illustrates how to enforce and remove comments-only protection in the Document Editor. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +@Html.EJS().DocumentEditor("container") + .Height("600px") + .EnableToolbar(true) + .ServiceUrl("https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/") + .Created("onCreate") + .Render() + + + + + + +{% endhighlight %} +{% endtabs %} + +### Track changes only mode + +Document Editor supports protecting a document in revisions-only mode, allowing users to view the document and make corrections while tracking all changes. Users cannot accept or reject tracked changes; only the author can review and finalize them later. + +The following example code illustrates how to enforce and remove revisions-only protection in the Document Editor. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +@Html.EJS().DocumentEditor("container") + .Height("600px") + .EnableToolbar(true) + .ServiceUrl("https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/") + .Created("onCreate") + .Render() + + + + + + +{% endhighlight %} +{% endtabs %} + +### Format restrictions + +Enforces document protection using the specified credentials. In the [enforceProtection](https://ej2.syncfusion.com/documentation/api/document-editor/editor#enforceprotection-1) method, the second parameter represents limitToFormatting, and the third parameter represents isReadOnly. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +container.documentEditor.editor.enforceProtection('password', true, true); + +{% endhighlight %} +{% endtabs %} + +## Configure on server side + +The above-mentioned hosted Web API URL is for demo and evaluation purposes only. For production, host your own web service as shown below. + +The Document Editor client requires a server-side API to generate a hash from the specified password and salt values, which is necessary for the restrict editing functionality. + +For more information on configuring restrict editing on the server side, refer to the following: + +- [Web Service for Restrict editing in ASP.NET Core](https://help.syncfusion.com/document-processing/word/word-processor/asp-net-mvc/restrict-editing) + +- [Web Service for Restrict editing in ASP.NET MVC](https://help.syncfusion.com/document-processing/word/word-processor/asp-net-mvc/restrict-editing) + +- [Web Service for Restrict editing in Java](https://help.syncfusion.com/document-processing/word/word-processor/asp-net-mvc/restrict-editing) ## Set current user -You can use the `currentUser` property to authorize the current document user by name, email, or user group name. +The [currentUser](https://ej2.syncfusion.com/documentation/api/document-editor-container/documenteditor#currentuser) property can be used to authorize the current document user by name, email, or user group. -The following code shows how to set currentUser +The following code example demonstrates how to set the currentUser. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} -```typescript container.documentEditor.currentUser = 'engineer@mycompany.com'; -``` + +{% endhighlight %} +{% endtabs %} ## Highlighting the text area -You can highlight the editable region of the current user using the `userColor` property. +The [userColor](https://ej2.syncfusion.com/documentation/api/document-editor-container/index-default#usercolor) property can be used to highlight the editable region of the current user. -The following code shows how to set userColor. +The following code example demonstrates how to set the userColor. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} -```typescript container.documentEditor.userColor = '#fff000'; -``` + +{% endhighlight %} +{% endtabs %} + +The [highlightEditableRanges](https://ej2.syncfusion.com/documentation/api/document-editor-container/documenteditorsettingsmodel#highlighteditableranges) property can be used to toggle the highlighting of editable regions. + +The following code example demonstrates how to enable or disable editable region highlighting. + +{% tabs %} +{% highlight ts tabtitle="CSHTML" %} + +container.documentEditor.documentEditorSettings.highlightEditableRanges = true; + +{% endhighlight %} +{% endtabs %} ## Restrict Editing Pane @@ -41,12 +286,4 @@ Restrict Editing Pane provides the following options to manage the document: * To add users to the current document, select more users option and add user from the popup dialog. * To include range permission to the current document, select parts of the document and choose users who are allowed to freely edit them from the listed check box. * To apply the chosen editing restrictions, click the **YES,START ENFORCING PROTECTION** button. A dialog box displays asking for a password to protect. -* To stop protection, select **STOP PROTECTION** button. A dialog box displays asking for a password to stop protection. - -## Online Demo - -Explore how to restrict editing and protect Word documents using the ASP.NET MVC Document Editor in this live demo [here](https://document.syncfusion.com/demos/docx-editor/asp-net-mvc/documenteditor/documentprotection#/tailwind3). - -* [How to protect the document in form filling mode](./form-fields#protect-the-document-in-form-filling-mode) -* [How to protect the document in comments only mode](./comments#protect-the-document-in-comments-only-mode) -* [How to protect the document in track changes only mode](./track-changes#protect-the-document-in-track-changes-only-mode) \ No newline at end of file +* To stop protection, select **STOP PROTECTION** button. A dialog box displays asking for a password to stop protection. \ No newline at end of file