The cell type affects how the contents of the cell are displayed. The cell contains formatted and unformatted data.
The Text property contains the formatted data which is displayed in the cell; the Value property contains the unformatted data which is saved in the model. You can use the SheetView GetText and GetValue methods to obtain the contents of the cell, regardless of cell type. For more information about data methods and properties, refer to Placing and Retrieving Data.
The following table lists the editable cell types, and how each cell type works with the data, whether formatted (Text property) or unformatted (Value property).
Editable Cell Type | Sample Input | Resultant (Text) Formatted Data | Resultant (Value) Unformatted Data |
---|---|---|---|
CurrencyCellType | "$10,000.00" | "$10,000.00" | 10000.00 |
DateTimeCellType | "10/29/2002" | "10/29/2002" | DateTime object of Tuesday, October 29, 2002 12:00:00 AM |
DoubleCellType | "10000.00" | "10000.00" | 10000.00 |
GeneralCellType | Any text | String of that data | Depends on whether DateTime, Boolean, or Text returns the DateTime object, the Boolean value, or the Text value |
IntegerCellType | "12345" | "12345" | 12345 |
PercentCellType | "15%" | "15%" | 0.15 |
RegExpCellType (Regular Expression) | "123-45-6789" | "123-45-6789" | "123-45-6789" |
TextCellType | Any text | String of that text | String of that text |
The DateTime cell returns data in the format of the FormatString property setting. In this example, the format string is set to "F".
If the cell's Multiline property is set to true, you can include a line feed character to include a line break when setting text.
Numbers are converted to scientific notation if they are greater than 999,999,999,999,999 or less than -999,999,999,999,999. Low fraction numbers are also converted to scientific notation.
The following table lists the graphical cell types, and how each cell type works with the data, whether formatted (Text property) or unformatted (Value property).
Graphical Cell Type | Sample Input | Resultant (Text) Formatted Data | Resultant (Value) Unformatted Data |
---|---|---|---|
ButtonCellType | null | null | null |
CheckBoxCellType | True (checked) | "True" | 1 |
False (unchecked) | "False" | 0 | |
Not set; looks false | Empty string | Null | |
ComboBoxCellType | Any item | Text of selected item | Text of selected item or index of selected item |
No item selected | Empty string | Null | |
HyperLinkCellType | Any text | String of that text | "True" (for visited link) or "False" (for not visited) |
ImageCellType | |||
LabelCellType | Any text | String of that text | String of that text |
ListBoxCellType | Any item selected | Text of the selected item | Text of or index of selected item |
MultiColumnComboBoxCellType | Any item | Text of selected item | Text of selected item or index of selected item |
RadioButtonListCellType | Any item selected | Text of the selected item | Text of or index of selected item |
No item selected | Empty string | Null |