title: Export to Excel from a Repeater?
body: <p>Right now I am using this to export a repeater (with multiple nested repeaters) to excel:</p>
  
  <pre><code>protected void ExportToExcel(object sender, EventArgs e) 
  {     
  Response.Clear();
  Response.Buffer = true;
  Response.AddHeader("content-disposition", "attachment;filename=finance.xls");
  Response.Charset = ""; 
  Response.ContentType = "application/vnd.ms-excel"; 
  System.IO.StringWriter stringWrite = new System.IO.StringWriter(); 
  System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); 
  rptMinistry.RenderControl(htmlWrite); 
  Response.Write(stringWrite.ToString()); 
  Response.End(); 
  }
  </code></pre>
  
  <p>But this is not doing what I want.  Instead it is giving me html in the excel file (though the data is there) this is what I get (each line is a cell in the excel sheet):</p>
  
  <pre><code>&lt;tr class="alt"&gt;
   &lt;td class='hidden'&gt;LOR In Development&lt;/td&gt;
   &lt;td&gt;MOD&lt;/td&gt;
   &lt;td&gt;Air Force&lt;/td&gt;
   &lt;td class="size1"&gt;&lt;/td&gt;
   &lt;td&gt;Hellfire (AGM-114) Follow On&lt;/td&gt;
   &lt;td&gt;10-Mar-08&lt;/td&gt;
   &lt;td class="align_right "&gt;$50,000,000.00&lt;/td&gt;
   &lt;td class="align_right hidden"&gt;$0.00&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr class="alt"&gt;
   &lt;td class='hidden'&gt;LOR In Development&lt;/td&gt;
   &lt;td&gt;MOD&lt;/td&gt;
   &lt;td&gt;Air Force&lt;/td&gt;
   &lt;td class="size1"&gt;&lt;/td&gt;
   &lt;td&gt;Precision Strike Mi-17 (block 20)&lt;/td&gt;
   &lt;td&gt;17-May-08&lt;/td&gt;
   &lt;td class="align_right "&gt;$20,100,000.00&lt;/td&gt;
   &lt;td class="align_right hidden"&gt;$0.00&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>and so on... now the data is correct, but how can I get it to show up correctly in the spreadsheet?</p>