Spread for ASP.NET 13 Product Documentation
Spread for ASP.NET 13 Product Documentation / Developer's Guide / Customizing with Cell Types / Understanding How Cell Types Work / Understanding Cell Type Basics
In This Topic
    Understanding Cell Type Basics
    In This Topic

    You can specify the cell type for individual cells, columns, rows, a range of cells, or an entire sheet. For any cell type there are properties of a cell that can be set. In general, working with cell types includes defining the cell type, setting the properties, and applying that cell type to cells.

    Editor, Formatter, and Renderer

    A cell type consists of an editor, a renderer, and a formatter. The editor is an actual control instance that Spread creates and places in the location of the cell when you go into edit mode. The editor is responsible for creating and managing the cell's edit control when in edit mode. The formatter decides how the displayed text appears. The formatter is responsible for converting the cell's value to and from text (for example when getting or setting a cell's Text property). The renderer is code that paints that control inside the cell rectangle when the editor is not there (paints the cell when not in edit mode).

    In most cases, you want the cell to look the same whether you are in edit mode or not in edit mode. In these cases, you would create a single cell type and assign it to the cell's CellType property. This single cell type is used as the cell's editor, renderer, and formatter. If you want the cell to appear differently depending on whether you are in edit mode or not in edit mode, then you can create two different cell types and assign one cell type as the cell's editor and the other cell type as the cell's renderer. You probably also want to assign one of the cell types as the cell's formatter. For more information, refer to the ICellType interface.

    BaseCellType

    The design of cell editing requires that the cell type return an editor control which is then placed over the cell. The editor control can be text based (for example, text box) or graphics based (for example, check box). The editor control can drop down lists (for example, combo box). The BaseCellType class is a class from which the built-in text based cell types (for example, general, text, number, data-time, etc.) are derived. The class can also be used to derive custom cell types that are text based. The data model can hold any value, including colors. The cell type is always passed the raw value from the data model.

    Header Cells

    While you can assign a cell type to the cells in the row header or column header, the cell type is only used for painting purposes; header cells are renderable but are not editable. In‑cell editing is limited to cells in the data area. If you want to have something editable that acts like a header, you can hide (turn off) the column header, freeze the first row of the spreadsheet, then use the frozen row to act as your header cells.