DataView Export To Excel 2003
Response.Clear();
        Response.Buffer 
= true;
        Response.Charset 
= "GB2312";
        Response.AppendHeader(
"Content-Disposition""attachment;filename=New Excel.xls");
        
// 如果设置为 GetEncoding("GB2312");导出的文件将会出现乱码!!!
        Response.ContentEncoding = System.Text.Encoding.UTF7;
        Response.ContentType 
= "application/ms-excel";//设置输出文件类型为excel文件。 
        System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter oHtmlTextWriter 
= new System.Web.UI.HtmlTextWriter(oStringWriter);
        
this.GridView1.RenderControl(oHtmlTextWriter);
        Response.Output.Write(oStringWriter.ToString());
        Response.Flush();
        Response.End();

 

 

相关文章:

  • 2021-08-13
  • 2021-08-15
  • 2021-11-20
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2021-05-19
  • 2021-07-15
猜你喜欢
  • 2021-05-24
  • 2021-10-16
  • 2022-12-23
  • 2021-12-31
  • 2021-10-28
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案