Edit this page

Export String Value


When exporting a RadGridView to Excel using ExportFormat.HTML, the string values that can be converted to numbers, are opened in Excel as numbers.

This behavior does not occur when exporting using ExportFormat.ExcelML.


When using the HTML format, the RadGridView actually saves data in an Excel readable html format.


You will need to format the exported string column appropriately so that the Excel file interprets it as a string.

Here is a small sample code:

Example 1: Handling the ElementExporting event:

private void clubsGrid_ElementExporting(object sender, GridViewElementExportingEventArgs e)
    if (e.Element == ExportElement.Cell)
        var column = e.Context as GridViewDataColumn;
        if (column.Header.ToString() == "My String Column")
            e.Value = string.Format(@"=T(""{0}"")", e.Value);
Private Sub clubsGrid_ElementExporting(sender As Object, e As GridViewElementExportingEventArgs)
    Dim column = TryCast(e.Context, GridViewDataColumn)
    If e.Element = ExportElement.Cell Then
        If column.Header.ToString() = "My String Column" Then
            e.Value = String.Format("=T(""{0}"")", e.Value)
        End If
    End If
End Sub
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article