exporttocsv with option EncloseDataWithQuotes in winforms

2 posts, 0 answers
  1. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 10 Jan 2013 Link to this post

    Hello Team

    I got a strange problem with winform  gridview  when exported to .csv , it exported the gridview data to .csv with enclosed quotes,

            "1"     "12.01" "22.01" "33.768"        "2.12344"       "5655.34"
            "1"     "13.01" "23.01" "34.768"        "2.12344"       "5656.34"
            "1"     "14.01" "24.01" "35.768"        "2.12344"       "5657.34"
            "1"     "15.01" "25.01" "36.768"        "2.12344"       "5658.34" 

     i observed that in ASP.NET AJAX gridview there is an option called EncloseDataWithQuotes =True/False, with this we can eliminate the enclosed quotes in the csv

    if winforms gridview also have the same property please tell me where i need to set it???, i checked in the below link, but there is no option to set


    due to the quotes in the data, i couldnt import to mySql database, please suggest the way to eliminate the quotes in .csv file
    here is my code to export to .csv

                     ExportToCSV exporter = new ExportToCSV(this.radGridView1);              
                     string fileName = "C:\\ExportedData.csv";              

  2. Plamen
    Plamen avatar
    132 posts

    Posted 14 Jan 2013 Link to this post

    Hi Lakshmi,

    Thank you for writing.

    Currently, we do not support a property EncloseDataWithQuotes. A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text format. The data must be processed before they are being displayed. CSV is a delimited text file that uses a comma to separate values. You could read more about the CSV format here: http://en.wikipedia.org/wiki/Comma-separated_values.

    As to the problem at hand, I have added this as a feature request. You can track the status of the item in our Public Issue Trucking System at the following location: http://www.telerik.com/support/pits.aspx#/public/winforms/13980.

    I have updated your Telerik Points for this request.

    Here is a sample method which removes the quotes from the CSV file:
    string[] text = System.IO.File.ReadAllLines("C:\\ExportedData.csv");
    for (int i = 0; i < text.Length; i++)
        text[i] = text[i].Replace("\"", "");
    System.IO.File.WriteAllLines("C:\\ExportedData.csv", text);

    I hope this helps.

    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top