Radgrid Export to Excel Column width

3 posts, 0 answers
  1. Eric
    Eric avatar
    13 posts
    Member since:
    Aug 2010

    Posted 08 Aug 2018 Link to this post


    We need to set the column width in export to excel file. Currently, its fit the width by using its Header Text. We need to customize it like in grid we have 50px column width but when we export to excel we want to set 20px. How can we achieve the goal? Any sample application would be appreciated.

  2. Eyup
    Eyup avatar
    4074 posts

    Posted 13 Aug 2018 Link to this post

    Hello Eric,

    Supposing that you are using the following Excel export format:
        <Excel Format="Xlsx" />

    You can use the following approach to achieve this requirement:
    protected void RadGrid1_PreRender(object sender, EventArgs e)
        if (RadGrid1.IsExporting)
            foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
                if (col.UniqueName == "ShipCountry")
                    col.HeaderStyle.Width = 500;

    I hope this will prove helpful.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Sharamae
    Sharamae avatar
    1 posts
    Member since:
    Aug 2018

    Posted 13 Aug 2018 in reply to Eric Link to this post

    Hi Eric! Try using the Zetexcel. It's a very powerful tool for this. You may google it.
Back to Top