RadGrid Export data to Excel

3 posts, 0 answers
  1. Ban
    Ban avatar
    43 posts
    Member since:
    Jan 2009

    Posted 24 Jan 2009 Link to this post

    I am using ExportToExcel in RadGrid, inside "ExcelMLExportStylesCreated" , "ExcelMLExportRowCreated" events I change my data format (Font Style, InteriorStyle, ......) but the only thing I could not do is How I can set borders to my cells !!? .. Will you please help me to figure out how.

  2. Daniel
    Daniel avatar
    4949 posts

    Posted 26 Jan 2009 Link to this post

    Hello Ban,

    Sample approach is shown below:
    protected void RadGrid1_ExcelMLExportStylesCreated(object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e) 
        BorderStylesCollection borders = new BorderStylesCollection(); 
        BorderStyles borderStyle = null
        for (int i = 1; i <= 4; i++) 
            borderStyle = new BorderStyles(); 
            borderStyle.PositionType = (PositionType)i; 
            borderStyle.Color = System.Drawing.Color.Black; 
            borderStyle.LineStyle = LineStyle.Continuous; 
            borderStyle.Weight = 1.0; 
        foreach (Telerik.Web.UI.GridExcelBuilder.StyleElement style in e.Styles) 
            foreach (BorderStyles border in borders) 

    I hope this helps.

    Best regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 20 Nov 2009 Link to this post

    You the man for Ban, Dan!  (sorry, couldn't help myself...)
Back to Top