首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

Response.TransmitFile(filename)不能下载docx?该如何解决

2013-08-16 
Response.TransmitFile(filename)不能下载docx?我写个一个下载功能,下载doc文件的时候正常,下载docx的时候

Response.TransmitFile(filename)不能下载docx?
我写个一个下载功能,下载doc文件的时候正常,下载docx的时候报错:打开文件错误,需要设置什么地方使它兼容office2003和office2007吗?
代码如下:


 string strFileName = str.Split(',')[0];
                    Response.ContentType = "application/x-zip-compressed";
                    //Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
                    string filename = Server.MapPath(strFileName);
                    string name = str.Split(',')[1];
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlPathEncode(name));

                    //Server.UrlPathEncode()解决文件名的乱码问题.

                    Response.TransmitFile(filename);

[解决办法]
期待高手出现。。。
[解决办法]
...本来还想贴代码的!
[解决办法]
做过word转换html没?楼主

热点排行