0
我想在導出到Excel的過程中從動態生成的HTML中刪除超鏈接。 我試了很多谷歌搜索,但我仍然找不到解決方案。 我的代碼是無法從導出到Excel的動態生成的HTML中刪除超鏈接
string CompanyName = string.Empty;
CompanyName = Session["CompanyName"].ToString();
CompanyName = CompanyName.Replace(" ", "_");
string FileName = CompanyName.Trim() + "-Weekly_CashFlow_Statement_" +
DateTime.Now.ToString("ddMMyyyyhhmmss") + ".xls";
HttpContext.Current.Response.AppendHeader(
"Content-Disposition",
"attachment; filename=" + FileName);
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/ms-excel";
this.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
tblCashFlow.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();