TCellValue Record
Represents a value inside a cell.
Syntax
Unit: FlexCel.Core
TCellValue = record;
Methods
Name | Description |
---|---|
Empty | Creates a cell value without value. |
Create | Overloaded Create(Double) Create(Int64) Create(TDateTime) Create(string) Create(TRichString) Create(Boolean) Create(TFlxFormulaErrorValue) Create(TFormula) Create(Variant) Create(TValue) |
IsEmpty | Returns true if the cell is empty. |
HasValue | Returns true if the cell has a value. This is the opposite of IsEmpty |
IsNumber | Returns true if the cell contains a number. Note that cells with dates will be reported as Number too. |
IsDateTime | Returns true if the value is a DateTime. Note::This value will never be true when reading cells from a file. When reading a file, dates are stored as number so they will be returned as numbers. This property only will return true if you manually created a TCellValue from a TDateTime. To know if a cell has a date, you need to look at its format, not its value. |
IsString | Returns true if the cell has a string. |
IsBoolean | Returns true if the cell has a boolean. |
IsError | Returns true if the cell has an error like #N/A! or #DIV0!. Note that this only applies to error values entered directly in the cell. If the cell has a formula that returns #N/A!, then the cell has a formula and the formula has an error. But the cell itself doesn't have an error. |
IsFormula | Returns true if the cell has a formula. |
AsNumber | Returns the value of the cell if it contains a number or a date. If the cell doesn't contain a number this method will raise an exception so you might want to check first the cell data type before calling it. |
AsDateTime | If the cell contains a datetime, it returns the value. If not, it raises an Exception. Remember that cells returned from a file will never have a datetime, they will have numbers instead. |
AsString | If the cell contains a string, it returns the string. If not, it raises an Exception. To get a string with whatever value is in the class, use ToString |
ToString | Returns a rich string with whatever the cell value is. If this is an integer or a boolean, it will be converted to a string. |
ToSimpleString | Returns a string without formatting. This is equivalent to ToString.ToString, but it can be faster. |
ToStringInvariant | Returns a string with whatever the cell value is. If this is number, it will be converted to a string, using invariant format settings (decimal separator will always be "." for example). |
ToDateTime | Returns the value as a DateTime, if it can be converted, or DateTime(0) if it can't. |
ToNumberInvariant | Returns the value as a number, if it can be converted, or 0 if it can't. Note that this conversion uses invariant culture so even if your decimal separator is ",", the strings converted should be like "2.0" |
AsBoolean | If the cell contains a boolean, it returns the value. If not, it raises an exception. |
AsError | If the cell contains an error, it returns the value. If not, it raises an exception. |
AsFormula | If the cell contains a formula, it returns the value. If not, it raises an exception. |
AsVariant | Returns the cell value as a variant. |
AsTValue | Returns the cell value as a TValue. |
ClearValue | Sets the value of the cell to empty. |