Pending Review
Last Updated: 27 May 2019 13:21 by ADMIN
Grant
Created on: 27 May 2019 13:14
Category: Grid
Type: Bug Report
0
RadGrid export XLSX white space in header text
If exporting a sorted RadGrid to  Excel XLSX a white space is prepended to the header text in the output file
1 comment
ADMIN
Attila Antal
Posted on: 27 May 2019 13:21
Issue seems to happen when the ExportOnlyData property is set to false.

While the issue is fixed, the following workaround can be used:

C#

protected void RadGrid1_InfrastructureExporting(object sender, GridInfrastructureExportingEventArgs e)
{
    if (RadGrid1.ExportSettings.ExportOnlyData)
    {
        // Access the first row of the Export Structure (header row)
        ExportInfrastructure.CellCollection cells = e.ExportStructure.Tables[0].Rows[1].Cells;
        // Loop through the header cells and trim their values from white spaces
        foreach (ExportInfrastructure.Cell cell in cells){
            cell.Value = cell.Text.Trim();
        }
    }
}


VB

Protected Sub RadGrid1_InfrastructureExporting(sender As Object, e As GridInfrastructureExportingEventArgs)
    If RadGrid1.ExportSettings.ExportOnlyData Then
        'Access the first row of the Export Structure (header row)
        Dim cells As ExportInfrastructure.CellCollection = e.ExportStructure.Tables(0).Rows(1).Cells
        '' Loop through the header cells and trim their values from white spaces
        For Each cell As ExportInfrastructure.Cell In cells
            cell.Value = cell.Text.Trim()
        Next
    End If
End Sub