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

    Hi,
    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.

    Thanks
    Ban
  2. Daniel
    Admin
    Daniel avatar
    4943 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; 
            borders.Add(borderStyle); 
        } 
     
        foreach (Telerik.Web.UI.GridExcelBuilder.StyleElement style in e.Styles) 
            foreach (BorderStyles border in borders) 
                style.Borders.Add(border); 

    I hope this helps.

    Best regards,
    Daniel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. 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