asp.net中,,传递excel文件。。
如何设置头文件呢?Response.ContentType = "application/octet-stream ; name=" & filename
Response.Addheader ("Content-Disposition", "attachment; filename=" & filename )这样设置,,总是,将文本显示在excel中。。我该如何办呢???如何设置。高手请指点!!
如何设置头文件呢?Response.ContentType = "application/octet-stream ; name=" & filename
Response.Addheader ("Content-Disposition", "attachment; filename=" & filename )这样设置,,总是,将文本显示在excel中。。我该如何办呢???如何设置。高手请指点!!
解决方案 »
- 关于 Asp.net权限过滤器
- 如何获得客户端的IP
- css的问题??
- 重新加载的问题
- 30分求 如何用visio2003 进行软件开发的示例,图例!
- 函数返回值的类型可以是多种吗?
- 超难问题!!!!!!!!请问在asp.net 下如何 获得 相同name的文本框的值?????急!!!!!!!!
- 问一下今天大家的分数是不是都加了100分???我的分数由0一下子变成100分了
- 关于js的异步执行,希望大神帮忙看下
- 谁有ASP.NET实现的产品对比功能,求源代码,例子,急!!!!!!
- 用什么软件来测试asp.net程序的系统性能??包括 负载性能,在线人数最大承受,从数据库读取上万张帖子性能,服务器内存占用,速度如何
- 怎么连接MYSQL数据库
Response.ContentType = "application/octet-stream"
Response.ContentEncoding = System.Text.Encoding.GetEncoding("Shift-JIS")
Response.AddHeader("Content-Disposition", "attachment; filename=""" & fileName & """")自己搞定!!!
Response.Clear();
Response.Charset="GB2312";
Response.ContentEncoding=System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", file.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response.ContentType = "application/ms-excel";
// 把文件流发送到客户端
Response.WriteFile(file.FullName);
// 停止页面的执行
Response.End();