Exporting to CSV without "" around each column

5 posts, 1 answers
  1. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 26 Jul 2010 Link to this post

    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
  2. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 27 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 27 Jul 2010 Link to this post

    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!
  5. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 27 Jul 2010 Link to this post

    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
  6. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 27 Jul 2010 Link to this post

    Thank you very much for speedy response Yavor!
    ..Ben
Back to Top
DevCraft banner