Spreadsheet

  • 4 min to read

The Spreadsheet is an Excel-inspired extension that allows you to introduce spreadsheet functionality to any ASP.NET MVC application with ease. It provides a rich UI and comprehensive API to create, manage and convert spreadsheet files.

To learn more about the Spreadsheet and see it in action, refer to the Spreadsheet for ASP.NET MVC demos.

Implementation Details

The Spreadsheet extension is implemented by the SpreadsheetExtension class. To access its instance, use the Spreadsheet(SpreadsheetSettings) helper method, which is used to add a Spreadsheet extension to a view. This method's parameter provides access to the Spreadsheet settings implemented by the SpreadsheetSettings class.

The Spreadsheet's client counterpart is represented by the MVCxClientSpreadsheet object.

Declaration

The code sample below demonstrates how to add a Spreadsheet to a project and open a spreadsheet document within it.

View code - "Index":

@using(Html.BeginForm()) {
    @Html.Partial("SpreadsheetPartial")
}
Note

To enable the file downloading and uploading functionality, the Partial View with the extension must be wrapped with the HTML form. Since this functionality is implemented through the UploadControl extension, it's also necessary to fulfill all the recommendations from the corresponding KB article.

Partial View code - "SpreadsheetPartial":

@Html.DevExpress().Spreadsheet(settings => {
    settings.Name = "Spreadsheet";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "SpreadsheetPartial" };
    }).Open(Server.MapPath("~/App_Data/Documents/MonthlyBudget.xlsx")).GetHtml()

Controller ("Home"):

    public class HomeController : Controller{

        public ActionResult Index(){
            return View();
        }   

        public ActionResult SpreadsheetPartial(){
            return PartialView("SpreadsheetPartial");
        }
    }
Note

The Partial View should contain only the extension's code.

The image below illustrates the result.

Spreadsheet-overview.png

Main Features

This document lists the main features of the DevExpress ASP.NET MVC Spreadsheet.

  • Ribbon UI

    A Ribbon UI is automatically added to your spreadsheet application with Spreadsheet. You can also add an external Ribbon extension to use it as the Spreadsheet toolbar.

    See demo...

  • Supported File Formats

    Load, convert and save workbooks to popular file formats such as XLS, XLSX, CSV, TXT, and others.

    See demo... | Learn more...

  • Worksheets

    Create, rename, move, hide/unhide and delete worksheets in a workbook.

    Learn more...

  • Rows and Columns

    Insert, copy, hide and delete rows and columns, and adjust row height and column width.

    Learn more...

  • Frozen Panes

    Freeze panes to make specific columns and rows always visible while scrolling.

    See demo: Freeze Panes

  • Cells and Cell Ranges

    Add data of different types, hyperlinks and formulas to cells. Merge and unmerge cells, format, copy and clear cells, and manipulate cell ranges.

    See demo... | Learn more...

  • Cell Formatting

    Customize the appearance of cells by specifying different format attributes (font, background, borders, number formats and alignment of cell content).

    See demo... | Learn more...

  • Formula Calculation Engine

    Perform complex calculations using formulas with various functions and cell references, and create shared and array formulas.

    See demo: Formulas | See demo: API - Functions in Formulas | Learn more...

  • Pictures

    Insert, move, change, transform and delete pictures in a worksheet.

    See demo...

  • Tables

    Format cell ranges as tables to manage and analyze related data.

  • Sorting

    Sort data in a range in ascending or descending order.

    See demo... | Learn more...

  • Filtering

    Filter data: use the AutoFilter functionality to arrange large amounts of data by displaying only rows that meet filtering criteria.

    See demo... | Learn more...

  • Charting

    Use charts to display data in the most appropriate way. A variety of chart types (such as bar charts and line charts) and their subtypes (such as stacked horizontal pyramid charts and 3-D line charts) is supported.

    See demo... | Learn more...

  • Data Validation

    An Excel inspired data validation helps prevent end-users from entering wrong values into worksheet cells.

    See demo... | Learn more...

  • Mail Merge

    Use the Mail Merge feature to easily personalize letters, and compose catalogs and master-detail reports of any complexity.

    See demo: Mail Merge | See demo: Custom Data Merge | Learn more...

  • Full-text Search

    The built-in ribbon UI and a specific Find dialog allow end-users to easily locate data within a worksheet.

  • Support for Protected Documents

    When opening a document that contains protected elements, the Spreadsheet prevents them from being modified by end-users.

    See demo... | Learn more...

  • Printing

    The provided built-in ribbon UI allows end-users to easily customize the opened document for printing and print the entire workbook content.

    See demo... | Learn more...

  • Worksheet Print Settings

    Specify print settings: set the paper size, margins, orientation and other settings for worksheet pages.

    See demo... | Learn more...

  • Developer API

    The Spreadsheet extension is built on the Spreadsheet Core library, and exposes a comprehensive set of properties, methods, events and commands that enable you to build feature-rich applications.

    See demo...

HOW TO

REFERENCE