Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Styling in ExcelExportCellFormating event

Not answered Styling in ExcelExportCellFormating event

Feed from this thread
  • Ahmed avatar

    Posted on Feb 9, 2012 (permalink)

    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.

    Reply

  • Daniel Daniel admin's avatar

    Posted on Feb 14, 2012 (permalink)

    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 >>
    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Styling in ExcelExportCellFormating event
Related resources for "Styling in ExcelExportCellFormating event"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]