DataTable数据导出生成Excel文件
示例ASP.NET把DataTable数据导出生成Excel文件源码: C# Code [http://www.xueit.com] DataTable dt = wad.GetToExcel(lblcode.Text);StringWriter sw = new StringWriter();sw.WriteLine( " 代号,货品编码,货品名称,单位,净需求量
示例ASP.NET把DataTable数据导出生成Excel文件源码:

DataTable dt = wad.GetToExcel(lblcode.Text); StringWriter sw = new StringWriter(); sw.WriteLine("代号,货品编码,货品名称,单位,净需求量,采购量,供应商,下单日期,到货日期,采购员,报关,状态,采购订单号"); foreach (DataRow item in dt.Rows) { //string state = (OPSState)Convert.ToInt32(item["imgstate"]); sw.WriteLine(item["code"] "," item["goodscode"] "," item["goodsname"] "," item["unit"] "," item["netdemand"] "," item["shoppingnum"] "," item["tradername"] "," item["orderdate"] "," item["arrivaldate"] "," item["buyername"] "," item["ifcustoms"] "," (OPSState)Convert.ToInt32(item["imgstate"]) "," item["ordercode"] ); } Response.AddHeader("Content-Disposition", "attachment; filename=test.csv"); Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.Write(sw); sw.Close(); Response.End();
收藏文章
精彩图集
精彩文章
- 暂无记录。
热门标签
诊断信息
dblink
多个文件
jsp虚拟主机
sql查询表
IIS
开发
php php从N个
context
网站
mysql-bin.in
权限
netsh
闪动提示
xp_cmdshell
XMLHttpReque
enter事件
PHP防XSS
delete[]
双引号
then
内存泄漏
暴力算
实参
java实现验证码
安全性
AttributeErr
php ph
jintellitype
系统重装
人物
main函数
比较器
socket端口
组合框
后台发送短信
opensips
多线程采集
单链表
PHP PHP通过Luh
mybatis拦截器
自定义图片
丢失
PHP静态类
键盘按键监听
账号
交叉表查询
转化函数
加速器
鼠标框选
虚拟表
wifi开发
扫描端口
端口例外
字符串去重
组合模式
弹出位置
系统时间
margin-top
100以内的素数
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229