Background Color to CSV Header

2 posts, 0 answers
  1. Amol
    Amol avatar
    57 posts
    Member since:
    Apr 2008

    Posted 11 Dec 2009 Link to this post

    Hi Telerik Team,

    I had created a application which will export RAD Grid to CSV File. however i cannot export data with proper formatting which i have given to Grid. My requirement is set the background color of Header to Red. It is properly working if i export data to Excel Sheet. how ever my requirement is export data to CSV with proper Formatting

    Here is what i have used

             rgExport.DataSource = timesheetList;
                    rgExport.ExportSettings.FileName = NextJobPLConstants.TIMESHEET_EXPORT_FILE;

                    rgExport.ExportSettings.ExportOnlyData = true;
                    rgExport.ExportSettings.IgnorePaging = true;
                    rgExport.ExportSettings.OpenInNewWindow = true;

    protected void rgExport_ItemCreated(object sender, GridItemEventArgs e)


            if (e.Item is GridHeaderItem)
                GridHeaderItem headerItem = (GridHeaderItem)e.Item;
                headerItem.Style["font-size"] = "12px";
                headerItem.Style["font-style"] = "Verdana";
                headerItem.Style["color"] = "black";
                headerItem.Style["background-color"] = "#99CC00";
                headerItem.Style["border-width"] = "1";
                headerItem.Style["border-style"] = "Solid";
                headerItem.Style["border-color"] = "black";
                headerItem.Style["height"] = "50px";
                headerItem.Style["vertical-align"] = "bottom";
                headerItem.Style["horizontal-align"] = "center";
                foreach (TableCell cell in headerItem.Cells)
                    cell.Style["text-align"] = "center";
                    cell.Style["font-weight"] = "bold";


            if (e.Item is GridDataItem)
                GridDataItem dataItem = (GridDataItem)e.Item;
                dataItem.Style["background-color"] = "#CCFFFF";
                dataItem.Style["border-width"] = "1";
                dataItem.Style["border-style"] = "Solid";
                dataItem.Style["border-color"] = "black";
                dataItem.Style["font-style"] = "Verdana";


    Please help me in this matter.



  2. Daniel
    Daniel avatar
    4949 posts

    Posted 11 Dec 2009 Link to this post

    Hello Amol,

    CSV is a plain text format that doesn't support any styles/formatting. Please examine the following link for more information:

    Best regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top