This is a migrated thread and some comments may be shown as answers.

RadGrid Export to Excel (Date Column).

1 Answer 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nen
Top achievements
Rank 1
Nen asked on 04 Nov 2010, 08:32 AM
hi all,

we have a date column in the grid and when we export to excel, excel is treating it as a Date column, i want it to be treated as a normal string (general), is this possible in telerik grids export to excel functionality

Thanks -Nen

1 Answer, 1 is accepted

Sort by
0
Nen
Top achievements
Rank 1
answered on 04 Nov 2010, 11:24 AM
found the answer

  void gridRawKPIData_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e)
        {
  e.Cell.Style["mso-number-format"] ="\\@";          if (e.FormattedColumn.UniqueName.Contains("Date"))
            {
                //Assigning this format to the excel cell, to make sure it renders the date as text and to keep it consistent with day and night shift which automatically render as text
                //because of -N and -D
                e.Cell.Style["mso-number-format"] ="\\@";
            } 
        }
  void gridRawKPIData_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e)
        {
            if (e.FormattedColumn.UniqueName.Contains("Date"))
            {
                //Assigning this format to the excel cell, to make sure it renders the date as text and to keep it consistent with day and night shift which automatically render as text
                //because of -N and -D
                e.Cell.Style["mso-number-format"] ="\\@";
            } 
        }
e.Cell.Style["mso-number-format"] ="\\@";
Tags
Grid
Asked by
Nen
Top achievements
Rank 1
Answers by
Nen
Top achievements
Rank 1
Share this question
or