Format column in export Excel from radgrid.

5 posts, 0 answers
  1. aks
    aks avatar
    22 posts
    Member since:
    Apr 2008

    Posted 25 Jan 2012 Link to this post

    I am exporting a radgrid to Excel.  The columns are exporting, but the data is formatted incorrectly.  I am using OnExcelMLExportStylesCreated.  I would like to format a number column to include commas in the number (ex. 1,000) but with no decimals.  What am I doing wrong?  I've tried every number format type.

    Also, how do I format a date field to be MM/dd?

    Thanks in advance.

    protected void grdOpenItemsByJurisdiction_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
                StyleElement myStyle = new StyleElement("myCustomStyle");
                myStyle.NumberFormat.FormatType =  NumberFormatType.GeneralNumber;
                myStyle.NumberFormat.Attributes["ss:Format"] = "0";
                myStyle.FontStyle.Bold = true;

    protected void grdWorkItemsJurisdiction_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
                e.Row.Cells.GetCellByName("TotalItems").StyleValue = "myCustomStyle";
  2. aks
    aks avatar
    22 posts
    Member since:
    Apr 2008

    Posted 26 Jan 2012 Link to this post

  3. DevCraft R3 2016 release webinar banner
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Jan 2012 Link to this post


    You can style columns in ExcelExportCellFormatting  event. Check the following help documentation which explains more about this.
    Word/Excel export (HTML-based).

  5. khalid
    khalid avatar
    7 posts
    Member since:
    Jul 2015

    Posted 27 Jul 2015 in reply to Shinu Link to this post

    can you please give me full code for HTML based formating to Export. I have seen few lines of code but i need full export code. As some of my columns are populating online side means when open into browser then i can fill some columns.


  6. Eyup
    Eyup avatar
    2941 posts

    Posted 30 Jul 2015 Link to this post

    Hello Khalid,

    You can find an actual live sample here:

    Do you mean that you are creating the columns programmatically?

    Hope this helps. If you have different requirements or further instructions, please elaborate on your specific scenario and send us sample screenshots or video demonstrating the desired behavior.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft R3 2016 release webinar banner