Response.TransmitFile(filename)不能下载docx?该如何解决
Response.TransmitFile(filename)不能下载docx?
我写个一个下载功能,下载doc文件的时候正常,下载docx的时候报错:打开文件错误,需要设置什么地方使它兼容office2003和office2007吗?
代码如下:
------解决方案--------------------
期待高手出现。。。
------解决方案--------------------
...本来还想贴代码的!
------解决方案--------------------
做过word转换html没?楼主
我写个一个下载功能,下载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没?楼主