This is a migrated thread and some comments may be shown as answers.

Export to Excel/CSV Problem text converted to date

5 Answers 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 2
Jose asked on 08 Jun 2012, 07:35 PM

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

 

 

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Jun 2012, 06:22 PM
0
wnl
Top achievements
Rank 1
answered on 29 Oct 2012, 02:36 PM
I have the same problem.
I tried to use: e.Cell.Style["mso-number-format"] = @"\@";
but same results.
Any suggestions?
0
Kostadin
Telerik team
answered on 31 Oct 2012, 01:10 PM
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.
0
Jose
Top achievements
Rank 2
answered on 31 Oct 2012, 01:41 PM
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
0
Kostadin
Telerik team
answered on 05 Nov 2012, 08:59 AM
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.
Tags
Grid
Asked by
Jose
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
wnl
Top achievements
Rank 1
Kostadin
Telerik team
Jose
Top achievements
Rank 2
Share this question
or