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

Styling in ExcelExportCellFormating event

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mak
Top achievements
Rank 1
Mak asked on 09 Feb 2012, 05:08 PM
Hi there

we have decided to style some of our excel exports using the above event, and everything is so far going fine, however we have just one question for you:

- Rather than applying each individual style on the cell in question, is there any way to reference a css class which contains the intended styles? If not do you have any suggestions as to how we can achieve something similar to our requirements?

Thank you for your time

A.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Feb 2012, 10:49 AM
Hi Ahmed,

Yes, it is possible. Here is how:
protected void RadGrid1_ExportCellFormatting(object sender, ExportCellFormattingEventArgs e)
{
    e.Cell.CssClass = "testClass";
}
 
protected void RadGrid1_HTMLExporting(object sender, GridHTMLExportingEventArgs e)
{
    string myCssClass = ".testClass { font-weight: bolder; text-decoration: underline; color: #ca99fa; background-color:#004566; }";
    e.Styles.Append(myCssClass);
}

You can also examine the attached demo.

Regards,
Daniel
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
Mak
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or