如题~
解决方案 »
- HtmlTextWriter中TagKey默认值是<span></span>,如何把<span>标签去掉?
- [请教]bitmap无故自动刷新?
- tcpclient 如何知道客户端掉线?
- "System.Xml.XmlException: 根级别上的数据无效。
- 打开Microsoft Visual Studio时,出现"帮助正在更新,以反映最近所做的更改。这可能需要几分钟的时间。"....
- 可能是简单的字符串问题
- WPF,该如何理解ActualWidth属性
- 为什么我在修改word文字型窗体域时其标签会消失(有点难哦)
- 请问在winform下固定DataGrid的列用什么方法?
- 正式版和beta 2的区别?
- DataGridView总是变换大小问题
- 关于ADO.NET提问
Interop.Microsoft.Office.Core.dll
DataTable dt=ds.Tables[0];
StringWriter sw=new StringWriter();
sw.WriteLine("货品单号,货品名称,货品数量,货品价格,提供商,货品仓库,付款方式,够入部门,够入时间,操作人,状态");
foreach(DataRow dr in dt.Rows)
{
sw.WriteLine(dr["danhao"]+","+dr["capname"]+","+dr["total"]+","+dr["price"]+","+dr["offername"]+","+dr["Wname"]+","+dr["paytype"]+","+dr["deptname"]+","+dr["indate"]+","+dr["operator"]+","+dr["Fname"]);
}
sw.Close();
Response.AddHeader("Content-Disposition","attachment;filename=gdzc.csv");
Response.ContentType="application/ms-excel";
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");
Response.Write(sw);
Response.End();
System.IO;
Excle里面吗??
学习一下
打开excel模板,赋值给单元格,导出eccel就可打印
http://www.cnblogs.com/zpylh/articles/1281048.html
http://www.cnblogs.com/KissKnife/archive/2007/02/28/660147.html