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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -