skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class CellValueFactory

Factory for creating cell value instances from various input types; use to convert strings, numbers, dates, and formulas into appropriate ICellValue implementations.

Inheritance
System.Object
CellValueFactory
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Documents.Spreadsheet.Model
Assembly: Telerik.Windows.Documents.Spreadsheet.dll

Syntax

public static class CellValueFactory

Methods

Create(Boolean)

Creates a boolean cell value from a bool.

Declaration
public static ICellValue Create(bool value)
Parameters
System.Boolean value

The value.

Returns
ICellValue

The ICellValue instance.

Create(DateTime)

Creates a number cell value from a DateTime by converting it to Excel's date serial number format.

Declaration
public static ICellValue Create(DateTime value)
Parameters
System.DateTime value

The value.

Returns
ICellValue

The ICellValue instance.

Create(Double)

Creates a number cell value from a double.

Declaration
public static ICellValue Create(double value)
Parameters
System.Double value

The value.

Returns
ICellValue

The ICellValue instance.

Create(String, Worksheet, Int32, Int32, CellValueFormat, out ICellValue, out CellValueFormat)

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.

Declaration
public static void Create(string value, Worksheet worksheet, int rowIndex, int columnIndex, CellValueFormat currentFormatValue, out ICellValue cellValue, out CellValueFormat newFormatValue)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

System.Int32 rowIndex

Index of the row.

System.Int32 columnIndex

Index of the column.

CellValueFormat currentFormatValue

The current format value.

ICellValue cellValue

The cell value.

CellValueFormat newFormatValue

The format value.

Create(String, Worksheet, CellIndex, CellValueFormat, out ICellValue, out CellValueFormat)

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.

Declaration
public static void Create(string value, Worksheet worksheet, CellIndex cellIndex, CellValueFormat currentFormatValue, out ICellValue cellValue, out CellValueFormat newFormatValue)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

CellIndex cellIndex

Index of the cell.

CellValueFormat currentFormatValue

The current format value.

ICellValue cellValue

The cell value.

CellValueFormat newFormatValue

The new format value.

CreateFormulaCellValue(String, Worksheet, Int32, Int32)

Creates a formula cell value by parsing the string as an Excel formula expression at the specified location.

Declaration
public static ICellValue CreateFormulaCellValue(string value, Worksheet worksheet, int rowIndex, int columnIndex)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

System.Int32 rowIndex

Index of the row.

System.Int32 columnIndex

Index of the column.

Returns
ICellValue

The ICellValue instance.

CreateTextCellValue(String)

Creates a text cell value from a string without parsing or type detection.

Declaration
public static ICellValue CreateTextCellValue(string value)
Parameters
System.String value

The value.

Returns
ICellValue

The ICellValue instance.

GetCellValueType(ConstantExpression)

Determines the cell value type that corresponds to a constant expression; returns the appropriate CellValueType for the expression's result.

Declaration
public static CellValueType GetCellValueType(this ConstantExpression value)
Parameters
ConstantExpression value

The expression.

Returns
CellValueType

The cell value type.

ToCellValue(Boolean)

Converts a boolean value to a boolean cell value.

Declaration
public static ICellValue ToCellValue(this bool value)
Parameters
System.Boolean value

The value.

Returns
ICellValue

The ICellValue instance.

ToCellValue(DateTime)

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.

Declaration
public static ICellValue ToCellValue(this DateTime value)
Parameters
System.DateTime value

The value.

Returns
ICellValue

The ICellValue instance.

Remarks

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.

ToCellValue(Double)

Converts a double value to a number cell value.

Declaration
public static ICellValue ToCellValue(this double value)
Parameters
System.Double value

The value.

Returns
ICellValue

The ICellValue instance.

ToCellValue(String, Worksheet, Int32, Int32)

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.

Declaration
public static ICellValue ToCellValue(this string value, Worksheet worksheet, int rowIndex, int columnIndex)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

System.Int32 rowIndex

Index of the row.

System.Int32 columnIndex

Index of the column.

Returns
ICellValue

The ICellValue instance.

Remarks

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.

ToCellValue(String, Worksheet, CellIndex)

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.

Declaration
public static ICellValue ToCellValue(this string value, Worksheet worksheet, CellIndex cellIndex)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

CellIndex cellIndex

Index of the cell.

Returns
ICellValue

The ICellValue instance.

Remarks

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.

ToCellValue(CellIndex, Worksheet)

Retrieves the cell value at the specified cell index from the worksheet.

Declaration
public static ICellValue ToCellValue(this CellIndex value, Worksheet worksheet)
Parameters
CellIndex value

The value.

Worksheet worksheet

The worksheet.

Returns
ICellValue

The ICellValue instance.

ToFormulaCellValue(String, Worksheet, Int32, Int32)

Converts a string to a formula cell value by parsing it as an Excel formula at the specified location.

Declaration
public static ICellValue ToFormulaCellValue(this string value, Worksheet worksheet, int rowIndex, int columnIndex)
Parameters
System.String value

The value.

Worksheet worksheet

The worksheet.

System.Int32 rowIndex

Index of the row.

System.Int32 columnIndex

Index of the column.

Returns
ICellValue

The FormulaCellValue instance.

ToTextCellValue(String)

Converts a string to a text cell value without parsing; use when you want to store the string as literal text regardless of content.

Declaration
public static ICellValue ToTextCellValue(this string value)
Parameters
System.String value

The value.

Returns
ICellValue

The TextCellValue instance.

Getting Started
  • Getting Started
Support Resources
  • Documentation
Community
  • Forums
  • Blogs
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.