CellValueFactory
Factory for creating cell value instances from various input types; use to convert strings, numbers, dates, and formulas into appropriate ICellValue implementations.
Definition
Namespace:Telerik.Windows.Documents.Spreadsheet.Model
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Syntax:
public static class CellValueFactory
Inheritance: objectCellValueFactory
Methods
Creates a boolean cell value from a bool.
public static ICellValue Create(bool value)
The value.
Returns:The ICellValue instance.
Creates a number cell value from a DateTime by converting it to Excel's date serial number format.
public static ICellValue Create(DateTime value)
The value.
Returns:The ICellValue instance.
Creates a number cell value from a double.
public static ICellValue Create(double value)
The value.
Returns:The ICellValue instance.
Creates a cell value from a string by parsing its content and determining the appropriate format; outputs both the cell value and any detected format.
public static void Create(string value, Worksheet worksheet, CellIndex cellIndex, CellValueFormat currentFormatValue, out ICellValue cellValue, out CellValueFormat newFormatValue)
The value.
worksheetWorksheetThe worksheet.
cellIndexCellIndexIndex of the cell.
currentFormatValueCellValueFormatThe current format value.
cellValueICellValueThe cell value.
newFormatValueCellValueFormatThe new format value.
Creates a cell value from a string by parsing its content at the specified location and determining the appropriate format; outputs both the cell value and any detected format.
public static void Create(string value, Worksheet worksheet, int rowIndex, int columnIndex, CellValueFormat currentFormatValue, out ICellValue cellValue, out CellValueFormat newFormatValue)
The value.
worksheetWorksheetThe worksheet.
rowIndexintIndex of the row.
columnIndexintIndex of the column.
currentFormatValueCellValueFormatThe current format value.
cellValueICellValueThe cell value.
newFormatValueCellValueFormatThe format value.
Creates a formula cell value by parsing the string as an Excel formula expression at the specified location.
Creates a text cell value from a string without parsing or type detection.
public static ICellValue CreateTextCellValue(string value)
The value.
Returns:The ICellValue instance.
Determines the cell value type that corresponds to a constant expression; returns the appropriate CellValueType for the expression's result.
public static CellValueType GetCellValueType(this ConstantExpression value)
The expression.
Returns:The cell value type.
Converts a boolean value to a boolean cell value.
public static ICellValue ToCellValue(this bool value)
The value.
Returns:The ICellValue instance.
Converts a DateTime value to a number cell value representing the date; apply a date format to the cell to display as a date instead of a number.
public static ICellValue ToCellValue(this DateTime value)
The value.
Returns:The ICellValue instance.
Please note the date is stored as number value. If a date number format is not set to the cell the value will be shown as number.
Converts a double value to a number cell value.
public static ICellValue ToCellValue(this double value)
The value.
Returns:The ICellValue instance.
Converts a string to a cell value by parsing its content at the specified cell location; string is analyzed to determine if it contains a number, date, formula, or text.
public static ICellValue ToCellValue(this string value, Worksheet worksheet, CellIndex cellIndex)
The value.
worksheetWorksheetThe worksheet.
cellIndexCellIndexIndex of the cell.
Returns:The ICellValue instance.
Please note that the string value is parsed to find its type. This process is slow. If you know the type of your data use the other overloads of this method.
Converts a string to a cell value by parsing its content at the specified row and column; string is analyzed to determine if it contains a number, date, formula, or text.
public static ICellValue ToCellValue(this string value, Worksheet worksheet, int rowIndex, int columnIndex)
The value.
worksheetWorksheetThe worksheet.
rowIndexintIndex of the row.
columnIndexintIndex of the column.
Returns:The ICellValue instance.
Please note that the string value is parsed to find its type. This process is slow. If you know the type of your data use the other overloads of this method.
Converts a string to a formula cell value by parsing it as an Excel formula at the specified location.
Converts a string to a text cell value without parsing; use when you want to store the string as literal text regardless of content.
public static ICellValue ToTextCellValue(this string value)
The value.
Returns:The TextCellValue instance.