From 595e071a7eb9ddf16b20c3b48eb2db6613995288 Mon Sep 17 00:00:00 2001 From: Moushmi Dhanislas Date: Mon, 29 Jun 2026 21:04:28 +0530 Subject: [PATCH 1/4] 1036262: Update restrict editing in md file --- .../javascript-es6/restrict-editing.md | 457 +++++++++++++++++- .../javascript-es6/web-services/core.md | 7 +- .../javascript-es6/web-services/java.md | 11 +- .../javascript-es6/web-services/mvc.md | 7 +- 4 files changed, 448 insertions(+), 34 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md b/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md index 04c9a562df..2887e8d9d5 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md @@ -1,36 +1,451 @@ --- layout: post -title: Restrict editing in JavaScript (ES6) Document Editor Control | Syncfusion -description: Learn here all about Restrict editing in Syncfusion JavaScript (ES6) Document Editor control of Syncfusion Essential JS 2 and more. +title: Restrict editing in JavaScript (ES6) DOCX Editor | Syncfusion +description: Learn how to enable Restrict Editing in the JavaScript (ES6) DOCX Editor to securely manage document access and control user modifications. platform: document-processing control: Restrict editing documentation: ug domainurl: ##DomainURL## --- -# Restrict Editing in JavaScript (ES6) Document Editor Control +# Restrict Editing in JavaScript (ES6) DOCX Editor -Document Editor provides support to restrict editing. When the protected document includes range permission, then unique user or user group only authorized to edit separate text area. +Syncfusion® JavaScript (ES6) 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="index.ts" %} + +import { DocumentEditorContainer, Toolbar } from '@syncfusion/ej2-documenteditor'; + +DocumentEditorContainer.Inject(Toolbar); +let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true, serviceUrl: 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/' }); +container.appendTo('#container'); + +let sfdt: any = {"sfdt":"UEsDBAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAc2ZkdO1aS28bNxD+K4vtVQj0ft3qV5zEdozYSREkPlArrpYW99El145iGCiSUy8FCqRFDw3QWw9F0QAN0KCX/hgDDtr0R3SGpKRdWVLkWJUcIDLgITl8zHxDfuRy98QOI8l89pTuuW1pN2Wc0JxNvJbddAkXNGcL6tjNRycoo9huntjRsd2sFoo5O/LsZq0BCe5DAmRspDSyZaTXtpulas52jWy7kd3MgwypTrSYFjCSvUOPd0mH2jmbBq7dhOYuSlDHrC+pkswN7GYBJNUy6gQCOvg8Ji3mQPvACblQGvrlsZK8JR3VVGseHZzCoMq7yEXXWu1YoJRg1gnouNQy7mjZMnlPiyMUWIyj1AE2kCXoXUgwyN6kpM2CjlUAUziaruo6aiBXPNVNXMjaq4SzVsygHpQjFlqDqbTOJSP5wKUjJZkCGI0p5xY7puQRRqF9RAOZxNT6Ioy7wlrtOZwK+xQgvyLaLgv0NEK4q320d8LYJ3wi1MWhn8WxuIxUmOZEzpIetVzmSCZZmAjLCf2IBD0rDKxjjzme0o+2FcSPOLXaRJIWEVRYBFSYaucsBjmLk7hDc5afcMkCAj0HhFs+CRKXONAPTiUz0A2E8QCAUfZ7Csurz+LpOBrQDjCAtrv4IekS3KRL8NONlhHPaOGenuIETi/AgiGmfebD4oBdwLoXwuxPEVRhQFAX67C2qpIvVjCNqVIJU0hOOq2pbEzvhtLGacYqwIkrQcSRv9Q2pqVrpCR6ExRKEC3MBsaFVNmQD/ZLsz13cdR++jgYpI+d/mY+jIErjEXS5Wh4HygoactjTapmg6Rmz/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MW2GjVKuWMrgVl4hbeeG4lS/ixvrPqrPNN9ZKNVgSbpWF41aZztpTlueyMKouHKPqpTBKL8VFY7RGXZJwae2SmHRiEnnWRhhIDVihf112YXOAEzCJs5WuK1m3Jjt5gbsnu3XtuPQSbpXHuXVNqe4SblXGRmv5THQJF6qXdGFRRDGjCzSeD7EaqoS+zM0/8GwJtue2vsGVh4p3JV7iqrd2sHdX6xl1pa8+SF3xK7ozdmbNHgu7QjhvfjOisBGG8mNAwdiZNXtuKMCDd0o3LzTM21VHXHyBkPFtZPTRNVaboz3T35YUs29L3nNEqH3Y8VNTwCVXugnj8HVYGp/+NJh2gqp96BZyFXNnJNH6NQ1wfdJzWf5GZSpmJfWbY4jrs4S4Pvnw838aPGOQG9c0yI1pq3g50W7MEu3G9AW9tLAfIJ74ah6iwLV0fC1jk32iJfM7QgcXP786scXVPxoY/657pk8JTgY5/cXO48cJ7J8l84GMcx2NK/eNCxb7McunaH000Tr9D1BLAQIUAAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAAAAAAAAAAAAAAAAAAABzZmR0UEsFBgAAAAABAAEAMgAAADkHAAAAAA=="}; +container.documentEditor.open(JSON.stringify(sfdt)); + +document.getElementById('enforceProtection').addEventListener('click', function () { + //enforce protection + container.documentEditor.editor.enforceProtection('123', 'ReadOnly'); +}); + +document.getElementById('stopProtection').addEventListener('click', function () { + //stop the document protection + container.documentEditor.editor.stopProtection('123'); +}); + +{% endhighlight %} +{% highlight html tabtitle="index.html" %} + + + + + Essential JS 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +{% 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="index.ts" %} + +import { DocumentEditorContainer, Toolbar } from '@syncfusion/ej2-documenteditor'; + +DocumentEditorContainer.Inject(Toolbar); +let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true, serviceUrl: 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/' }); +container.appendTo('#container'); + +let sfdt: any = { "sfdt": "UEsDBAoAAAAIAGlfyVyMVz+kgAMAAL0ZAAAEAAAAc2ZkdM1YW2+bMBT+K5H3GlUBEgi8Vd2iPexSbXmYVOXBgB2smsvAbdpGkab91P2S+QYJzaW0TQhRpM/BHJ/P5/t8gliCNGMkJk/oJw4Z8Fh+h/oARj7wMKQF6oMCBcC7WQrMcuAtQbYAnm2YfZBFwHNcPqAxH3DMNTKNvsYoBJ5l9wHWGOIMeAOOKVIDnyjgmcA3tLiGcwT6ACUYeDwcC+TTOSkRSSQ4AZ7BESnM5knBF7jMoU8CHp8EKS3kDPq9kEh9FshQNXMzW/GkcncZFlvzw7wQyDitJZ+jTGE+V+jr35GCewEcC5YI4mkeQ8rzUsFTTgRqVaKLya8QmW37OqOZWALGyOuBVX/XLZhJ6hFGpUxYFHQJRPIpemCGqJncJ+cHgOClkBG5KRkeU1X6ezUlKrpa7U7o36qQ9frVfRXjyfcfX6effk1rU4KpuXtNFfXvz9/N74ENGweoGTVqM3FnmzKeOuGLbrkMwxwVxdsNY57YMGZ3DWMKw8xEcWTJZ5XIVd8j1QgXTzzWEOXj0VeQEj8nvBR3crOF2rMPVbFVf+EhIrsKEqONMBisV8awNoV5q0MbVzjxdxmMkkR3TIVYI1Nk/UICVKB7JdUbSmnVmjXbW5G1HC+SarwISn+tHYwLzYhhqgYhW6jur1sw0l090sYqSoPFKn+mIIyYdiDGimCQxpmu/CPzNUtRByD+Pj5M5AfI4/Uoz0/tkOnF31fV5+c0eVinEP4TGT8jGJJk3jOOlfRFKcV/8qaWFwPHNWzbHg0cxxy4Q6currHd4pTT7brTe1/IPGJCGVlfczIaujZ4Zt71TXUL6+vqf3aj1W0WqHcVwRy8UMXyJnWM26H7EWF4R1nvGuZwnsMs6k3ShFXc9kzXOK6eb8RszQ6vc4O5zw1Wu24wm7jB3O8G61xuKLlZHRXY2iewebBixsRybOuIAltNBLb2C3w6ug0FHnZU4OG2wGT94NfeCR42EXi4S+BT020o8KijAo92nOAWdR010XW08+CeVU67o3Lar5Lz6H3YbiKn/Uo5W2i/TkfldN7Wfo+uq9NEV+et7bcFgccdFXi87wFqcDE6WDNLfo4o8biJxOP9j1CnJNxQZLejIruHTvF51HabqO0ePtBdkB3lx9F89+uq7ZcytYLK2mkWJalJmrLzk9IsxCtIKl8r88WowiBWmOufDwpJPC/ksv8BUEsBAhQACgAAAAgAaV/JXIxXP6SAAwAAvRkAAAQAAAAAAAAAAAAAAAAAAAAAAHNmZHRQSwUGAAAAAAEAAQAyAAAAogMAAAAA" }; +container.documentEditor.open(JSON.stringify(sfdt)); + +document.getElementById('enforceProtection').addEventListener('click', function () { + //enforce protection + container.documentEditor.editor.enforceProtection('123', 'FormFieldsOnly'); +}); + +document.getElementById('stopProtection').addEventListener('click', function () { + //stop the document protection + container.documentEditor.editor.stopProtection('123'); +}); + +{% endhighlight %} +{% highlight html tabtitle="index.html" %} + + + + + Essential JS 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +{% 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="index.ts" %} + +import { DocumentEditorContainer, Toolbar } from '@syncfusion/ej2-documenteditor'; + +DocumentEditorContainer.Inject(Toolbar); +let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true, serviceUrl: 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/' }); +container.appendTo('#container'); + +let sfdt: any = {"sfdt":"UEsDBAoAAAAIALBkyVwLdNuZlgcAANcqAAAEAAAAc2ZkdO1aT2/cNhb/KgJ7dYMZzYzmz6127LqJnRiJm6Lb+sCRyBFjSdS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V+mRsi9/QnbNz0uyZsBuEa+63JAp7UurfAwrOzkmzV4YCvHiP6VaFhvsSHKqrHxAmfJvqfXqMtVdoz+KvJf7k15I3LBHav275aSngmiPdhXH0OWwcnyoNFq2g2r92CrmJuUuSaOeWBrgz772sdqe1ELOG+a0wxJ1lQtyZv/j5LQ1eMsjdWxrk7qJRvJlod5eJdnfxgN5Y2E8QT/w0D1FIrAxTe6BnwfEYqIxb5SWDmaBUZkLGA2/Er/nBuzX46x7X/V6j3au173Rq/h9IdTTMnhWyx2ceMQ5zYoSHdGRGi6HHZeGljGaAlzvoErnsCe3hAbhyJj6zUqQDZRMOj69dEHXzgwyzv78vdbxhdMTIOvjppyXM6Q3nS3gbjWtWxmXrPWDzNlq/m2g9/wVQSwECFAAKAAAACACwZMlcC3TbmZYHAADXKgAABAAAAAAAAAAAAAAAAAAAAAAAc2ZkdFBLBQYAAAAAAQABADIAAAC4BwAAAAA="}; +container.documentEditor.open(JSON.stringify(sfdt)); + +document.getElementById('enforceProtection').addEventListener('click', function () { + //enforce protection + container.documentEditor.editor.enforceProtection('123', 'CommentsOnly'); +}); + +document.getElementById('stopProtection').addEventListener('click', function () { + //stop the document protection + container.documentEditor.editor.stopProtection('123'); +}); + +{% endhighlight %} +{% highlight html tabtitle="index.html" %} + + + + + + Essential JS 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +{% 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="index.ts" %} + +import { DocumentEditorContainer, Toolbar } from '@syncfusion/ej2-documenteditor'; + +DocumentEditorContainer.Inject(Toolbar); +let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true, serviceUrl: 'https://document.syncfusion.com/web-services/docx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GFRRDGjCzSeD7EaqoS+zM0/8GwJtue2vsGVh4p3JV7iqrd2sHdX6xl1pa8+SF3xK7ozdmbNHgu7QjhvfjOisBGG8mNAwdiZNXtuKMCDd0o3LzTM21VHXHyBkPFtZPTRNVaboz3T35YUs29L3nNEqH3Y8VNTwCVXugnj8HVYGp/+NJh2gqp96BZyFXNnJNH6NQ1wfdJzWf5GZSpmJfWbY4jrs4S4Pvnw838aPGOQG9c0yI1pq3g50W7MEu3G9AW9tLAfIJ74ah6iwLV0fC1jk32iJfM7QgcXP786scXVPxoY/657pk8JTgY5/cXO48cJ7J8l84GMcx2NK/eNCxb7McunaH000Tr9D1BLAQIUAAoAAAAIAMBmyVzPkjTQFwcAAJcpAAAEAAAAAAAAAAAAAAAAAAAAAABzZmR0UEsFBgAAAAABAAEAMgAAADkHAAAAAA=="}; +container.documentEditor.open(JSON.stringify(sfdt)); + +document.getElementById('enforceProtection').addEventListener('click', function () { + //enforce protection + container.documentEditor.editor.enforceProtection('123', 'RevisionsOnly'); +}); + +document.getElementById('stopProtection').addEventListener('click', function () { + //stop the document protection + container.documentEditor.editor.stopProtection('123'); +}); + +{% endhighlight %} +{% highlight html tabtitle="index.html" %} + + + + + + Essential JS 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +{% 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="index.ts" %} + +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/javascript-es6/web-services/core#restrict-editing) + +- [Web Service for Restrict editing in ASP.NET MVC](https://help.syncfusion.com/document-processing/word/word-processor/javascript-es6/web-services/mvc#restrict-editing) + +- [Web Service for Restrict editing in Java](https://help.syncfusion.com/document-processing/word/word-processor/javascript-es6/web-services/java#restrict-editing) ## Set current user -You can use the [`currentUser`](https://ej2.syncfusion.com/documentation/api/document-editor#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#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. + +{% tabs %} +{% highlight ts tabtitle="index.ts" %} -The following code shows how to set currentUser +container.documentEditor.currentUser = 'engineer@mycompany.com'; -```ts -documentEditor.currentUser = 'engineer@mycompany.com'; -``` +{% endhighlight %} +{% endtabs %} ## Highlighting the text area -You can highlight the editable region of the current user using the [`userColor`](https://ej2.syncfusion.com/documentation/api/document-editor#usercolor) property. +The [`userColor`](https://ej2.syncfusion.com/documentation/api/document-editor#usercolor) property can be used to highlight the editable region of the current user. + +The following code example demonstrates how to set the userColor. -The following code shows how to set userColor. +{% tabs %} +{% highlight ts tabtitle="index.ts" %} + +container.documentEditor.userColor = '#fff000'; + +{% endhighlight %} +{% endtabs %} + +The [`highlightEditableRanges`](https://ej2.syncfusion.com/documentation/api/document-editor/documentEditorSettings/#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="index.ts" %} + +container.documentEditor.documentEditorSettings.highlightEditableRanges = true; -```ts -documentEditor.userColor = '#fff000'; -``` +{% endhighlight %} +{% endtabs %} ## Restrict Editing Pane @@ -44,9 +459,7 @@ Restrict Editing Pane provides the following options to manage the document: The following code shows Restrict Editing Pane. To unprotect the document, use password '123'. - - - {% tabs %} +{% tabs %} {% highlight ts tabtitle="index.ts" %} {% include code-snippet/document-editor/javascript-es6/data-protection-cs2/index.ts %} {% endhighlight %} @@ -57,12 +470,4 @@ The following code shows Restrict Editing Pane. To unprotect the document, use p {% previewsample "/document-processing/code-snippet/document-editor/javascript-es6/data-protection-cs2" %} -## Online Demo - -Explore how to restrict editing and protect Word documents using the JavaScript Document Editor in this live demo [here](https://document.syncfusion.com/demos/docx-editor/javascript/#/material3/document-editor/document-protection.html). - -### See Also - -* [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 +N> The hosted Web API URL is for demo and evaluation purposes only. For production, host your own web service using the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/word-processor-server) for hosting your own web service and use for the serviceUrl property. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md index 8e912d80fe..9244b61eab 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md @@ -227,11 +227,11 @@ The following example code illustrates how to write a Web API for restrict editi [HttpPost] [EnableCors("AllowAllOrigins")] [Route("RestrictEditing")] - public string[] RestrictEditing([FromBody]CustomRestrictParameter param) + public string[] RestrictEditing([FromBody] CustomRestrictParameter param) { - if (param.passwordBase64 == "" && param.passwordBase64 == null) + if (param.passwordBase64 == "" || param.passwordBase64 == null) return null; - return WordDocument.ComputeHash(param.passwordBase64, param.saltBase64, param.spinCount); + return WordDocument.ComputeHash(param.passwordBase64, param.saltBase64, param.spinCount, param.algorithmSid); } public class CustomRestrictParameter @@ -239,6 +239,7 @@ The following example code illustrates how to write a Web API for restrict editi public string passwordBase64 { get; set; } public string saltBase64 { get; set; } public int spinCount { get; set; } + public string algorithmSid { get; set;} } ``` diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md index 2b4189e963..1a8fac0358 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md @@ -336,15 +336,16 @@ The following example code illustrates how to write a Web API for restrict editi @CrossOrigin(origins = "*", allowedHeaders = "*") @PostMapping("/api/wordeditor/RestrictEditing") public String[] restrictEditing(@RequestBody CustomRestrictParameter param) throws Exception { - if (param.passwordBase64 == "" && param.passwordBase64 == null) + if (param.passwordBase64 == "" || param.passwordBase64 == null) return null; - return WordProcessorHelper.computeHash(param.passwordBase64, param.saltBase64, param.spinCount); + return WordProcessorHelper.computeHash(param.passwordBase64, param.saltBase64, param.spinCount, param.algorithmSid); } public class CustomRestrictParameter { public String passwordBase64; public String saltBase64; public int spinCount; + public String algorithmSid; public String getPasswordBase64() { return passwordBase64; } @@ -354,6 +355,9 @@ The following example code illustrates how to write a Web API for restrict editi public int getSpinCount() { return spinCount; } + public String getAlgorithmSid() { + return algorithmSid; + } public void setPasswordBase64(String value) { passwordBase64= value; } @@ -363,6 +367,9 @@ The following example code illustrates how to write a Web API for restrict editi public void setSpinCount(int value) { spinCount= value; } + public void setAlgorithmSid(String value) { + algorithmSid= value; + } } ``` diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md index 200feb05c7..ec34d6bb89 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md @@ -96,11 +96,11 @@ The following example code illustrates how to write a Web API for restrict editi [HttpPost] [EnableCors("*", "*", "*")] [Route("RestrictEditing")] - public string[] RestrictEditing([FromBody]CustomRestrictParameter param) + public string[] RestrictEditing([FromBody] CustomRestrictParameter param) { - if (param.passwordBase64 == "" && param.passwordBase64 == null) + if (param.passwordBase64 == "" || param.passwordBase64 == null) return null; - return Syncfusion.EJ2.DocumentEditor.WordDocument.ComputeHash(param.passwordBase64, param.saltBase64, param.spinCount); + return Syncfusion.EJ2.DocumentEditor.WordDocument.ComputeHash(param.passwordBase64, param.saltBase64, param.spinCount, param.algorithmSid); } public class CustomRestrictParameter @@ -108,6 +108,7 @@ The following example code illustrates how to write a Web API for restrict editi public string passwordBase64 { get; set; } public string saltBase64 { get; set; } public int spinCount { get; set; } + public string algorithmSid { get; set; } } ``` From 0711e758a7a11e717a2532a0479cda2c3a139b67 Mon Sep 17 00:00:00 2001 From: Moushmi Dhanislas Date: Mon, 29 Jun 2026 23:02:45 +0530 Subject: [PATCH 2/4] 1036262: Removed Java changes --- .../javascript-es6/web-services/java.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md index 1a8fac0358..2b4189e963 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/java.md @@ -336,16 +336,15 @@ The following example code illustrates how to write a Web API for restrict editi @CrossOrigin(origins = "*", allowedHeaders = "*") @PostMapping("/api/wordeditor/RestrictEditing") public String[] restrictEditing(@RequestBody CustomRestrictParameter param) throws Exception { - if (param.passwordBase64 == "" || param.passwordBase64 == null) + if (param.passwordBase64 == "" && param.passwordBase64 == null) return null; - return WordProcessorHelper.computeHash(param.passwordBase64, param.saltBase64, param.spinCount, param.algorithmSid); + return WordProcessorHelper.computeHash(param.passwordBase64, param.saltBase64, param.spinCount); } public class CustomRestrictParameter { public String passwordBase64; public String saltBase64; public int spinCount; - public String algorithmSid; public String getPasswordBase64() { return passwordBase64; } @@ -355,9 +354,6 @@ The following example code illustrates how to write a Web API for restrict editi public int getSpinCount() { return spinCount; } - public String getAlgorithmSid() { - return algorithmSid; - } public void setPasswordBase64(String value) { passwordBase64= value; } @@ -367,9 +363,6 @@ The following example code illustrates how to write a Web API for restrict editi public void setSpinCount(int value) { spinCount= value; } - public void setAlgorithmSid(String value) { - algorithmSid= value; - } } ``` From 46cd884c919fcaf8d17182c19e39726ae1b2a9c3 Mon Sep 17 00:00:00 2001 From: Moushmi Dhanislas Date: Mon, 29 Jun 2026 23:22:08 +0530 Subject: [PATCH 3/4] 1036262: Resolved technical error --- .../Word/Word-Processor/javascript-es6/web-services/core.md | 2 +- .../Word/Word-Processor/javascript-es6/web-services/mvc.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md index 9244b61eab..a8b41b2ceb 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/core.md @@ -56,7 +56,7 @@ The following example code illustrates how to write a Web API for importing Word The web browsers do not support to display metafile images like EMF and WMF and also TIFF format images. As a fallback approach, you can convert the metafile/TIFF format image to raster image using any image converter in the `MetafileImageParsed` event and this fallback raster image will be displayed in the client-side Document editor component. ->Note: In `MetafileImageParsedEventArgs` event argument, you can get the metafile stream using `MetafileStream` property and you can get the `IsMetafile` boolean value to determine whether the image is meta file images(WMF,EMF) or Tiff format images. In below example, we have converted the TIFF to raster image in `ConvertTiffToRasterImage()` method using `Bitmiracle https://www.nuget.org/packages/BitMiracle.LibTiff.NET`. +>Note: In `MetafileImageParsedEventArgs` event argument, you can get the metafile stream using `MetafileStream` property and you can get the `IsMetafile` boolean value to determine whether the image is meta file images(WMF,EMF) or TIFF format images. In below example, we have converted the TIFF to raster image in `ConvertTiffToRasterImage()` method using `Bitmiracle https://www.nuget.org/packages/BitMiracle.LibTiff.NET`. The following example code illustrates how to use `MetafileImageParsed` event for creating fallback raster image for metafile present in a Word document. diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md index ec34d6bb89..ebec448a59 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/web-services/mvc.md @@ -8,7 +8,7 @@ documentation: ug domainurl: ##DomainURL## --- -# Mvc in JavaScript (ES6) Document editor control +# MVC in JavaScript (ES6) Document editor control DocumentEditor depends on server side interaction for below listed operations can be written in ASP.NET MVC using [Syncfusion.EJ2.WordEditor.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.EJ2.WordEditor.AspNet.Mvc5) or [Syncfusion.EJ2.WordEditor.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.EJ2.WordEditor.AspNet.Mvc4). From ad026aaaba3baae4dad483b63360aa9ce3e97f83 Mon Sep 17 00:00:00 2001 From: Moushmi Dhanislas Date: Mon, 29 Jun 2026 23:34:03 +0530 Subject: [PATCH 4/4] 1036262: Resolved front matter error --- .../Word/Word-Processor/javascript-es6/restrict-editing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md b/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md index 2887e8d9d5..abe90f8408 100644 --- a/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md +++ b/Document-Processing/Word/Word-Processor/javascript-es6/restrict-editing.md @@ -435,7 +435,7 @@ container.documentEditor.userColor = '#fff000'; {% endhighlight %} {% endtabs %} -The [`highlightEditableRanges`](https://ej2.syncfusion.com/documentation/api/document-editor/documentEditorSettings/#highlighteditableranges) property can be used to toggle the highlighting of editable regions. +The [`highlightEditableRanges`](https://ej2.syncfusion.com/documentation/api/document-editor/documentEditorSettings#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.