我有一个返回 xls 文件的 asp.net mvc 操作:
公共无效Excel(字符串文件名) { DAOSolicitacao dao = new DAOSolicitacao(); System.Threading.Thread.Sleep(5000); var products = dao.GetSolicitacoes(); var grid = new GridView(); grid.DataSource = 产品; grid.DataBind(); Response.ClearContent(); 响应缓冲区=真; Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", filename)); Response.ContentType = "应用程序/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Output.Write(sw.ToString()); Response.Flush(); 响应。结束(); }
我怎样才能使这个 xls 文件返回到一个 zip 文件中?