Spread ASP.NET 17
Spread for ASP.NET 17 Product Documentation / Developer's Guide / Using Sheet Models
In This Topic
    Using Sheet Models
    In This Topic

    You can use models to customize the user experience with the spreadsheet and extend the functionality for your particular application. As a set, the sheet models correspond to the basis of all the objects and settings of a particular sheet. Each sheet has its own set of models. If you have multiple sheets in your FpSpread component, then each sheet has its own set of models.

    You can do many tasks without ever using the models. Through the Spread Designer or through properties of the shortcut objects (such as Cells, Columns, and Rows), you can affect many of the changes that define your spreadsheet. But to understand fully how Spread works and to make use of many of the features and the customizations available to you as a developer, you might want to understand how to use the underlying models.

    The sheet models are the basis for all the shortcut objects, so using models is generally faster than using shortcut objects (less processing time is required).

    For example, in code using the shortcut object to set a value:

    VB
    Copy Code
    FpSpread1.Sheets(0).Cells(0,0).Value = "Test"
    

    would be equivalent to using the underlying data model method:

    VB
    Copy Code
    FpSpread1.Sheets(0).DataModel.SetValue(FpSpread1.Sheets(0).GetModelRowFromViewRow(0), FpSpread1.Sheets(0).GetModelColumnFromViewColumn(0), "Test")
    

    Overview

    As described in the Product Overview, several aspects of the sheet in the component are governed by underlying models.

    Each quadrant of the sheet (corner, column header, row header, or data area) has its own set of models. The models are shown conceptually in this diagram.

    Sheet with Underlying Models Diagram

    These topics can help you customize the component using models:

    Interfaces

    There are many interfaces involved in the models. Each model class implements a number of interfaces, and each model has one "model" interface which must be implemented to make it a valid implementation for that particular model.

    All references to the model classes are through the interfaces, and no assumptions are made as to what interfaces are implemented on each model (except for the "model" interface which must be present). If the model class does not implement a particular interface, then that functionality is simply disabled in the sheet (that is, if IDataSourceSupport is not implement by SheetView.Models.Data, then the DataSource and DataMember properties are not functional).

    These topics provide an introduction to the use of sheet models. For complete lists of these interfaces, look at the overview for the default model classes in the Assembly Reference. You can find a list of the models, their classes and interfaces, and links to the Assembly Reference in Understanding How the Models Work.