Cell.DisplayText Property
Returns a cell's displayed value.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v20.2.Core.dll
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;
See Also
Feedback