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

推荐订阅源

S
Secure Thoughts
S
Securelist
P
Proofpoint News Feed
D
DataBreaches.Net
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Project Zero
Project Zero
A
About on SuperTechFans
罗磊的独立博客
WordPress大学
WordPress大学
月光博客
月光博客
Latest news
Latest news
C
Cyber Attacks, Cyber Crime and Cyber Security
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Privacy International News Feed
AI
AI
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Help Net Security
Help Net Security
T
Tor Project blog
V
Vulnerabilities – Threatpost
C
Cisco Blogs
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MyScale Blog
MyScale Blog
雷峰网
雷峰网
MongoDB | Blog
MongoDB | Blog
Forbes - Security
Forbes - Security
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
T
Threat Research - Cisco Blogs
B
Blog RSS Feed
博客园 - 叶小钗
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Simon Willison's Weblog
Simon Willison's Weblog
C
CERT Recently Published Vulnerability Notes
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic

博客园 - wngwz

单点登陆 - wngwz - 博客园 IP地址 - wngwz - 博客园 金额转换.小To大 - wngwz - 博客园 简,繁体转换工具. 弹出模态窗体,关闭后。重新绑定页面(这个仅仅是对粗心大意的纪录) - wngwz - 博客园 分页存储过程 关于水晶报表的版本问题! 大年30祝大家, 不知道说还要GMail的油箱! 打印的一些知识! 求助!水晶报表! 收获!关于引用计数器! 把文件或图片存在数据库中! 水晶报表倒出! 关于(学习!Excel)的问题。 解决问题总结 水晶报表操作中遇到的问题 javascript 打印报表! javascript 学习
解决把水晶报表下载到客户端过程中,出现下载整个页面(.aspx)或者直接载web页中打开word文件的问题!
wngwz · 2004-11-23 · via 博客园 - wngwz

private void btnOutForWord_Click( object sender, System.EventArgs e )
        
{
            
if ( Session["reportname"!= null && Session[Session["reportname"].ToString()] != null )
            
{
                ReportDocument oRpt 
= new ReportDocument();
                oRpt 
= ( ReportDocument )Session[Session["reportname"].ToString()];
                crvMain.ReportSource 
= oRpt;    

                
//设置导出选项。
                ExportOptions myExp = new ExportOptions();

                myExp.ExportFormatType 
= ExportFormatType.WordForWindows;        //导出到Word格式
                
//myExp.ExportFormatType = ExportFormatType.Excel;                //导出到Excel格式
        
                
//myExp.ExportFormatType = ExportFormatType.PortableDocFormat;    //导出到Pdf格式

                
//定义导出内容
                ExportRequestContext myExpReq = new ExportRequestContext();
                myExpReq.ExportInfo 
= myExp;

                
//产生报表Stream
                Stream myReportStream;
                myReportStream 
= oRpt.FormatEngine.ExportToStream(myExpReq);
                Response.ClearHeaders();
                Response.ClearContent();

                Response.ContentType 
= "application/msword";
                Response.AddHeader(
"Content-disposition","attachment; filename=" + DateTime.Now.ToString("yyyyMMddhhssmm"+ ".doc");

                
//Response.ContentType = "application/vnd.ms-excel";
                
//Response.AddHeader("Content-disposition","attachment; filename=" + year.ToString() + "." + month.ToString() + ".xls");

                
//Response.ContentType = "application/pdf";
                
//Response.AddHeader("Content-disposition","attachment; filename=" + year.ToString() + "." + month.ToString() + ".pdf");

                
byte[] myReportByte = new byte[myReportStream.Length];
                myReportStream.Read( myReportByte,
0,(int)myReportStream.Length );
                Response.BinaryWrite( myReportByte );
                Response.Flush();
                Response.End();
            }

        }