最近这个项目中要用到导出报表到pdf文件的功能.在导出的过程中用到Response.AddHeader函数将http头添加到输出流的函数,即Response.AppendHeader("Content-Disposition", "attachment;filename=" + strfilename);这个时候,如果strfilename中含有中文字符,则在打开的文件保存对话框中文件名就是乱码,解决方法是将文件名进行url编码,即将如下写:

      Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode("报表统计.pdf"));

      这样就能保证文件保存时文件名不是乱码了.

相关文章:

  • 2021-12-27
  • 2021-08-11
  • 2021-11-09
  • 2022-01-20
  • 2021-06-14
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-01-15
  • 2021-05-15
  • 2021-10-24
相关资源
相似解决方案