SSpread.CellType Property
Sets the data type of cells in the entire spreadsheet, rows, columns, cells, and cell blocks.
Before setting this property, use the Col, Row properties, and so on to specify what to do.
Specify the following values. The initial value is $CellTypeEdit for normal cells and $CellTypeStaticText for columns and row header cells.
| Constant | Value | Description |
|---|---|---|
| $CellTypeDate | 0 | Date type |
| $CellTypeEdit | 1 | Character type |
| $CellTypePic | 4 | Mask type |
| $CellTypeStaticText | 5 | Label type |
| $CellTypeTime | 6 | Time type |
| $CellTypeButton | 7 | Command button type |
| $CellTypeComboBox | 8 | Combo box type |
| $CellTypePicture | 9 | Picture type |
| $CellTypeCheckBox | 10 | Check box type |
| $CellTypeCurrency | 12 | Currency type |
| $CellTypeNumber | 13 | Numeric type |
| $CellTypePercent | 14 | Percentage type |
| $CellTypeScientific | 15 | Exponential type |
Example of usage
Col = 2;
Row = 3;
CellType = $ CellTypeDate;
TypeDateFormat = $ TypeDateFormatGEEMMDD;
BlockMode = $ TRUE;
Col = 3;
Row = 3;
Col2 = 5;
Row2 = 5;
CellType = $ CellTypeNumber;
TypeNumberDecPlaces = 0;
BlockMode = $ FALSE;
Related properties for each cell data type
These are the following related properties to make settings that are unique to each cell data type.
Property inheritance for each cell data type
For related properties whose names start with “Type”, the last setting for each cell data type is remembered, and the property is inherited the next time the property is set for a cell with the same data type.
For example, if set the TypeDateMax property or TypeDateMin property after setting the date type ($CellTypeDate), the same settings will be inherited for the date type cells created after that.
Initial values for related properties are stored for each cell data type. The TypeHAlign property, TypeVAlign property, etc. used for multiple data types are also managed separately for each data type.
The stored settings will be applied together when setting the data type of subsequent cells. This feature is useful if have the same settings for multiple cells, but be careful if it have different settings.
・ Operation Image
(1) The value of the related property is held for each data type.
(2) When setting the CellType property, set all the contents of (1) corresponding to the set data type at the same time.
CellType = $CellTypeDate;
(3) When setting related properties that start with “Type”, set all the contents of (1) at the same time after updating (1).
TypeDateMin = "19500101";
Program Example
Col = 1; / * Set column 1 row 1 cell * /
Row = 1;
CellType = $ CellTypeDate; / * Set to date type * /
TypeDateMin = "19500101"; / * Set the start of the date range to 1950/01/01 * /
TypeDateMax = "20501231"; / * Set end of date range to 2050/12/31 * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
Col = 2; / * Set column 2 rows 2 cells * /
Row = 2;
CellType = $ CellTypeDate; / * Set to date type (date range is also the same as 1 row 1 cell in column (1950/01/01 ~ 2050/12/31) ) * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
Col = 3; / * Set column 3 rows 3 cells * /
Row = 3;
CellType = $ CellTypeDate; / * Set to date type (at this point the date range is the same as column 1 row 1 and column 2 row 2 cells) * /
TypeDateMin = "20000101"; / * Set the start of the date range to 2000/01/01 (date range will be from 2000/01/01 to 2050/12/31 ) * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
Col = 4; / * Change column 4 rows 4 cells * /
Row = 4;
CellType = $ CellTypeDate; / * Set to date type (date range is the same as column 3 rows 3 cells ( 2000/01/01 ~ 2050/12/31) ) * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
/ * Setting example that requires attention * /
Col = 1; / * Change column 1 row 1 cell again * /
Row = 1;
/ * At this point, as originally set (1950/01/01 ~ 2050/12/31) * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
TypeDateMax = "20001231"; / * Since the previous date type setting (column 4 row 4 cell setting) is the default value, all the original settings are overwritten * /
/ * As a result, the value of TypeDateMin is also changed, and the date range is from 2000/01/01 to 2000/12/31 * /
print (Col, Row, TypeDateMin, TypeDateMax, "\ n");
Notes on property inheritance when applying to cell blocks
When BlockMode is set to $TRUE and the setting is applied to the cell block, each property is set based on the cell pointed to by the Col, Row properties.
For example, if the cell pointed to by the Col and Row properties is a combo box cell, all cells in the cell block will be changed to combo box cells and the same settings will be applied.
Please take note that changing the TypeHAlign, TypeVAlign properties, etc., which are common to many data types, will result in the same settings, including the cell data type.
Notes on property inheritance of combo box type cells
In the combo box type cell, the following properties and methods that operate on list items are not subject to property inheritance.
TypeComboBoxCurSel property
TypeComboBoxList property
TypeComboBoxString property
TypeComboBoxClear method
TypeComboBoxRemoveItem method
Working with list items using these does not affect the setting of the CellType property or the related properties of combo box cells that start with “Type”.
The TypeComboBoxCount property is read-only and is not subject to property inheritance.
The TypeComboBoxIndex property only acts as a variable, so it holds only one value, regardless of the state of the cell.
Notes on property inheritance of label type cells
Label type cells hold data for property inheritance separately because the initial values are different between normal cells, column header cells, and row header cells.
Settings for related properties of labeled cells that start with “Type” will update both of these data. Each data is used for the setting to the cell.
TypeHAlign = $ TypeHAlignRight;
About display of command button type and combo box type cells
In command button type and combo box type cells, command buttons and combo boxes are usually always displayed, but you can control the display / non-display by the position of the active cell by setting the ButtonDrawMode property.
If the OperationMode property specifies a mode that handles spreadsheets row by row (Row, Single, Multi, Extended), the command buttons and combo boxes will not be displayed. For row mode ($OperationModeRow), command buttons and combo boxes are displayed only when the row is in the edit state.
In read-only mode ($OperationModeRead), command buttons and combo boxes are displayed but not available. For command button type and combo box type cells, use in standard mode ($OperationModeNormal) or row mode ($OperationModeRow).