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

[Solved] OnExcelExportCellFormatting

1 Answer 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 01 Jun 2009, 02:19 PM

Inside the OnExcelExportCellFormatting instead of having to assign the "UniqueName":

if (e.FormattedColumn.UniqueName == "Freight")
{
  e.Cell.Style["mso-number-format"] = @"0";
}

Could we not Style all the datatype fields of date be automatically formated to the date format that you want?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 05 Jun 2009, 08:47 AM
Hello Robert,

You could either set the mso-number-format to the desired columns only (as you did) or skip the conditional check and stylize all the columns with the same style. Unfortunately it's not possible to assign default styles in advance.
protected void radGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e) 
    e.Cell.Style["mso-number-format"] = @"0"

Let me know if you need more information.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or