{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "spreadsheet-editor-protection",
  "framework": "aspnet-mvc",
  "type": "registry:component",
  "component": "Spreadsheet",
  "variant": "protection",
  "dependencies": [
    "Syncfusion.AspNetMvc.Spreadsheet"
  ],
  "description": "Spreadsheet editor demonstrating protected worksheets and locked cell editing behavior.",
  "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/spreadsheet-editor-protection.md"
  },
  "files": [
    {
      "target": "src/components/spreadsheet-editor-protection/SpreadsheetEditor.cshtml",
      "content": "@using Syncfusion.EJ2\n@using Syncfusion.EJ2.Spreadsheet\n\n@section ControlsSection{\n    <div class=\"control-section\">\n        @Html.EJS().Spreadsheet(\"spreadsheet\").Password(\"spreadsheet\").OpenUrl(\"ProtectSheetOpen\").SaveUrl(\"ProtectSheetSave\").Created(\"createdHandler\").BeforeCellRender(\"beforeCellRenderHandler\").Sheets(sheet =>\n   {\n       sheet.Name(\"EMI Calculator\").IsProtected(true).Rows(row =>\n       {\n           row.Cells(cell => cell.Index(1).Value(\"Home Loan Calculator\").Style(style =>\n           {\n               style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center);\n           }).Add()).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Loan Amount:\").Add();\n               cell.Format(\"$#,##0.00\").Value(\"100000\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Interest Rate:\").Add();\n               cell.Format(\"0.00%\").Value(\"0.08\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Periods (terms in year):\").Add();\n               cell.Value(\"1\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Start Date:\").Add();\n               cell.Value(\"03-03-2020\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Loan EMI:\").Add();\n               cell.Format(\"$#,##0.00\").Value(\"8698.84\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Number of Payments:\").Add();\n               cell.Value(\"12\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Total Repayment Amount:\").Add();\n               cell.Format(\"$#,##0.00\").Value(\"104386.11\").Add();\n           }).Add();\n           row.Cells(cell =>\n                {\n               cell.Index(1).Value(\"Total Interest  Amount:\").Add();\n               cell.Format(\"$#,##0.00\").Value(\"4386.11\").Add();\n           }).Add();\n       }).Columns(column =>\n       {\n           column.Index(1).Width(190).Add();\n           column.Width(100).Add();\n       }).Add();\n       sheet.IsProtected(true).Name(\"EMI Schedule\").Ranges(ranges =>\n            {\n           ranges.DataSource(ViewData[\"ProtectSheetData\"]).ShowFieldAsHeader(true).Add();\n           }).Rows(row =>\n               {\n                   row.Cells(cell =>\n                   {\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                       cell.Style(style => { style.FontWeight(FontWeight.Bold).TextAlign(TextAlign.Center); }).Add();\n                   }).Add();\n                }).Columns(column =>\n            {\n           column.Index(1).Width(110).Add();\n           column.Width(85).Add();\n           column.Width(85).Add();\n           column.Width(80).Add();\n           column.Width(90).Add();\n       }).Add();\n   }).Render()\n    </div>\n}\n\n<script>\n    var numberFormat = ej.spreadsheet.getFormatFromType('Currency');\n    function createdHandler() {\n        //Applied number formatting to a range\n        this.numberFormat(\"$#,##0.00\", 'EMI Schedule!C2:F13');\n        this.numberFormat('m/d/yyyy', 'EMI Calculator!C5:C5');\n        this.numberFormat('m/d/yyyy', 'EMI Schedule!B2:B13');\n    }\n    function beforeCellRenderHandler(args) {\n        //Merged cells using custom code\n        if (this.activeSheetIndex === 0 && args.address === 'B1') {\n            args.element.colSpan = 2;\n        }\n    }\n</script>\n\n@*custom code start*@\n\n<style>\n    .control-section {\n        height: 550px;\n    }\n\n    #sb-content .e-spreadsheet .e-tab .e-tab-text {\n        display: inherit;\n    }\n</style>\n"
    },
    {
      "target": "src/components/spreadsheet-editor-protection/SpreadsheetEditorController.cs",
      "content": "using Syncfusion.EJ2.Spreadsheet;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\n\nnamespace EJ2MVCSampleBrowser.Controllers.Spreadsheet\n{\n    public partial class SpreadsheetController : Controller\n    {\n        // GET: ProtectSheet\n        public ActionResult ProtectSheet()\n        {\n            List<object> data = new List<object>()\n            {\n                new { Tenure= \"1\",  PaymentDate= \"03-04-2020\",  EMI= \"8698.84\",  Prinicpal= \"8032.18\",  Interest= \"666.67\",  Balance= \"91967.82\" },\n                new { Tenure= \"2\",  PaymentDate= \"03-05-2020\",  EMI= \"8698.84\",  Prinicpal= \"8085.72\",  Interest= \"616.12\",  Balance= \"83882.10\" },\n                new { Tenure= \"3\",  PaymentDate= \"03-06-2020\",  EMI= \"8698.84\",  Prinicpal= \"8139.63\",  Interest= \"559.21\",  Balance= \"75742.47\" },\n            };\n            ViewData[\"ProtectSheetData\"] = data;\n            return View(\"~/Views/Home/spreadsheet-editor/protection/SpreadsheetEditor.cshtml\");\n        }\n\n        public ActionResult ProtectSheetOpen(OpenRequest openRequest)\n        {\n            return Content(Workbook.Open(openRequest));\n        }\n\n        public void ProtectSheetSave(SaveSettings saveSettings)\n        {\n            if (saveSettings != null && saveSettings.JSONData != null)\n            {\n                Workbook.Save(saveSettings);\n            }\n        }\n    }\n}"
    }
  ]
}