title: Export Rich Text to plain text c#
body: <p>Good day to Stackoverflow community,</p>
  
  <p>I am in need of some expert assistance. I have an MVC4 web app that has a few rich text box fields powered by TinyMCE. Up until now the system is working great. Last week my client informed me that they want to export the data stored in Microsoft SQL to Excel to run custom reports.</p>
  
  <p>I am able to export the data to excel with the code supplied. However it is exporting the data in RTF rather than Plain text. This is causing issues when they try to read the content.</p>
  
  <p>Due to lack of knowledge and or understanding I am unable to figure this out. I did read that it is possible to use regex to do this however I have no idea how to implement this. So I turn to you for assistance.</p>
  
  <pre><code>public ActionResult ExportReferralData()
      {
          GridView gv = new GridView();
          gv.DataSource = db.Referrals.ToList();
          gv.DataBind();
          Response.ClearContent();
          Response.Buffer = true;
          Response.AddHeader("content-disposition", "attachment;    filename=UnderwritingReferrals.xls");
          Response.ContentType = "application/ms-excel";
          Response.AddHeader("Content-Type", "application/vnd.ms-excel");
          Response.Charset = "";
          Response.Cache.SetCacheability(HttpCacheability.NoCache);
          StringWriter sw = new StringWriter();
          HtmlTextWriter htw = new HtmlTextWriter(sw);
          gv.RenderControl(htw);
          Response.Output.Write(sw.ToString());
          Response.Flush();
          Response.End();
  
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>I would really appreciate any assistance. and thank you in advance.</p>
  
  <p>I have looked for solutions on YouTube and web forums with out any success.
  Kind Regards
  Francois Muller</p>