惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
L
LangChain Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
博客园_首页
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
美团技术团队
V
V2EX

博客园 - cobbles

递归和迭代(Recursion and Iteration) 基本查找算法 位、字节、字长、频率、时钟周期、带宽 缓冲区 套接字同步与异步 原码、补码和反码 confluence [转]Groovy和Grails简介 [转]关于BI的一个故事 参考书目 [网址]db2管理 [转]用于数据仓库的 DB2 产品 [转]把GridView的内容输出到Excel的两点注意 访问IIS元数据库失败 [转]用javascript判断窗口关闭事件 asp调用Web Service Typed Vs. Untyped DataSets Typed DataSets in .NET Database Normalization Basics
将DataGrid生成excel word
cobbles · 2008-02-19 · via 博客园 - cobbles

将DataGrid生成excel:
  Response.Clear(); 
  Response.Buffer= true; 
  Response.Charset="GB2312";    
  Response.AppendHeader("Content-Disposition","attachment;filename=FileName.xls"); 
  Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
  Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 
  this.EnableViewState = false;    
  System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
  System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); 
  System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
  this.DataGrid1.RenderControl(oHtmlTextWriter); 
  Response.Write(oStringWriter.ToString());
  Response.End();

将DataGrid生成word:
   Response.Clear(); 
   Response.Buffer= true; 
   Response.Charset="GB2312";    
   Response.AppendHeader("Content-Disposition","attachment;filename=FileName.doc"); 
   Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
   Response.ContentType = "application/ms-word";//设置输出文件类型为word文件。 
   this.EnableViewState = false;    
   System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
   System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); 
   System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
   this.DataGrid1.RenderControl(oHtmlTextWriter); 
   Response.Write(oStringWriter.ToString());
   Response.End();