【发布时间】:2013-10-24 15:56:37
【问题描述】:
我正在使用以下代码成功地将 html 表导出到 excel 文件
public void exportGridToExcel(Control ctl)
{
string attachment = "attachment; filename=etrack_excel_export.xls";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.ContentType = "application/ms-excel";
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
ctl.RenderControl(htextw);
HttpContext.Current.Response.Write(stw.ToString());
HttpContext.Current.Response.End();
}
问题是导出后我应用于表格的所有css在excel文件中都丢失了,如何防止css丢失?
【问题讨论】:
标签: c# asp.net css export-to-excel