日期:2014-05-17 浏览次数:20440 次
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10; i++)
sb.AppendFormat("序号:{0},姓名:{1},年龄:{2},性别:{3}\r\n",i +1, i+1, i + 20, i % 2 == 0 ? "男" : "女");
System.IO.StreamWriter sw = new System.IO.StreamWriter("c:\\excel.csv",false,System.Text.Encoding.Default);
sw.Write(sb.ToString());
sw.Close();