c# - Unable to remove hyperlink from dynamic generated HTML during export to excel -
i want remove hyperlink dynamic generated html during export excel. tried lot googling still not find solution. code
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();
i changed code from
httpcontext.current.response.write(tw.tostring()); httpcontext.current.response.write(regex.replace(tw.tostring(), "</?(a|a).*?>", ""));
and works fine me. solution of question
Comments
Post a Comment