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

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Schneier on Security
The Last Watchdog
The Last Watchdog
Cyberwarzone
Cyberwarzone
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
The Cloudflare Blog
V
V2EX
博客园_首页
博客园 - 聂微东
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
G
GRAHAM CLULEY
T
Tenable Blog
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
L
LINUX DO - 最新话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
SecWiki News
SecWiki News
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
T
Troy Hunt's Blog
博客园 - 【当耐特】
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
A
About on SuperTechFans
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
D
DataBreaches.Net
P
Privacy & Cybersecurity Law Blog
Schneier on Security
Schneier on Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
D
Docker
P
Proofpoint News Feed

博客园 - 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();