我正在寻找一种在CSV文件的不同单元格中编写字符串的方法。使用C#编写CSV文件
我使用这个程序,
private void button1_Click(object sender, EventArgs e)
{
string filePath = @"E:\test.csv";
string a = "a";
string b = "c";
string c = "d";
string d = "d";
File.WriteAllText(filePath, a);
// how can add the other strings in the next cells ?
}
我需要在这里是写在第二单元“一”中的第一个单元格,“B”,C ..
CSV的问题在于没有固定的格式(依赖于文化),有些应用程序使用它们自己的实现。然而,每个实施都相对简单。有关更多信息,请参阅http://en.wikipedia.org/wiki/Comma-separated_values。 – 2011-05-05 18:27:39
是否可以使用Excel文件? – 2011-05-05 18:31:42
我用.xls尝试过,但结果相同吗? – 2011-05-05 18:33:32