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

Exporting to CSV without "" around each column

4 Answers 473 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 26 Jul 2010, 10:56 PM
Hi;
I need to export the content of a grid as a flat CSV where each column is separated  a coma {,} without the addition of Double quote "..." around each column. How can I tell the RADGridView not to add the Double Quote?
Thanks!
..Ben

4 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 27 Jul 2010, 01:43 PM
Hello ..Ben,

 There is a good reason why columns have quotes around them, and that's because there's no guarantee that the cell delimiter won't be part of a data cell (for instance, if your delimiter is a comma and you're exporting numbers formatted for some European culture, whose decimal point is actually a decimal comma).

However, you can still get rid of the quotes very easily. Instead of exporting directly to a FileStream, export to a MemoryStream, read that into a string, strip all quotes, then save the resulting string in the FileStream. It is a little roundabout, I know, but we do not plan to allow exporting without quotes.

Sincerely yours,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ben Hayat
Top achievements
Rank 2
answered on 27 Jul 2010, 02:26 PM
Hi Yavor;

I agree 100% to delimit the fields with double quotes. That's how I've used it in many platforms, however this CSV file is a source file to an outside (command line) software that users uses for their operation and that software does not support the double quote.
Any chance you can provide a sample with the solution you offered?
Thanks!
0
Accepted
Yavor Georgiev
Telerik team
answered on 27 Jul 2010, 02:43 PM
Hello ..Ben,

 Please find attached a sample solution.

Best wishes,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ben Hayat
Top achievements
Rank 2
answered on 27 Jul 2010, 02:50 PM
Thank you very much for speedy response Yavor!
..Ben
Tags
GridView
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Yavor Georgiev
Telerik team
Ben Hayat
Top achievements
Rank 2
Share this question
or