Cell.DisplayText Property
Returns a cell’s displayed value.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
String | The cell’s display text. |
Remarks
Use the Cell.Value property to access and modify a cell’s value. A cell can contain different data types. Assign a number format pattern to the Cell.NumberFormat property to format a numeric value in a cell as a percentage, currency, fraction, date and time, and so on. The DisplayText property returns the cell’s formatted value.
// Add a formula to the cell "A1".
worksheet.Cells["A1"].Formula = "= Now()";
// Format the cell's value.
worksheet.Cells["A1"].NumberFormat = "m/d/yy h:mm";
// Obtain the cell's display text.
// The property returns the current date and time
// (for instance, "6/19/2020 13:13").
string displayText1 = worksheet.Cells["A1"].DisplayText;
// Add a number to the cell "B1".
worksheet.Cells["B1"].Value = 1.6;
// Format the number as a percentage.
worksheet.Cells["B1"].NumberFormat = "0.0%";
// Obtain the cell's display text.
// The property returns "160.0%".
string displayText2 = worksheet.Cells["B1"].DisplayText;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayText property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.