The component provides the following models that provide a basis for much of the customization that is possible with the component.
Sheet Model | Classes and Interface | Description |
---|---|---|
Axis model | Basis for how the sheet’s rows and columns are structured. For more information, see Understanding the Axis Model. | |
Data model | Basis for the data in the cells in the sheet. For more information, see Understanding the Data Model. | |
Selection model | Basis for the behavior of and interaction of selected cells in the sheet. For more information, see Understanding the Selection Model. | |
Span model | Basis for how cells in the sheet are spanned. For more information, see Understanding the Span Model. | |
Style model | Basis for the appearance of the cells in the sheet. For more information, see Understanding the Style Model. |
It might help for you to think of the sheet (SheetView object) as a composite of the five underlying models (Axis, Data, Selection, Span, and Style). The Axis model handles everything to do with the columns and rows (for example, the column width, row height, and whether a row or column is visible). Similarly, the Data model handles everything to do with the data (for example, the value, the formula, and any optional notes or tags in a cell) and contains the data in the sheet. The Selection model handles any cell range selections that are made, and Span models handles any spanned cells. The Style model handles the appearance settings for the cells (for example, the background color, the font, and the cell type).
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 change 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 and the sheet background color and the grid lines, that are not in the models. But the relevant information about a given cell, both about the data in the cells and about the appearance of the cells, is in the models. The data area of the spreadsheet is considered one sheet with its own set of models, and the row headers are considered as a group to be another sheet in terms of having models assigned to it, and the column headers another, and the corner another.
Each model has a base model class and a default model class and an interface. The default model is given as the model with which you will most likely develop; this provides the default features that the component offers and is used for small customizations to the models. The base model is the base on which the default model is created and is for creating custom models from scratch. 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) so that if you want to implement your own model class you can pick and choose which pieces of functionality you have in your model.
For more information on creating a custom model for a sheet, refer to Creating a Custom Sheet Model.
Return to the overview of Using Sheet Models.