Q:

Exporting to csv in German notation

I want to export my DataGrid objects to a CSV file, and let the user have the option to see German notation on values of type double. 
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
    foreach (DataGridViewColumn column in dgv1)
    {
        double val;
        if (double.TryParse(dr.Cells[column.Name].Value.ToString(), out val))
        {
            sw.Write(string.Format(System.Globalization.CultureInfo.GetCultureInfo("de-DE"), "{0:0.0}", val));
            sw.Write(",");
        }
    }
}

sw here is a new StreamWriter object.
I'm using the correct culture for this, however when I see the results, I see what should, for example, have been "18,54", is 18, and in the cell right next to it there is a 5, followed by a dot (.). What am I doing wrong in this code?

A:

Had the same problem once.
The value is split into two cells because the german numerical comma "," is just the seperator in a csv. What I did was use semicolon ";" as a seperator, and OpenOffice somehow did the right thing. (either automatically, or I specified the encoding on opening, can't remember).
Oh, and I just found this on wikipedia:
Year;Make;Model;Length
1997;Ford;E350;2,34
2000;Mercury;Cougar;2,38

The latter format is not RFC 4180 compliant. Compliance could be achieved by the use of a comma instead of a semicolon as a separator and either the international notation for the representation of the decimal mark or the practice of quoting all numbers that have a decimal mark.

So "1,2","3,4" should be correct.

