Restrict Editing of Word Documents Based on User in a Web Application
Tags: javascript, angular, react, webdev
Published: 2023-01-10 13:34:31

---
title: Restrict Editing of Word Documents Based on User in a Web Application
published: true
date: 2023-01-06 11:35:06 UTC
tags: javascript, angular, react, webdev
canonical_url: https://www.syncfusion.com/blogs/post/restrict-editing-of-word-documents-based-on-user-in-a-web-application.aspx
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tviwv1cwkac5l4qy5mud.png
---
In this blog, we will show you how to restrict editing in a Word document based on user in a web application using the [Syncfusion Word Processor (a.k.a. document editor)](https://www.syncfusion.com/javascript-ui-controls/js-word-processor "JavaScript Word Processor"). You can easily select parts or regions in the document and choose the users who can edit them freely. This works independently without Microsoft Word or Office interop dependencies.

Syncfusion [Word Processor](https://www.syncfusion.com/javascript-ui-controls/js-word-processor "JavaScript Word Processor") is a user interface web component that allows you to draft, edit, view, and print Word documents interactively in a web application. This component is available in our JavaScript (ES5 and ES6), Angular, React, Vue, ASP.NET MVC, ASP.NET Core, and Blazor platforms.

Word Processor (document editor) component supports locking or protecting a Word document from editing with four types of restrictions:

- Read only: Allows no changes in the document.
- Filling in forms: Allows the user only to fill the form fields in the document.
- Comments: Allows the user only to add new comments or edit an existing comment in the document.
- Tracked changes: Allows the user to edit the document, but all the changes are tracked. Those tracked changes can be accepted or rejected only after unlocking with a password.

You can open the Restrict Editing pane by choosing **Protections** in the **Restrict Editing** dropdown.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/01/Restrict-Editing-dropdown-in-the-toolbar-2.png" alt="Restrict Editing dropdown in the toolbar" style="width:100%">

  <figcaption>Restrict Editing dropdown in the toolbar</figcaption>

</figure>
The following screenshot illustrates the Restrict Editing pane of the Word Processor component.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/01/The-Restrict-Editing-pane-of-Syncfusion-Word-Processor-component-4.png" alt="The Restrict Editing pane of Syncfusion Word Processor component" style="width:100%">

  <figcaption>The Restrict Editing pane of Syncfusion Word Processor component</figcaption>

</figure>
## Select content and add edit permissions for users

Microsoft Word has a unique option to add an exception to a part of the content and choose the users who can freely edit it when the document is protected with read-only editing restrictions. The Syncfusion Word Processor component has the same functionality. The document’s editable regions will be highlighted by default. You can customize the highlight color with the [userColor](https://ej2.syncfusion.com/documentation/api/document-editor#usercolor "userColor property of JavaScript Word Processor") property in your application.

The following GIF image illustrates how to select part of the content in a Word document and add users as exceptions to its read-only status in the Syncfusion Word Processor component.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/01/Adding-users-as-exceptions-in-a-Word-document-2.gif" alt="Adding users as exceptions in a Word document" style="width:100%">

  <figcaption>Adding users as exceptions in a Word document</figcaption>

</figure>
If you want to remove an editable region, select that region in the document (or place the cursor in the highlighted region) and uncheck the specific user in the exceptions list.

## Enforcing protection

You can protect the document with a password before sending it to other collaborators. The other users can read the entire document but modify it only in the editable region marked for them.

Once you have prepared and finalized the document, click **Yes, Start Enforcing Protection** in the Restrict Editing pane.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/01/The-enforce-protection-option-in-the-Restrict-Editing-pane-2.png" alt="The enforce protection option in the Restrict Editing pane" style="width:100%">

  <figcaption>The enforce protection option in the Restrict Editing pane</figcaption>

</figure>
The password pop-up will open. Set the required password and confirm it. Now, the document is ready to share with other collaborators.

## Navigate to editable region marked for the user

In your web application, you should configure the [currentUser](https://ej2.syncfusion.com/documentation/api/document-editor#currentuser "currentUser property of JavaScript Word Processor") property with the user who opens the application. The Word Processor component automatically highlights the editable regions marked for that user, while other editable areas in the document will be non-editable.

The Word Processor provides an intuitive option to navigate to the editable regions of the current user in a Word document.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/01/Navigate-among-the-editable-regions-of-the-current-user-2.png" alt="Navigate among the editable regions of the current user" style="width:100%">

  <figcaption>Navigate among the editable regions of the current user</figcaption>

</figure>
## GitHub repository

For more information, refer to the complete, working [example of restricting editing based on user in Word Processor](https://github.com/SyncfusionExamples/restrict-editing-based-on-user-in-word-processor "Restrict editing based on user in Syncfusion Word Processor GitHub demo").

## Summary

With the help of the [Syncfusion Word Processor](https://www.syncfusion.com/javascript-ui-controls/js-word-processor "JavaScript Word Processor"), you can easily create a Word document with user-specific editable regions and protect the document with a password in your web application.

Take a moment to peruse the [getting started documentation](https://ej2.syncfusion.com/documentation/document-editor/getting-started/ "Getting started with JavaScript DocumentEditor documentation"), where you’ll find other options and features, all with accompanying code examples. You can see the [documentation](https://ej2.syncfusion.com/documentation/document-editor/restrict-editing/ "Restrict Editing in JavaScript DocumentEditor documentation") for more information about the restricted editing functionality.

Are you already a Syncfusion user? You can download the product setup [here](https://www.syncfusion.com/account/downloads/studio/ "License and download page of Essential Studio"). If you’re not yet a Syncfusion user, you can download a[free 30-day trial](https://www.syncfusion.com/downloads/fileformats/confirm "Free evaluation of the Syncfusion Essential Studio").

Please let us know in the comments below if you have any questions about these features. You can also contact us through our [support forum](https://www.syncfusion.com/forums?_ga=2.160385213.108886952.1555906495-214292665.1551328372 "Syncfusion Support Forum"), [support portal](https://support.syncfusion.com/support/tickets "Syncfusion Support Portal"), or [feedback portal](https://www.syncfusion.com/feedback/word "Syncfusion Feedback Portal"). We are happy to assist you!

## Related blogs

- [3 Easy Ways to Convert Word Documents to Images in C#](https://www.syncfusion.com/blogs/post/convert-word-documents-to-images-in-csharp.aspx "Blog: 3 Easy Ways to Convert Word Documents to Images in C#")
- [Easily Create a Fillable Form Using JavaScript Word Processor](https://www.syncfusion.com/blogs/post/easily-create-a-fillable-form-using-javascript-word-processor.aspx "Blog: Easily Create a Fillable Form Using JavaScript Word Processor")
- [Document Editing Made Easy: Syncfusion Word Processor + Wisej](https://www.syncfusion.com/blogs/post/document-editing-made-easy-syncfusion-word-processor-wisej.aspx "Blog: Document Editing Made Easy: Syncfusion Word Processor + Wisej")
- [7 Smart Ways to Find and Replace Text in a Word Document Using Java](https://www.syncfusion.com/blogs/post/find-and-replace-text-in-word-document-using-java.aspx "Blog: 7 Smart Ways to Find and Replace Text in a Word Document Using Java")