{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "spreadsheet-editor-protection",
  "framework": "javascript",
  "type": "registry:component",
  "component": "Spreadsheet",
  "variant": "protection",
  "dependencies": [
    "@syncfusion/ej2-spreadsheet"
  ],
  "description": "Spreadsheet sample protecting workbooks with sheet-level and cell-level security.",
  "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": true,
    "platformIndex": "https://ai.syncfusion.com/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/spreadsheet-editor-protection.md"
  },
  "files": [
    {
      "target": "src/components/spreadsheet-editor-protection/spreadsheet-editor.html",
      "content": "<div class=\"control-section\">\n    <div id=\"container\"></div>\n</div>\n\n<style>\n    .control-section .control-wrapper {\n        height: calc(100vh - 230px);\n    }\n\n    #sb-content .e-spreadsheet .e-tab .e-tab-text {\n        display: inherit;\n    }\n\n    .ej2-new .control-section {\n        height: 550px;\n    }\n    .e-spreadsheet .e-main-panel .e-main-content{\n        margin-left: 0 !important;\n    }\n</style>\n<!-- custom code end -->"
    },
    {
      "target": "src/components/spreadsheet-editor-protection/spreadsheet-editor.ts",
      "content": "import { Spreadsheet, type CellRenderEventArgs, getFormatFromType } from '@syncfusion/ej2-spreadsheet';\nimport { protectSheet } from '../datasource/spreadsheet-editor-data';\nexport function initSpreadsheetEditorProtection(): void {\n\n    let numberFormat: string = '$#,##0.00';\n    //Initialize Spreadsheet component\n    let spreadsheet: Spreadsheet = new Spreadsheet({\n        // To protect the workbook\n        password: 'spreadsheet',\n        sheets: [{\n            isProtected: true,\n            name: 'EMI Calculator',\n            rows: [{\n                cells: [{\n                    index: 1,\n                    value: 'Home Loan Calculator',\n                    style: {\n                        textAlign: 'center',\n                        fontWeight: 'bold'\n                    }\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Loan Amount:'\n                }, {\n                    value: '100000',\n                    format: numberFormat\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Interest Rate:'\n                }, {\n                    value: '0.08',\n                    format: getFormatFromType('Percentage')\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Periods (terms in year):'\n                }, {\n                    value: '1'\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Start Date:'\n                }, {\n                    value: '03-03-2020'\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Loan EMI:'\n                }, {\n                    value: '8698.84',\n                    format: numberFormat\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Number of Payments:'\n                }, {\n                    value: '12'\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Total Repayment Amount:'\n                }, {\n                    value: '104386.11',\n                    format: numberFormat\n                }]\n            }, {\n                cells: [{\n                    index: 1,\n                    value: 'Total Interest Amount:'\n                }, {\n                    value: '4386.11',\n                    format: numberFormat\n                }]\n            }],\n            columns: [{\n                index: 1,\n                width: 190\n            }, {\n                width: 100\n            }]\n        }, {\n            isProtected: true,\n            name: 'EMI Schedule',\n            ranges: [{\n                dataSource: protectSheet,\n                showFieldAsHeader: true\n            }],\n            rows: [{\n                index: 0,\n                cells: [\n                    {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }, {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }, {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }, {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }, {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }, {\n                        style: {\n                            textAlign: 'center',\n                            fontWeight: 'bold'\n                        }\n                    }]\n            }\n            ],\n            columns: [{\n                index: 1,\n                width: 110\n            }, {\n                width: 85\n            }, {\n                width: 85\n            }, {\n                width: 80\n            }, {\n                width: 90\n            }]\n        }],\n        openUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/open',\n        saveUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/save',\n        created: () => {\n            //Applied number formatting to a range\n            spreadsheet.numberFormat(numberFormat, 'EMI Schedule!C2:F13');\n            spreadsheet.numberFormat('m/d/yyyy', 'EMI Calculator!C5:C5');\n            spreadsheet.numberFormat('m/d/yyyy', 'EMI Schedule!B2:B13');\n        },\n        beforeCellRender: (args: CellRenderEventArgs) => {\n            //Merged cells using custom code\n            if (spreadsheet.activeSheetIndex === 0 && args.address === 'B1') {\n                (args.element as HTMLTableCellElement).colSpan = 2;\n            }\n        }\n    });\n    //Render initialized Spreadsheet component\n    spreadsheet.appendTo('#container');\n}\n"
    }
  ]
}