输出stringbuilder字串,并保存到excel中.如何弄?
如题..构造stringbuilder字串,
并以*.xls的文件格式保存到指定目录,怎么做?
谢谢.
[解决办法]
请详细表达你的意图!
[解决办法]
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();