服务器:win2000 server + iis5在客户端IE下载Office2007文件时在下载对话框中变成ZIP文件,按照网上资料解决方法新增MIME文件类型:.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation下载主要代码:Response.AddHeader("Content-Length", Sfile.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(SFilename)但还是解决不了问题!请高手指点
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation下载主要代码:Response.AddHeader("Content-Length", Sfile.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(SFilename)但还是解决不了问题!请高手指点
解决方案 »
- 留言本项目,里的【删除留言】,用jquery来实现删除后无刷新更新留言列表
- 弱弱的问下!谢谢
- 三层的问题!
- excel下载出现的问题
- 我用IBM的那个WS类,调.NET生成的WEB服务,怎么也不成功
- (急)求救啊,梅花雨日历控件问题,刷新后不能调用问题!
- 大家看看,当点击退出按钮的时候,ASPNET用什么命令可以清空COOKEI或者SESSION的用户名可以让WEB程序退出阿
- 请问DataSet用完后需要关闭吗?
- (100分求解)OWC使用进阶,如何在柱状图上添加线条图形?
- 一个简单的问题?
- localhost访问本地网站可以登录(读取到了cookie),而用IP地址192.168.0.*却登录不了 进者有分
- 将DataTable中的数据导出到指定的Excel文件中Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerParserErrorExcep
不用配置别的可以正常下载和打开
protected void Button1_Click(object sender, EventArgs e)
{
string SFilename = Server.MapPath(@"app_data/123.xls");
FileInfo Sfile = new FileInfo(SFilename); //Response.AddHeader("Content-Length", Sfile.Length.ToString());
//Response.ContentType = "application/octet-stream";
//Response.WriteFile(SFilename); Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + SFilename);
Response.AddHeader("Content-Length", Sfile.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(SFilename);
Response.Flush();
Response.End(); }
office2007 文件格式与以前做了很大的变化,是xml格式文件了,office2003前是二进制,
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation