{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "spreadsheet-editor-cell-formatting",
  "framework": "react",
  "type": "registry:component",
  "component": "SpreadsheetEditor",
  "variant": "cell-formatting",
  "dependencies": [
    "@syncfusion/ej2-react-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/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/ts/spreadsheet-editor-cell-formatting.md"
  },
  "files": [
    {
      "target": "src/components/spreadsheet-editor-cell-formatting/SpreadSheetEditor.tsx",
      "content": "import React from 'react';\nimport { SpreadsheetComponent, type SheetModel, type RowModel, type CellRenderEventArgs } from '@syncfusion/ej2-react-spreadsheet';\nimport { orderDetails } from '../datasource/spreadsheet-editor.data';\nimport '../spreadsheet-editor.css';\n\n/**\n * Cell Formatting sample\n */\n\nfunction CellFormatting(): React.ReactElement {\n    let spreadsheet: SpreadsheetComponent;\n\n    // Define rows with initial cell formatting\n    const rows: RowModel[] = [\n        {\n            height: 36,\n            // Applying cell formatting through cell binding\n            cells: [\n                { style: { textAlign: 'right' } },\n                { style: { textIndent: '2pt' } },\n                { style: { textAlign: 'center' } },\n                { style: { textAlign: 'right' } },\n                { style: { textIndent: '2pt' } },\n                { index: 6, style: { textAlign: 'center' } },\n                { index: 7, style: { textAlign: 'center' } },\n                { index: 8, style: { textAlign: 'right' } }\n            ]\n        },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 },\n        { height: 42 }\n    ];\n\n    const sheetSettings: SheetModel[] = [\n        {\n            name: 'Order Details',\n            ranges: [{ dataSource: orderDetails }],\n            columns: [\n                { width: 70 },\n                { width: 126 },\n                { width: 172 },\n                { width: 90 },\n                { width: 238 },\n                { width: 82 },\n                { width: 80 },\n                { width: 249 }\n            ],\n            rows: rows,\n            showGridLines: false\n        }\n    ];\n\n    function createdHandler(): void {\n        // Temporarily suspends UI rendering to batch model updates for better performance.\n        spreadsheet.suspendRefresh();\n\n        // Applying cell formatting dynamically using cellFormat method.\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\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\n        // Applying a short date format to a range.\n        spreadsheet.numberFormat('m/d/yyyy', 'D2:D16');\n\n        // Applying currency format to a range.\n        spreadsheet.numberFormat('$#,##0.00', 'I2:I16');\n\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\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\n        spreadsheet.updateCell({ richText: [\n            { text: 'Refrigerant Gas CO' },\n            { text: '2', style: { verticalAlign: 'sub' } }\n        ] }, 'C6');\n\n        spreadsheet.updateCell({ richText: [\n            { text: 'Water Purifier H' },\n            { text: '2', style: { verticalAlign: 'sub' } },\n            { text: 'O System' }\n        ] }, 'C10');\n\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\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\n        spreadsheet.updateCell({ richText: [\n            { text: '6' },\n            { text: 'th', style: { verticalAlign: 'super' } },\n            { text: ' street, Kirchgasse' },\n            { text: ', Graz 8010' }\n        ] }, 'E7');\n\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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\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        // Resumes rendering and applies all queued UI updates at once.\n        spreadsheet.resumeRefresh();\n    }\n\n    function beforeCellRender(args: CellRenderEventArgs): void {\n        if (spreadsheet.sheets[spreadsheet.activeSheetIndex].name === 'Order Details' && !spreadsheet.isOpen) {\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    return (\n        <div className='control-pane'>\n            <div className='control-section spreadsheet-control'>\n                <SpreadsheetComponent showRibbon={false} showFormulaBar={false} sheets={sheetSettings}\n                    ref={(ssObj: SpreadsheetComponent | null) => { if (ssObj) spreadsheet = ssObj }} created={createdHandler}\n                    beforeCellRender={beforeCellRender}>\n                </SpreadsheetComponent>\n            </div>\n        </div>\n    );\n}\n\nexport default CellFormatting;\n"
    }
  ]
}