# spreadsheet-editor-default

> Spreadsheet editor with formulas, number formats, column widths, and styled header and footer rows.

**Framework:** aspnet-mvc  **Component:** Spreadsheet  **Variant:** default

## 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/aspnet-mvc/spreadsheet-editor-default.json
```

**Install Package(s)**

```bash
Install-Package Syncfusion.AspNetMvc.Spreadsheet
```

**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-default/SpreadsheetEditor.cshtml

```cshtml
@using Syncfusion.EJ2
@using Syncfusion.EJ2.Spreadsheet

@section ControlsSection{
    <div class="control-section">
        @Html.EJS().Spreadsheet("spreadsheet").OpenUrl("Open").SaveUrl("Save").Created("createdHandler").Sheets(sheet =>
   {
       sheet.Name("Car Sales Report").Ranges(ranges =>
       {
           ranges.DataSource((IEnumerable<object>)ViewData["DefaultData"]).Add();
       }).Rows(row => {
           row.Cells(cell =>
           {
               cell.Value("Customer Name").Add();
               cell.Index(3).Value("Payment Mode").Add();
               cell.Value("Delivery Date").Add();
           }).Add();
           row.Index(30).Cells(cell =>
           {
               cell.Index(4).Value("Total Amount:").Style(new SpreadsheetCellStyle() { FontWeight = FontWeight.Bold, TextAlign = TextAlign.Right }).Add();
               cell.Formula("=SUM(F2:F30)").Style(new SpreadsheetCellStyle() { FontWeight = FontWeight.Bold }).Add();
           }).Add();
       }).Columns(column =>
       {
           column.Width(180).Add();
           column.Width(130).Add();
           column.Width(130).Add();
           column.Width(180).Add();
           column.Width(130).Add();
           column.Width(120).Add();
       }).Add();
   }).Render()
    </div>
}

     

<script>
    // Triggers once the control is loaded
    function createdHandler() {
        // Applies cell and number formatting to specified range of the active sheet
        this.cellFormat({ fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }, 'A1:F1');
        // Apply format to the specified range in the active sheet.
        this.numberFormat('$#,##0.00', 'F2:F31');
        this.numberFormat('m/d/yyyy', 'E2:E30');
    }
</script>

@*custom code start*@
<style>
    .control-section {
        height: 550px;
    }
    #sb-content .e-spreadsheet .e-tab .e-tab-text {
        display: inherit;
    }
</style>
```

### src/components/spreadsheet-editor-default/SpreadsheetEditorController.cs

```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.Spreadsheet;

namespace EJ2MVCSampleBrowser.Controllers.Spreadsheet
{
    public partial class SpreadsheetController : Controller
    {
        public ActionResult DefaultFunctionalities()
        {
           List<object> data = new List<object>()
            {
                new { CustomerName= "Romona Heaslip",  Model= "Taurus",  Color= "Aquamarine",  PaymentMode= "Debit Card",  DeliveryDate= "07-11-2015",  Amount= "8529.22" },
                new { CustomerName= "Clare Batterton",  Model= "Sparrow",  Color= "Pink",  PaymentMode= "Cash On Delivery",  DeliveryDate= "07-13-2016",  Amount= "17866.19" },
                new { CustomerName= "Eamon Traise",  Model= "Grand Cherokee",  Color= "Blue",  PaymentMode= "Net Banking",  DeliveryDate= "09-04-2015",  Amount= "13853.09" },
               
            };
            ViewData["DefaultData"] = data;
            return View("~/Views/Home/spreadsheet-editor/default/SpreadsheetEditor.cshtml");
        }

        public ActionResult Open(OpenRequest openRequest)
        {
            return Content(Workbook.Open(openRequest));
        }

        public void Save(SaveSettings saveSettings)
        {
            if (saveSettings != null && saveSettings.JSONData != null)
            {
                Workbook.Save(saveSettings);
            }
        }
    }
}
```
