officefileapi-devexpress-dot-spreadsheet-dot-cell-b5a5b9ac.md
Returns a cell’s displayed value.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
string DisplayText { get; }
ReadOnly Property DisplayText As String
| Type | Description |
|---|---|
| String |
The cell’s display text.
|
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;
' 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").
Dim displayText1 As String = 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%".
Dim displayText2 As String = worksheet.Cells("B1").DisplayText
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.
sheet["E4"].Value.TextValue, sheet["E6"].Value.TextValue, sheet["E8"].Value.TextValue,
sheet.Cells["G4"].DisplayText, sheet.Cells["G6"].DisplayText);
}
{
return range[-1, offset].DisplayText;
}
winforms-spreadsheet-bind-to-ms-sql-server-database/CS/SuppliersExample/Form1.cs#L63
sheet["E4"].Value.TextValue, sheet["E6"].Value.TextValue, sheet["E8"].Value.TextValue,
sheet.Cells["G4"].DisplayText, sheet.Cells["G6"].DisplayText);
}
winforms-spreadsheet-how-to-edit-rich-text/VB/SpreadsheetRichText/RichTextEditForm.vb#L46
Else
RichEditControl1.Text = cell.DisplayText
End If
' Append a new row to the "Suppliers" data table.
dataSet.Suppliers.AddSuppliersRow(sheet("C4").Value.TextValue, sheet("C6").Value.TextValue, sheet("C8").Value.TextValue, sheet("E4").Value.TextValue, sheet("E6").Value.TextValue, sheet("E8").Value.TextValue, sheet.Cells("G4").DisplayText, sheet.Cells("G6").DisplayText)
Catch ex As Exception
Public Function GetColumnName(ByVal index As Integer, ByVal offset As Integer, ByVal range As CellRange) As String Implements IDataSourceColumnTypeDetector.GetColumnName
Return range(-1, offset).DisplayText
End Function
winforms-spreadsheet-bind-to-ms-sql-server-database/VB/SuppliersExample/Form1.vb#L61
' Append a new row to the "Suppliers" data table.
dataSet.Suppliers.AddSuppliersRow(sheet("C4").Value.TextValue, sheet("C6").Value.TextValue, sheet("C8").Value.TextValue, sheet("E4").Value.TextValue, sheet("E6").Value.TextValue, sheet("E8").Value.TextValue, sheet.Cells("G4").DisplayText, sheet.Cells("G6").DisplayText)
Catch ex As Exception
See Also