{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-document-protection",
  "framework": "aspnet-mvc",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "document-protection",
  "dependencies": [
    "Syncfusion.AspNetMvc.DocumentEditor",
    "Syncfusion.AspNetMvc.Buttons",
    "Syncfusion.AspNetMvc.DropDowns",
    "Syncfusion.AspNetMvc.Inputs"
  ],
  "description": "Document editor demonstrating document protection settings and restricted editing modes.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/aspnet-mvc/llms.txt",
    "skillPack": "syncfusion/aspnetmvc-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/aspnet-mvc/docx-editor-document-protection.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-document-protection/DocxEditor.cshtml",
      "content": "@using Syncfusion.EJ2\n@section ControlsSection{\n    <div class=\"col-lg-9 control-section\">\n        <div class=\"flex-container\">\n            <label class=\"switchLabel\" for=\"checked\">Ribbon UI</label>\n            <div class=\"e-message render-mode-info\">\n                <span class=\"e-msg-icon render-mode-info-icon\" title=\"Turn OFF to switch from Ribbon to toolbar UI\"></span>\n            </div>\n            @Html.EJS().Switch(\"toolbarSwitch\").CssClass(\"buttonSwitch\").Change(\"onSwitchChange\").Checked(true).Render()\n        </div>\n        <div id='documenteditor_titlebar' class=\"e-de-ctn-title\"></div>\n        @Html.EJS().DocumentEditorContainer(\"container\").Height(\"590px\").EnableToolbar(true).Render()\n    </div>\n    <div class=\"col-lg-3 property-section\">\n        <div class=\"content-wrapper\">\n            <div class=\"heading-section\">\n                <h5><b>User Permission</b></h5>\n            </div>\n\n            <div class=\"control-label\">\n                <b>Current User</b>\n            </div>\n            <div class=\"control-label\">\n                @{\n                    List<string> exportItems = new List<string>();\n                    exportItems.Add(\"engineer@mycompany.com\");\n                    exportItems.Add(\"manager@mycompany.com\");\n                }\n                @Html.EJS().DropDownList(\"ddlelement\").Placeholder(\"Select User\").Index(0).DataSource(exportItems).Render()\n            </div>\n            <div class=\"control-label\">\n                <b>User Color</b>\n            </div>\n            @Html.EJS().ColorPicker(\"color-picker\").Render()\n        </div>\n    </div>\n    <script src=\"~/Scripts/documenteditor/default-properties.js\"></script>\n}\n@section Scripts{\n    <script>\n    var documenteditor;\n    ej.documenteditor.DocumentEditorContainer.Inject(ej.documenteditor.Toolbar, ej.documenteditor.Ribbon);\n\ndocument.addEventListener('DOMContentLoaded', function () {\n        var documenteditorElement = document.getElementById(\"container\");\n        documenteditorElement.style.height = \"590px\";\n        documenteditorElement.style.width = \"100%\";\n                var container = documenteditorElement.ej2_instances[0];\n            container.toolbarMode = \"Ribbon\";\n        documenteditor = container.documentEditor;\n        documenteditorElement.ej2_instances[0].showPropertiesPane = false;\n        container.documentEditorSettings.showRuler = true;\n        documenteditor.currentUser = \"engineer@mycompany.com\";\n        documenteditorElement.ej2_instances[0].serviceUrl = window.baseurl + 'api/documenteditorservice/';\n        documenteditor.serviceUrl = window.baseurl + 'api/documenteditorservice/';\n        var ajax = new ej.base.Ajax(\"@Url.Content(\"~/scripts/documenteditor/data-document-protection.json\")\", 'GET', true);\n        ajax.send().then();\n        ajax.onSuccess = function (data) {\n            documenteditor.open(data);\n            documenteditor.documentName = 'Document Protection';\n            updateDocumentTitle();\n        };\n        container.documentChange = function (args) {\n            updateDocumentTitle();\n        };\n        titleBarDiv = document.getElementById('documenteditor_titlebar');\n        initComponentAndWireEvent();\n        showButtons(false);\n        var exportItem = {\n            text: 'Export',\n            id: 'custom_item',\n            iconCss: 'e-icons e-export',\n            items: [\n                { id: 'sfdt', text: 'Syncfusion Document Text (*.sfdt)' },\n                { id: 'docx', text: 'Word Document (*.docx)' },\n                { id: 'dotx', text: 'Word Template (*.dotx)' },\n                { id: 'text', text: 'Plain Text (*.txt)' },\n                { id: 'pdf', text: 'PDF (*.pdf)' },\n                { id: 'html', text: 'HyperText Markup Language (*.html)' },\n                { id: 'rtf', text: 'Rich Text Format (*.rtf)' },\n                { id: 'md', text: 'Markdown (*.md)' },\n                { id: 'odt', text: 'OpenDocument Text (*.odt)' },\n                { id: 'wordml', text: 'Word XML Document (*.xml)' },\n            ],\n        };\n        container.fileMenuItems = ['New', 'Open', exportItem, 'Print'];\n        container.fileMenuItemClick = function (args) {\n            if (args.item.id) {\n                var value = args.item.id;\n                var sampleName = container.documentEditor.documentName === '' ? 'sample' : container.documentEditor.documentName;\n                switch (value) {\n                    case 'docx':\n                        container.documentEditor.save(sampleName, 'Docx');\n                        break;\n                    case 'sfdt':\n                        container.documentEditor.save(sampleName, 'Sfdt');\n                        break;\n                    case 'text':\n                        container.documentEditor.save(sampleName, 'Txt');\n                        break;\n                    case 'dotx':\n                        container.documentEditor.save(sampleName, 'Dotx');\n                        break;\n                    case 'pdf':\n                        saveFormat('Pdf');\n                        break;\n                    case 'html':\n                        saveFormat('Html');\n                        break;\n                    case 'odt':\n                        saveFormat('Odt');\n                        break;\n                    case 'md':\n                        saveFormat('Md');\n                        break;\n                    case 'rtf':\n                        saveFormat('Rtf');\n                        break;\n                    case 'wordml':\n                        saveFormat('Xml');\n                        break;\n                }\n            }\n        };\n        container.dataBind();\n\n\n        var userMenu = document.getElementById(\"ddlelement\").ej2_instances[0];\n        userMenu.change = function(e) {\n            if (documenteditor) {\n                documenteditor.currentUser = e.value;\n            }\n        }\n        var colorPicker = document.getElementById(\"color-picker\").ej2_instances[0];\n        colorPicker.value = documenteditor.userColor;\n        colorPicker.change = function(e) {\n            if (documenteditor) {\n                documenteditor.userColor = e.currentValue.hex;\n            }\n        }\n    });\n\n    function saveFormat(type) {\n        var spinTarget = document.getElementById('container');\n        ej.popups.createSpinner({\n            target: spinTarget\n        });\n        ej.popups.showSpinner(spinTarget);\n        var container = document.getElementById(\"container\").ej2_instances[0];\n        var format = type;\n        var url = window.baseurl + 'api/documenteditorservice/Export';\n        var http = new XMLHttpRequest();\n        http.open('POST', url);\n        http.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n        var sfdt = {\n            Content: container.documentEditor.serialize(),\n            Filename: container.documentEditor.documentName,\n            Format: '.' + format\n        };\n        http.onload = function () {\n            if (http.status === 200) {\n                var responseData = http.response;\n                var downloadLink = document.createElement('a');\n                downloadLink.href = responseData;\n                downloadLink.download = container.documentEditor.documentName + '.' + (format).toLowerCase();\n                document.body.appendChild(downloadLink);\n                ej.popups.hideSpinner(spinTarget);\n                downloadLink.click();\n                document.body.removeChild(downloadLink);\n            }\n            else {\n                console.error('Request failed with status:', http.status);\n                ej.popups.hideSpinner(spinTarget);\n            }\n        };\n        http.send(JSON.stringify(sfdt));\n    }\n    </script>\n}\n<style>\n    #container {\n        display: block;\n        height: 500px;\n    }\n\n    .flex-container {\n        display: flex;\n        justify-content: flex-end;\n        align-items: center;\n    }\n\n    .render-mode-info {\n        background: none;\n        border: none;\n        padding-left: 0px;\n    }\n\n        .render-mode-info .render-mode-info-icon {\n            height: 16px;\n            width: 16px;\n        }\n\n    .switchLabel {\n        font-family: \"Segoe UI\", \"GeezaPro\", \"DejaVu Serif\", sans-serif;\n        font-weight: 400;\n        line-height: 20px;\n        letter-spacing: 0.24px;\n        text-align: right;\n        font-size: 14px;\n        margin-bottom: 0px;\n    }\n\n    .render-mode-info .render-mode-info-icon::before {\n        line-height: normal;\n    }\n\n    .buttonSwitch {\n        Width: 40px;\n        Height: 24px;\n    }\n\n    #documenteditor_titlebar {\n        border-bottom: 1px solid #2B3481;\n        height: 36px;\n        line-height: 26px;\n        width: 100%;\n        font-size: 12px;\n        padding-left: 15px;\n        padding-right: 10px;\n        font-family: inherit;\n    }\n\n    #documenteditor_title_contentEditor {\n        height: 26px;\n        max-width: 85%;\n        width: auto;\n        overflow: hidden;\n        display: inline-block;\n        padding-left: 4px;\n        padding-right: 4px;\n        margin: 5px;\n    }\n\n\n    .single-line {\n        cursor: text !important;\n        outline: none;\n    }\n\n        .single-line:hover {\n            border-color: #e4e4e4 !important;\n        }\n\n    [contenteditable=\"true\"].single-line {\n        white-space: nowrap;\n        border-color: #e4e4e4 !important;\n    }\n\n    @@font-face {\n        font-family: 'Sample brower icons';\n        font-weight: normal;\n        font-style: normal;\n    }\n\n    [class^=\"e-de-icon-\"],\n    [class*=\" e-de-icon-\"] {\n        font-family: 'Sample brower icons' !important;\n    }\n\n    .e-de-icon-Print:before {\n        content: \"\\e723\";\n    }\n\n    .e-de-icon-Download:before {\n        content: \"\\e728\";\n    }\n\n    .property-panel-table div {\n        padding-left: 0px;\n    }\n\n    .heading-section {\n        padding-bottom: 20px;\n        padding-top: 20px;\n    }\n\n    .control-label {\n        padding-bottom: 15px;\n    }\n\n    /** sample level font icons ends*/\n</style>\n"
    },
    {
      "target": "src/components/docx-editor-document-protection/DocxEditorController.cs",
      "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\n\nnamespace EJ2MVCSampleBrowser.Controllers.DocumentEditor\n{\n    public partial class DocumentEditorController : Controller\n    {\n        // GET: DocumentProtection\n        public ActionResult DocumentProtection()\n        {\n            this.DocumentEditorViewResultHelper();\n            return View(\"~/Views/Home/docx-editor/document-protection/DocxEditor.cshtml\");\n        }\n    }\n}"
    }
  ]
}