Restrict Editing of Word Documents Based on User in a Web Application | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (163).NET Core  (29).NET MAUI  (81)Angular  (81)ASP.NET  (50)ASP.NET Core  (79)ASP.NET MVC  (88)Azure  (38)Blazor  (160)DocIO  (23)Essential JS 2  (89)Essential Studio  (180)File Formats  (33)Flutter  (123)JavaScript  (190)Microsoft  (114)PDF  (68)React  (65)Succinctly series  (128)Syncfusion  (634)TypeScript  (32)Uno Platform  (3)UWP  (4)Vue  (40)Webinar  (35)Windows Forms  (59)WinUI  (56)WPF  (140)Xamarin  (157)XlsIO  (26)Other CategoriesBarcode  (5)BI  (29)Bold BI  (5)Build conference  (6)Business intelligence  (54)Button  (4)C#  (121)Chart  (59)Cloud  (13)Company  (445)Dashboard  (8)Data Science  (3)Data Validation  (6)DataGrid  (56)Development  (418)Doc  (7)DockingManager  (1)eBook  (96)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (24)Extensions  (19)File Manager  (4)Gantt  (14)Gauge  (11)Git  (4)Grid  (28)HTML  (12)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (333)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (33)Performance  (10)PHP  (1)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (8)Road Map  (11)Scheduler  (39)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (23)Solution Services  (3)Spreadsheet  (11)SQL  (8)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (95)UI  (238)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (23)Visual Studio Code  (17)Web  (396)What's new  (229)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Restrict Editing of Word Documents Based on User in a Web Application

Restrict Editing of Word Documents Based on User in a Web Application

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). 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 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.

Restrict Editing dropdown in the toolbar
Restrict Editing dropdown in the toolbar

The following screenshot illustrates the Restrict Editing pane of the Word Processor component.

The Restrict Editing pane of Syncfusion Word Processor component
The Restrict Editing pane of the Syncfusion Word Processor component

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

Adding users as exceptions in a Word document
Adding users as exceptions in a Word document

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.

The enforce protection option in the Restrict Editing pane
The enforce protection option in the Restrict Editing pane

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

Navigate among the editable regions of the current user
Navigate among the editable regions of the current user

GitHub repository

For more information, refer to the complete, working example of restricting editing based on user in Word Processor.

Summary

With the help of the Syncfusion 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, where you’ll find other options and features, all with accompanying code examples. You can see the documentation for more information about the restricted editing functionality.

Are you already a Syncfusion user? You can download the product setup here. If you’re not yet a Syncfusion user, you can download a free 30-day trial.

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, support portal, or feedback portal. We are happy to assist you!

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top