通过流打开一个Excel文件
string templateExcel = "xxx.xls";
string path = Server.MapPath(@"Template\") + templateExcel; //路径
System.IO.FileInfo file = new System.IO.FileInfo(path);
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name));
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
string path = Server.MapPath(@"Template\") + templateExcel; //路径
System.IO.FileInfo file = new System.IO.FileInfo(path);
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name));
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();