输出word文件中文乱码问题解决打包下载

时间:2014-05-29 08:54:06
【文件属性】:
文件名称:输出word文件中文乱码问题解决打包下载
文件大小:208KB
文件格式:RAR
更新时间:2014-05-29 08:54:06
输出word文件,中文乱码,打包下载 在输出文件地地方使用的代码: string path = request.PhysicalPath;//获取客户端请求的文件的物理地址 if (File.Exists(path)) { string fileName = System.IO.Path.GetFileName(path); // 获取文件的名字 if (Request.UserAgent.Contains("MSIE") || Request.UserAgent.Contains("msie")) { // 如果客户端使用 Microsoft Internet Explorer,则需要编码 fileName = ToHexString(fileName); // 如果使用 fileName =Server.UrlEncode(fileName); 则会出现上文中出现的情况 } Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName); Response.WriteFile(path); Response.End(); }
【文件预览】:
WebWord
----App_Code()
--------WordPlayer.cs(16KB)
--------BiultReportForm.cs(5KB)
--------SpecifiedFileHandler.cs(8KB)
----Download.aspx(101B)
----Web.Config(2KB)
----App_Data()
--------Doc_Template.txt(8KB)
----Default.aspx(936B)
----msdn.jpg(2KB)
----Default.aspx.cs(7KB)
----c_生成的word文档的方法.txt(4KB)
----Template.html(8KB)
----download.txt(3KB)
----项目四 铜线接入网(教案)emo.doc(91KB)
----~$myword.doc(162B)
----Download.aspx.cs(2KB)
----Bin()
--------Microsoft.Office.Interop.Word.dll(886KB)

网友评论