# spreadsheet-editor-cell-template

> Spreadsheet editor with cell template feature using interview registration form scenario with input components.

**Framework:** javascript  **Component:** Spreadsheet  **Variant:** cell-template

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/javascript/spreadsheet-editor-cell-template.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-spreadsheet @syncfusion/ej2-inputs @syncfusion/ej2-buttons @syncfusion/ej2-calendars @syncfusion/ej2-dropdowns
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-editor-cell-template/spreadsheet-editor.html

```html
<div class="control-section">
    <div id="spreadsheet"></div>
</div>
<!-- custom code start -->
<style>
    .control-section .control-wrapper {
        height: calc(100vh - 230px);
        min-height: 550px
    }

    #sb-content .e-spreadsheet .e-tab .e-tab-text {
        display: inherit;
    }

    .ej2-new .control-section {
        height: 550px;
    }
    .e-spreadsheet .e-main-panel .e-main-content{
        margin-left: 0 !important;
    }

    .e-spreadsheet .e-cell .e-radio-wrapper {
        margin: 5px;
    }
    
    .e-spreadsheet .e-cell .e-radio-wrapper:first-child {
        margin-left: 0;
    }

    .e-spreadsheet .e-cell .e-radio + label .e-label {
        color: rgba(0, 0, 0, 0.87);
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-input-group.e-control-wrapper {
        background-color: rgb(56, 56, 56);
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-radio+label .e-label {
        color: #000;
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-radio + label::before {
        background-color: #fff;
        border-color: #757575;
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-radio:checked + label::before {
        border-color: #00b0ff;
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-radio-wrapper {
        padding-right: 10px;
    }

    .material-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-btn.e-flat {
        color: #000;
    }

    .fluent2-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-btn.e-flat {
        background-color: #292929;
    }

    .bootstrap5\.3-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-btn.e-flat {
        background-color: #212529;
        color: #dee2e6;
    }

    .tailwind3-dark .e-custom-spreadsheet.e-spreadsheet .e-sheet .e-sheet-content .e-cell-template .e-btn.e-flat {
        background-color: #111827;
    }

    .e-spreadsheet .e-row-header .e-table .e-header-cell {
        vertical-align: middle;
    }
   
</style>
<!-- custom code end -->

```

### src/components/spreadsheet-editor-cell-template/spreadsheet-editor.ts

```typescript
import { TextBox } from '@syncfusion/ej2-inputs';
import { RadioButton } from '@syncfusion/ej2-buttons';
import { DatePicker } from '@syncfusion/ej2-calendars';
import { DropDownList, MultiSelect } from '@syncfusion/ej2-dropdowns';
import { Spreadsheet, type CellRenderEventArgs, type BeforeSelectEventArgs } from '@syncfusion/ej2-spreadsheet';

/**
 * Cell template
 */
export function initSpreadsheetEditorCellTemplate(): void {

    //Initialize Spreadsheet component
    let spreadsheet: Spreadsheet = new Spreadsheet({
        showRibbon: false,
        enableContextMenu: false,
        showFormulaBar: false,
        cssClass: 'e-custom-spreadsheet',
        allowOpen: false,
        allowSave: false,
        allowPrint: false,
        allowEditing: false,
        selectionSettings: {
        mode: 'None'
        },
        scrollSettings: {
            isFinite: true
        },
        sheets: [{
            rowCount: 40,
            showGridLines: false,
            name: 'Registration Form',
            rows: [{
                height: 55,
                cells: [{
                    index: 1,
                    value: 'Interview Registration Form',
                    style: {
                        fontSize: '12pt',
                        fontWeight: 'bold',
                        textAlign: 'center',
                        verticalAlign: 'middle',
                        textDecoration: 'underline'
                    }
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Name'
                }],
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Date of Birth:'
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Gender:'
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Year of Experience:'
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Areas of Interest:'
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Mobile Number:'
                }]
            }, {
                height: 45,
                cells: [{
                    index: 1,
                    value: 'Email:'
                }]
            }, {
                height: 82,
                cells: [{
                    index: 1,
                    value: 'Address:'
                }]
            }],
            columns: [{
                index: 1,
                width: 190
            }, {
                width: 350
            }],
            ranges: [{
                template: '<input />',
                address: 'C2:C3'
            }, {
                template: '<div style="padding-left: 2px"><input type="radio" name="gender" value="male" /><input type="radio" name="gender" value="female"/></div>',
                address: 'C4'
            }, {
                template: '<input />',
                address: 'C5:C8'
            }, {
                template: '<textarea rows="3"/>',
                address: 'C9'
            }, {
                template: '<button class="e-btn e-flat" style="float:right">Add</button>',
                address: 'C11'
            }]
        }],
        beforeCellRender: (args: CellRenderEventArgs) => {
            //Initializing input components before cell rendering
            if (spreadsheet.activeSheetIndex === 0) {
                let target: HTMLInputElement = args.element.firstElementChild as HTMLInputElement;
                switch (args.address) {
                    case 'B1':
                        (args.element as HTMLTableCellElement).colSpan = 2;
                        break;
                    case 'C2':
                        new TextBox({ placeholder: 'Name' }, target);
                        break;
                    case 'C3':
                        new DatePicker({ placeholder: 'DOB',  }, target);
                        break;
                    case 'C4':
                        new RadioButton({ label: 'Male' }, args.element.firstElementChild.firstElementChild as HTMLInputElement);
                        new RadioButton({ label: 'Female' }, args.element.firstElementChild.lastElementChild as HTMLInputElement);
                        break;
                    case 'C5':
                        let experience: string[] =  ['0 - 1 year', '1 - 3 years', '3 - 5 years', '5 - 10 years'];
                        new DropDownList(
                            { placeholder: 'Experience', dataSource: experience},  target );
                        break;
                    case 'C6':
                        let languages: string[] = ['JAVA', 'C#', 'SQL'];
                        new MultiSelect(
                            { showClearButton: false, placeholder: 'Areas of Interest', dataSource: languages }, target);
                        break;
                    case 'C7':
                        new TextBox({ placeholder: 'Mobile Number' }, target);
                        break;
                    case 'C8':
                        new TextBox({ placeholder: 'Email'}, target);
                        break;
                    case 'C9':
                        new TextBox({ placeholder: 'Address' }, target);
                        break;
                }
            }
        },
        created: () => {
            //Applies format to specified range
            spreadsheet.cellFormat({ fontWeight: 'bold' }, 'B2:B9');
            spreadsheet.cellFormat({ verticalAlign: 'middle' }, 'B2:C9');
        },
        contextMenuBeforeOpen: (): void => {
            spreadsheet.enableContextMenuItems(['Duplicate'], false, false);
        }
    });
    //Render initialized Spreadsheet component
    spreadsheet.appendTo('#spreadsheet');
}

```
