Export to Excel/CSV Problem text converted to date

6 posts, 0 answers
  1. Jose
    Jose avatar
    15 posts
    Member since:
    Feb 2011

    Posted 08 Jun 2012 Link to this post

    Hi:
    My radgrid have a text column with values 1/2, LARGE, MEDIUM..etc
    When I export the grid to excel or csv the value LARGE, MEDIUM show up fine..
    BUT
    1/2 values are exported as 2-Jan and if you click in the actual cell the value showed is 1/1/2012
    I try setting the column to datatype to System.String, but same results.

    Jose

     

     

     

     

     

     

     

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 09 Jun 2012 Link to this post

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. wnl
    wnl avatar
    106 posts
    Member since:
    Aug 2007

    Posted 29 Oct 2012 Link to this post

    I have the same problem.
    I tried to use: e.Cell.Style["mso-number-format"] = @"\@";
    but same results.
    Any suggestions?
  5. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 31 Oct 2012 Link to this post

    Hi,

    You could check out this forum post and also this help article which elaborate on this matter. Test the provided approaches and if the issue still persist you could open a support ticket and send us a runnable project in order to observe the issue locally.

    Kind regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Jose
    Jose avatar
    15 posts
    Member since:
    Feb 2011

    Posted 31 Oct 2012 Link to this post

    the problem still there.
    when I export to excel the radgrid column with "1/2" value is exported to excel as "1/1/2012" (as a date)

    Jose
  7. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 05 Nov 2012 Link to this post

    Hi Jose,

    I prepared a sample with two RadGrids. The first grid export the value "1/2" as number, and the second one export it as a date. I used the following code:
    protected void RadGrid1_ExportCellFormatting(object sender, ExportCellFormattingEventArgs e)
    {
        if (e.FormattedColumn.UniqueName == "Number")
        {
            e.Cell.Style["mso-number-format"] = @"\@";
        }
     
    }

    Check out the attached project.

    All the best,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017