{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "spreadsheet-editor-cell-formatting",
  "framework": "javascript",
  "type": "registry:component",
  "component": "Spreadsheet",
  "variant": "cell-formatting",
  "dependencies": [
    "@syncfusion/ej2-spreadsheet"
  ],
  "description": "Spreadsheet editor with cell formatting feature by applying different styles to a range of cells.",
  "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/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/spreadsheet-editor-cell-formatting.md"
  },
  "files": [
    {
      "target": "src/components/spreadsheet-editor-cell-formatting/spreadsheet-editor.html",
      "content": "<div class=\"control-section\">\n    <div id=\"spreadsheet\"></div>\n</div>\n<!-- custom code start -->\n<style>\n    .control-section .control-wrapper {\n        height: calc(100vh - 230px);\n        min-height: 550px\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-cell-formatting/spreadsheet-editor.ts",
      "content": "import { Spreadsheet, type SheetModel, type ColumnModel, type RowModel, type CellRenderEventArgs, getFormatFromType } from '@syncfusion/ej2-spreadsheet';\nimport { orderDetails } from '../datasource/spreadsheet-editor-data';\n\n/**\n * Cell Formatting sample\n */\nexport function initSpreadsheetEditorCellFormatting(): void {\n    let columns: ColumnModel[] = [{ width: 70 }, { width: 126 }, { width: 172 }, { width: 90 }, { width: 238 }, { width: 82 },\n    { width: 80 }, { width: 249 }];\n\n    let rows: RowModel[] = [\n        {\n            height: 36,\n            //Applying cell formatting through cell binding\n            cells: [{ style: { textAlign: 'right' } }, { style: { textIndent: '2pt' } }, { style: { textAlign: 'center' }}, { style: { textAlign: 'right' } },\n                { style: { textIndent: '2pt' } }, { index: 6, style: { textAlign: 'center' } }, { index: 7, style: { textAlign: 'center' } },\n                { index: 8, style: { textAlign: 'right' } }]\n        }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 },\n        { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 }, { height: 42 },\n        { height: 42 }, { height: 42 }];\n\n    let sheet: SheetModel[] = [{\n        name: 'Order Details',\n        ranges: [{ dataSource: orderDetails }],\n        columns: columns,\n        rows: rows,\n        showGridLines: false\n    }];\n\n    //Initialize Spreadsheet component\n    let spreadsheet: Spreadsheet = new Spreadsheet({\n        sheets: sheet,\n        showFormulaBar: false,\n        showRibbon: false,\n        created: createdHandler,\n        beforeCellRender: beforeCellRender\n    });\n\n    spreadsheet.appendTo('#spreadsheet');\n\n    function createdHandler(): void {\n        // Temporarily suspends UI rendering to batch model updates for better performance.\n        spreadsheet.suspendRefresh();\n        /* custom code start: for another cultures*/\n        if (spreadsheet.locale !== 'en-US') {\n            setTimeout(() => {\n                performActions();\n                spreadsheet.resumeRefresh();\n            });\n            return;\n        }\n        /* custom code end */\n        // Applies styles, number formatting, borders, and superscript/subscript formatting.\n        performActions();\n        // Resumes rendering and applies all queued UI updates at once.\n        spreadsheet.resumeRefresh();\n    }\n\n    function performActions(): void {\n        spreadsheet.cellFormat({ fontWeight: 'bold', backgroundColor: '#4b5366', color: '#ffffff', fontSize: '12pt' }, 'A1:I1');\n        spreadsheet.cellFormat({ fontWeight: 'bold', textIndent: '2pt' }, 'B2:B16');\n        spreadsheet.cellFormat({ fontStyle: 'italic', textIndent: '2pt' }, 'E2:E16');\n        spreadsheet.cellFormat({ textAlign: 'center', fontWeight: 'bold' }, 'G2:G16');\n        spreadsheet.cellFormat({ textAlign: 'center' }, 'H2:H16');\n        spreadsheet.cellFormat({ fontFamily: 'Helvetica New', verticalAlign: 'middle' }, 'A1:I16');\n        //Applying border to a range\n        spreadsheet.setBorder({ border: '1px solid #e0e0e0' }, 'A1:I16', 'Outer');\n        spreadsheet.setBorder({ border: '1px solid #e0e0e0' }, 'A2:I15', 'Horizontal');\n        // Applying a short date format to a range.\n        spreadsheet.numberFormat('m/d/yyyy', 'D2:D16');\n        // Applying currency format to a range.\n        spreadsheet.numberFormat('$#,##0.00', 'I2:I16');\n        // Applying subscript and superscript format.\n        spreadsheet.updateCell({ richText: [\n                { text: 'Mineral Water H' },\n                { text: '2', style: { verticalAlign: 'sub' } },\n                { text: 'O' }\n            ] }, 'C2');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Energy Supplement C' },\n                { text: '6', style: { verticalAlign: 'sub' } },\n                { text: 'H' },\n                { text: '12', style: { verticalAlign: 'sub' } },\n                { text: 'O' },\n                { text: '6', style: { verticalAlign: 'sub' } }\n            ] }, 'C4');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Refrigerant Gas CO' },\n                { text: '2', style: { verticalAlign: 'sub' } }\n            ] }, 'C6');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Water Purifier H' },\n                { text: '2', style: { verticalAlign: 'sub' } },\n                { text: 'O System' }\n            ] }, 'C10');\n        spreadsheet.updateCell({ richText: [\n                { text: 'n' },\n                { text: 'o', style: { verticalAlign: 'super' } },\n                { text: ' 59 rue de l Abbaye' },\n                { text: ', Reims 51100' }\n            ] }, 'E2');\n        spreadsheet.updateCell({ richText: [\n                { text: '2' },\n                { text: 'e', style: { verticalAlign: 'super' } },\n                { text: ' rue du Commerce' },\n                { text: ', Lyon 69004'}\n            ] }, 'E5');\n        spreadsheet.updateCell({ richText: [\n                { text: '6' },\n                { text: 'th', style: { verticalAlign: 'super' } },\n                { text: ' street, Kirchgasse' },\n                { text: ', Graz 8010'}\n            ] }, 'E7');\n        spreadsheet.updateCell({ richText: [\n                { text: '22' },\n                { text: 'nd', style: { verticalAlign: 'super' } },\n                { text: ' Carrera con Ave. Carlos Soublette' },\n                { text: ', San Cristóbal 5022'}\n            ] }, 'E11');\n        spreadsheet.updateCell({ richText: [\n                { text: '101 4' },\n                { text: 'th', style: { verticalAlign: 'super' } },\n                { text: ' Street, San Francisco' },\n                { text: ', Albuquerque 87110'}\n            ] }, 'E16');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Quality Checked', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Signed by Customer', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H2');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Packed Securely', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Customer Confirmed', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H3');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Tracking Active', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Express Delivery', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H4');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Delivery Verified', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Received On Time', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H5');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Shipment Processed', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Route Confirmed', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H6');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Return Requested', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Refund Approved', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H7');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Awaiting Dispatch', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Inventory Reserved', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H8');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Quality Checked', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Signature Required', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H9');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Tracking Active', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Scheduled Delivery', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H10');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Package Delivered', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Customer Verified', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H11');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Refund Initiated', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Case Closed', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H12');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Awaiting Processing', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Stock Allocation', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H13');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Inspection Passed', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Customer Approved', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H14');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Order Packed', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Carrier Assigned', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H15');\n        spreadsheet.updateCell({ richText: [\n                { text: 'Delivered Successfully', style: { fontWeight: 'bold', color: '#1F4E79' } },\n                { text: ' | ', style: { color: '#808080' } },\n                { text: 'Signature Captured', style: { fontStyle: 'italic', color: '#2E8B57' } }\n            ] }, 'H16');\n    }\n\n    function beforeCellRender(args: CellRenderEventArgs): void {\n        if (!spreadsheet.isOpen && spreadsheet.activeSheetIndex === 0) {\n            if (args.cell && args.cell.value) {\n                //Applying cell formatting before rendering the particular cell\n                switch (args.cell.value) {\n                    case 'Delivered':\n                        spreadsheet.cellFormat({ color: '#205107', textDecoration: 'line-through' }, args.address);\n                        break;\n                    case 'Shipped':\n                        spreadsheet.cellFormat({ color: '#01579B' }, args.address);\n                        break;\n                    case 'Pending':\n                        spreadsheet.cellFormat({ color: '#914C00', textDecoration: 'underline' }, args.address);\n                        break;\n                    case 'Cancelled':\n                        spreadsheet.cellFormat({ color: '#B3261E' }, args.address);\n                        break;\n                }\n            }\n        }\n    }\n}\n"
    }
  ]
}