首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

asp.net将网页的table导出到excel跟word

2012-08-11 
asp.net将网页的table导出到excel和word.table的td是一个个 绑定数据的label.要导出这些数据.百度到的大多

asp.net将网页的table导出到excel和word.
table的td是一个个 绑定数据的label.要导出这些数据.
百度到的大多数用gridview之类的控件.
自己的写了个
 protected void btnExcel_Click(object sender, EventArgs e)
  {
  Response.Clear();
  Response.Buffer = true;
  Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyyMMdd") + ".xls");
  Response.ContentEncoding = System.Text.Encoding.UTF8;
  Response.Charset = "GB2312";
  Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
  Response.ContentType = "application/vnd.ms-excel";
   
  }
下载时候显示是xls,下到电脑就变成aspx的.
求助.

[解决办法]
现在服务器端保存成一个临时文件,然后把文件发送到客户端(类似下载) 不可以么
[解决办法]
这种方案似乎比较复杂
[解决办法]
response.end一下看看

热点排行