码迷,mamicode.com
首页 > Web开发 > 详细

asp.net excel模板下载

时间:2015-04-12 01:22:01      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

string filePath = Server.MapPath("~/model/模板.xls");//路径
FileInfo fileInfo = new FileInfo(filePath);
System.Web.HttpContext.Current.Response.Charset = "GB2312";
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("模板.xls", System.Text.Encoding.UTF8).ToString());
System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
System.Web.HttpContext.Current.Response.WriteFile(fileInfo.FullName);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.End();

asp.net excel模板下载

标签:

原文地址:http://www.cnblogs.com/lihaishu/p/4418843.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!