My Blog is my notepad, I want to mark my work anytime, also i can share my harvest with everyone....

Teracy 's space--->

I love BS Develop ,So i am busying as a bee.Do more,Know more,you will get more.....

博客园 首页 新随笔 联系 订阅 管理

 Response.Clear(); 
   Response.Buffer= true; 
   Response.Charset=\"utf-8\"; //这个编码格式是输出为英语的,要支持中文的是\"GB2312\"; 

   //下面这行很重要, attachment 参数表示作为附件下载,您可以改成 online在线打开 
   //filename=FileFlow.xls 指定输出文件的名称,注意其扩展名和指定文件类型相符,可以为:.doc    .xls    .txt   .htm   

   Response.AppendHeader(\"Content-Disposition\",\"attachment;filename=FileFlow.xls\"); 
   Response.ContentEncoding=System.Text.Encoding.GetEncoding(\"utf-8\");   
   //Response.ContentType指定文件类型 可以为application/ms-excel    application/ms-word    application/ms-txt    application/ms-html    或其他浏览器可直接支持文档 
   Response.ContentType = \"application/ms-excel\"; 
   this.EnableViewState = false;   
利用ASP.NET输出指定内容的WORD、EXCEL、TXT、HTM等类型的文档很容易的。主要分为三步来完成。 


  一、定义文档类型、字符编码   

   Response.Clear(); 
   Response.Buffer= true; 
   Response.Charset=\"utf-8\";  


   //下面这行很重要, attachment 参数表示作为附件下载,您可以改成 online在线打开 
   //filename=FileFlow.xls 指定输出文件的名称,注意其扩展名和指定文件类型相符,可以为:.doc    .xls    .txt   .htm   

   Response.AppendHeader(\"Content-Disposition\",\"attachment;filename=FileFlow.xls\"); 
   Response.ContentEncoding=System.Text.Encoding.GetEncoding(\"utf-8\");   
   //Response.ContentType指定文件类型 可以为application/ms-excel    application/ms-word    application/ms-txt    application/ms-html    或其他浏览器可直接支持文档 
   Response.ContentType = \"application/ms-excel\"; 
   this.EnableViewState = false;   
利用ASP.NET输出指定内容的WORD、EXCEL、TXT、HTM等类型的文档很容易的。主要分为三步来完成。 

posted on 2007-05-03 18:23  Teracy  阅读(1216)  评论(0编辑  收藏  举报
One Two Three 向“前”走............
frontpage tracking
Sony Style Coupons