Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Understanding the Underlying Models / Understanding the Sheet Model Classes and Interfaces
In This Topic
    Understanding the Sheet Model Classes and Interfaces
    In This Topic

    The following table lists the models and their associated classes and interfaces.

    Sheet Model Classes and Interface Description
    Axis model

    BaseSheetAxisModel

    DefaultSheetAxisModel

    ISheetAxisModel

    Basis for how the sheet of cells is structured in terms of rows and columns. For more information, see Understanding the Axis Model.
    Data model

    BaseSheetDataModel

    DefaultSheetDataModel

    ISheetDataModel

    Basis for the manipulation of data in the cells in the sheet. For more information, see Understanding the Data Model.
    Selection model

    BaseSheetSelectionModel

    DefaultSheetSelectionModel

    ISheetSelectionModel

    Basis for the behavior of and interaction of selected cells in the sheet. For more information, see Understanding the Selection Model.
    Span model

    BaseSheetSpanModel

    DefaultSheetSpanModel

    ISheetSpanModel

    Basis for how cells in the sheet are spanned. For more information, see Understanding the Span Model.
    Style model

    BaseSheetStyleModel

    DefaultSheetStyleModel

    ISheetStyleModel

    Basis for the appearance of the cells in the sheet. For more information, see Understanding the Style Model.

    Everything you do to the model is automatically updated in the sheet and most of the aspects of the sheet that you can modify are updated in the model. This is also true for Cell, Row, and Column object settings, too. Most of the aspects changed with these objects automatically changes the setting in the corresponding sheet model and vice versa. If you add columns to the data model, then they are added to the sheet. This is true, even down to the parameters; for example the row and column arguments in the GetValue and SetValue methods for the data model are the same indexes as that of the rows and columns in the sheet as long as the sheet is not sorted.

    Not everything in the Spread namespace is in the models. For example, there are aspects of the overall component, for example, the sheet tabs, the sheet background color, and the grid lines, that are not in the models. But the relevant pieces of information about a given cell, both about the data in the cells and about the appearance of the cells, are in the models.

    The data area of the spreadsheet has its own set of models, and the row headers and column headers are considered two more such groups having models assigned to each of them, and the sheet corner is another with its own set of models.

    Each model has a base model class, a default model class, and an interface.

    The base model has the fewest built-in features, and the default model extends the base model. If you want to provide different features or customize the behavior or appearance of your application, you can extend the base models to create new classes. For example you may do this to create a template component for all the developers in your organization. By creating your own class based on one of the base models, you can create the customized class and provide it to all the developers to use. Typically, if you are editing the models, use the default model classes. But if you want to create a custom model (from scratch), use the base model classes.

    Each default model class contains the implementation of the interface for that model type as well as additional optional interfaces. Most of the functionality (that is, formulas, data binding, XML serialization, etc.) is optional in the model class, and is implemented in separate interfaces from the main model interfaces (such as ISheetDataModel). Therefore, if you want to implement your own model class, you can pick and choose which pieces of functionality you have in your model.

    It is important for the models to stay in sync with each other, so that the row count and column count is consistent among the models making up the sheet. The SheetView object listens for the ISheetDataModel.Change event from the SheetView.DocumentModels.Data property, and updates the other models accordingly when the row count or column count changes due to any of these:

    If the models get out of sync, then index out-of-range exceptions can be caused by code trying to get information about nonexistent rows or columns.

    For more information on creating a custom model for a sheet, refer to Creating a Custom Sheet Model.