Skip to content
Open
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
213 changes: 200 additions & 13 deletions Document-Processing/Word/Word-Processor/blazor/restrict-editing.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,201 @@
---
layout: post
title: Restrict editing in Blazor DocumentEditor Component | Syncfusion
description: Checkout and learn here all about Restrict editing in Syncfusion Blazor DocumentEditor component and more.
title: Restrict editing in Blazor DOCX Editor | Syncfusion
description: Learn how to enable Restrict Editing in the Blazor DOCX Editor to securely manage document access and control user modifications.
platform: document-processing
control: DocumentEditor
documentation: ug
---

# Restrict editing in Blazor DocumentEditor Component
# Restrict editing in Blazor DOCX Editor

This [Blazor Word Processor control](https://www.syncfusion.com/blazor-components/blazor-word-processor) (DocumentEditor) provides 2 types of restriction for editing:
* Read-only: Allows all the users to view the document contents but not make changes to it.
* Allows changes to certain portion of the document: Allows the users to edit to certain portion of the document.
Syncfusion® [Blazor Word Processor control](https://www.syncfusion.com/blazor-components/blazor-word-processor) (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.

## Read only
## 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 code example shows how to restrict or protect editing for the entire content (show as read-only).

```cshtml
@using Syncfusion.Blazor.DocumentEditor

<button @onclick="ReadOnly">Read Only</button>
<SfDocumentEditorContainer @ref="container" EnableToolbar=true></SfDocumentEditorContainer>
<button @onclick="OpenDocument">Open Document</button>
<button @onclick="EnforceProtection">Enforce Protection</button>
<button @onclick="StopProtection">Stop Protection</button>

<SfDocumentEditorContainer
@ref="container"
EnableToolbar="true"
Height="600px"
ServiceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/">
</SfDocumentEditorContainer>

@code {
SfDocumentEditorContainer container;

public void ReadOnly(object args)
async Task OpenDocument()
{
string sfdt = {"sfdt":"UEsDBAoAAAAIAMBmyVzP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ozdmbNHgu7QjhvfjOisBGG8mNAwdiZNXtuKMCDd0o3LzTM21VHXHyBkPFtZPTRNVaboz3T35YUs29L3nNEqH3Y8VNTwCVXugnj8HVYGp/+NJh2gqp96BZyFXNnJNH6NQ1wfdJzWf5GZSpmJfWbY4jrs4S4Pvnw838aPGOQG9c0yI1pq3g50W7MEu3G9AW9tLAfIJ74ah6iwLV0fC1jk32iJfM7QgcXP786scXVPxoY/657pk8JTgY5/cXO48cJ7J8l84GMcx2NK/eNCxb7McunaH000Tr9D1BLAQIUAAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAAAAAAAAAAAAAAAAAAABzZmR0UEsFBgAAAAABAAEAMgAAADkHAAAAAA=="};

await container.DocumentEditor.OpenAsync(sfdt);
}

// Enforce protection
async Task EnforceProtection()
{
container.RestrictEditing = true;
await container.DocumentEditor.Editor
.EnforceProtectionAsync("123", ProtectionType.ReadOnly);
}

// Stop protection
async Task StopProtection()
{
await container.DocumentEditor.Editor
.StopProtectionAsync("123");
}
}
```

## Form filling mode

Document Editor supports protecting a document with form-filling restrictions, allowing users to edit only form fields.

The following code example illustrates how to enforce form-filling protection in the Document Editor.

```cshtml
@using Syncfusion.Blazor.DocumentEditor

<button @onclick="OpenDocument">Open Document</button>
<button @onclick="EnforceProtection">Enforce Protection</button>
<button @onclick="StopProtection">Stop Protection</button>

<SfDocumentEditorContainer
@ref="container"
EnableToolbar="true"
Height="600px"
ServiceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/">
</SfDocumentEditorContainer>

@code {
SfDocumentEditorContainer container;

async Task OpenDocument()
{
string sfdt = { "sfdt": "UEsDBAoAAAAIAGlfyVyMVz+kgAMAAL0ZAAAEAAAAc2ZkdM1YW2+bMBT+K5H3GlUBEgi8Vd2iPexSbXmYVOXBgB2smsvAbdpGkab91P2S+QYJzaW0TQhRpM/BHJ/P5/t8gliCNGMkJk/oJw4Z8Fh+h/oARj7wMKQF6oMCBcC7WQrMcuAtQbYAnm2Yf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XP6SAAwAAvRkAAAQAAAAAAAAAAAAAAAAAAAAAAHNmZHRQSwUGAAAAAAEAAQAyAAAAogMAAAAA" };

await container.DocumentEditor.OpenAsync(sfdt);
}

// Enforce protection
async Task EnforceProtection()
{
await container.DocumentEditor.Editor
.EnforceProtectionAsync("123", ProtectionType.ReadOnly);
}

// Stop protection
async Task StopProtection()
{
await container.DocumentEditor.Editor
.StopProtectionAsync("123");
}
}
```

## Comments only mode

Document Editor supports protecting a document in comments-only mode, allowing users to add or edit comments only.

The following code example illustrates how to enforce and remove comments-only protection in the Document Editor.

```cshtml
@using Syncfusion.Blazor.DocumentEditor

<button @onclick="OpenDocument">Open Document</button>
<button @onclick="EnforceProtection">Enforce Protection</button>
<button @onclick="StopProtection">Stop Protection</button>

<SfDocumentEditorContainer
@ref="container"
EnableToolbar="true"
Height="600px"
ServiceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/">
</SfDocumentEditorContainer>

@code {
SfDocumentEditorContainer container;

async Task OpenDocument()
{
string sfdt = {"sfdt":"UEsDBAoAAAAIALBkyVwLdNuZlgcAANcqAAAEAAAAc2ZkdO1aT2/cNhb/KgJ7dYMZzYzmz6127LqJnRiJm6Lb+sCRyBFjSdSKlJ2pEaBIT70UWKC72MMW2NseFosWaIEt9rIfJkCC3fZD9D2S8vzxzGRcT2dcIBMjT+KjyPd+7/FHiuIFkbkWqfiMPeaRJj1dlGyL0LhPepwmim0RxULS++QCZV6Q3gXJz0kvqPtbJI9Jr92FiySFC5CFk9rJvpNxRHqNYItwJyOek14NpGT2oi+sgJ7IA3Z+RAeMbBGWcdKDxzlKUBeiksxIwTPSq4NkVuaDTEED7xW0L0J4PgtlooyG/fHcyKSvQ/Oo1Xxy8hw6Nd7lHF3rR4VCqcGsC9Al2spiYGXf3cdWnKHAYuylA7CBbEDrSoNBZJ/RSGQDrw6mJGi6qRuajrj6zD7C4Zbs0ET0CwH1oByxsBq8GtdxOnWfcTZVMlEAvQnj3Hr71EmOUYjOWK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AAAACACwZMlcC3TbmZYHAADXKgAABAAAAAAAAAAAAAAAAAAAAAAAc2ZkdFBLBQYAAAAAAQABADIAAAC4BwAAAAA="};

await container.DocumentEditor.OpenAsync(sfdt);
}

// Enforce protection
async Task EnforceProtection()
{
await container.DocumentEditor.Editor
.EnforceProtectionAsync("123", ProtectionType.ReadOnly);
}

// Stop protection
async Task StopProtection()
{
await container.DocumentEditor.Editor
.StopProtectionAsync("123");
}
}
```

## 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 code example illustrates how to enforce and remove revisions-only protection in the Document Editor.

```cshtml
@using Syncfusion.Blazor.DocumentEditor

<button @onclick="OpenDocument">Open Document</button>
<button @onclick="EnforceProtection">Enforce Protection</button>
<button @onclick="StopProtection">Stop Protection</button>

<SfDocumentEditorContainer
@ref="container"
EnableToolbar="true"
Height="600px"
ServiceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/">
</SfDocumentEditorContainer>

@code {
SfDocumentEditorContainer container;

async Task OpenDocument()
{
string sfdt = {"sfdt":"UEsDBAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAc2ZkdO1aS28bNxD+K4vtVQj0ft3qV5zEdozYSREkPlArrpYW99El145iGCiSUy8FCqRFDw3QWw9F0QAN0KCX/hgDDtr0R3SGpKRdWVLkWJUcIDLgITl8zHxDfuRy98QOI8l89pTuuW1pN2Wc0JxNvJbddAkXNGcL6tjNRycoo9huntjRsd2sFoo5O/LsZq0BCe5DAmRspDSyZaTXtpulas52jWy7kd3MgwypTrSYFjCSvUOPd0mH2jmbBq7dhOYuSlDHrC+pkswN7GYBJNUy6gQCOvg8Ji3mQPvACblQGvrlsZK8JR3VVGseHZzCoMq7yEXXWu1YoJRg1gnouNQy7mjZMnlPiyMUWIyj1AE2kCXoXUgwyN6kpM2CjlUAUziaruo6aiBXPNVNXMjaq4SzVsygHpQjFlqDqbTOJSP5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6XnQI4FP4n69na6CYR0Wnq+A404XJxdDZie65V3hk3SdXY8gIihEZAIRTAgEqA4nq+gkFUzUUSv2CacZEPYJcAXVmiSjwWAobaLUrgqgMR8J0mfBTFSUJo7KTCRUmYmEKjOQELDG+Y8vZySe91FOf34ZoulnDb2shnGbXY1d1kgS7FJYPp/IZa7k0o/UJ0q51pSibgfwOGjjnPlsw/xsdVLuDShmcF42h6urHC/x4Fg3B8cbhXIDf7VqoVIvlIvDg+SFp+SRO4F5XAQET4au9fkufSkyB2fVzUtRn4sLk579q9krj8FhzFUxKa7XyisViMnwQaM6CsCwSRqGVGkGjFT5mOL3AFOcHzDF/izI1xqFarVayddqxXyjXMs+TxQn4VaajttGpdyoZnArLRG30sJxK027a5qMW2GjVKuWMrgVl4hbeeG4lS/ixvrPqrPNN9ZKNVgSbpWF41aZztpTlueyMKouHKPqpTBKL8VFY7RGXZJwae2SmHRiEnnWRhhIDVihf112YXOAEzCJs5WuK1m3Jjt5gbsnu3XtuPQSbpXHuXVNqe4SblXGRmv5THQJF6qXdGFRRDGjCzSeD7EaqoS+zM0/8GwJtue2vsGVh4p3JV7iqrd2sHdX6xl1pa8+SF3xK7ozdmbNHgu7QjhvfjOisBGG8mNAwdiZNXtuKMCDd0o3LzTM21VHXHyBkPFtZPTRNVaboz3T35YUs29L3nNEqH3Y8VNTwCVXugnj8HVYGp/+NJh2gqp96BZyFXNnJNH6NQ1wfdJzWf5GZSpmJfWbY4jrs4S4Pvnw838aPGOQG9c0yI1pq3g50W7MEu3G9AW9tLAfIJ74ah6iwLV0fC1jk32iJfM7QgcXP786scXVPxoY/657pk8JTgY5/cXO48cJ7J8l84GMcx2NK/eNCxb7McunaH000Tr9D1BLAQIUAAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAAAAAAAAAAAAAAAAAAABzZmR0UEsFBgAAAAABAAEAMgAAADkHAAAAAA=="};

await container.DocumentEditor.OpenAsync(sfdt);
}

// Enforce protection
async Task EnforceProtection()
{
await container.DocumentEditor.Editor
.EnforceProtectionAsync("123", ProtectionType.ReadOnly);
}

// Stop protection
async Task StopProtection()
{
await container.DocumentEditor.Editor
.StopProtectionAsync("123");
}
}
}
```

## Allows changes to certain portion of the document

Also, at some situations, you might need to allow changes for a certain portion of the document alone. Microsoft Word allows you to [make changes to parts of a Word document](https://support.microsoft.com/en-us/office/allow-changes-to-parts-of-a-protected-document-187ed01c-8795-43e1-9fd0-c9fca419dadf?ui=en-us&rs=en-us&ad=us). Likewise, the document editor control allows the users to make changes to certain parts of a document using similar user interface.
Expand All @@ -41,6 +204,30 @@ Also, at some situations, you might need to allow changes for a certain portion

![Enabling Restrict Editing in Blazor DocumentEditor](./images/blazor-document-editor-enable-edit-restriction.png)

## Online Demo
## Set current user

Explore how to restrict editing and protect Word documents using the Blazor Document Editor in this live demo [here](https://document.syncfusion.com/demos/docx-editor/blazor-server/document-editor/document-protection?theme=fluent2).
The `CurrentUser` property can be used to authorize the current document user by name, email, or user group.

The following code example demonstrates how to set the CurrentUser.

```cshtml
container.DocumentEditor.CurrentUser = "engineer@mycompany.com";
```

## Highlighting the text area

The `UserColor` property can be used to highlight the editable region of the current user.

The following code example demonstrates how to set the UserColor.

```cshtml
container.DocumentEditor.UserColor = "#fff000";
```

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

```cshtml
container.DocumentEditor.DocumentEditorSettings.HighlightEditableRanges = true;
```