1
我導出HTML表到excel文件成功地使用下面的代碼如何防止將某些html導出爲excel文件時丟失css?
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失蹤?
嗨,我面臨着同樣的問題,我試圖讀取丟失的CSS文件,像你這樣,但仍然得到同樣的錯誤:(任何建議? – Richa