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();
收藏文章
精彩图集
精彩文章
- 暂无记录。
热门标签
services
之二
sheet
u
spli
select刷新
BigDecimal类
hashlib模块
两位
getResponseC
符号
改变
php 一个简单
大型
linux开发经验
CCUserDefaul
透明窗体
点阵状
myanmar
Federated
getHeader
存储过程加密
vsftpd
nowdoc
浏览
垂直导航
基本类型
jquery遍历chec
renderPartia
strtr
val
Hacking
求n次方
图像方向
以斜杠结尾
gravity
图片滚动
游标
图片缩放
SQL触发器
database
多选下拉框
自动排序
资源调控器
CHTSli
格式化
kaptcha
0x80070005
图形
正版
写日志
引起
延时处
定时关机
链式二叉树
压缩样式表 p
python元组操
内连接
vmtools
ReflectionCl
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229