All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

CellRange.SetValueFromText(String) Method

Parses the supplied string and creates a cell value to assign it to the cells in the current range.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.1.Core.dll

Declaration

void SetValueFromText(
    string value
)
Sub SetValueFromText(
    value As String
)

Parameters

Name Type Description
value String

A string to parse.

Remarks

The SetValueFromText method calls the default worksheet parser which is normally used to parse the input of the cell editor. The cell number format is set to the default number format for the value type assigned to the cell.

Examples

This example demonstrates how to use the CellRange.SetValueFromText method to parse the specified string and add data of different types to worksheet cells. To retain the Formatting.NumberFormat of the current cell, when calling the method, set the second parameter to true.

For details on how to access an individual cell or range of cells, refer to the How to: Access a Cell in a Worksheet or How to: Access a Range of Cells document.

// Add data of different types to cells.
worksheet.Cells["B1"].SetValueFromText("27-Jul-16 5:43PM");
worksheet.Cells["B2"].SetValueFromText("3.1415926536");
worksheet.Cells["B3"].SetValueFromText("Have a nice day!");
worksheet.Cells["B4"].SetValueFromText("#REF!");
worksheet.Cells["B5"].SetValueFromText("true");
worksheet.Cells["B6"].SetValueFromText("3.40282E+38");
worksheet.Cells["B7"].SetValueFromText("2147483647");
worksheet.Cells["B8"].NumberFormat = "###.###";
worksheet.Cells["B8"].SetValueFromText("27-Jul-16 5:43PM", true);
worksheet.Cells["B9"].SetValueFromText("=SQRT(25)");

// Fill all cells in the range with 10.
worksheet.Range["C11:F11"].SetValueFromText("=B1");
See Also