1

I'm generating an Excel report in C# and need to add a second tab to the Excel file that will contain reference data. How do I achieve this without using ClosedXML ?

Response.AddHeader("content-disposition", "attachment; filename=" + fname);
Response.ContentType = "application/vnd.ms-excel";
var writer = new System.IO.StringWriter();
var htmlTextWriter = new HtmlTextWriter(writer);
dataGrid.RenderControl(htmlTextWriter);
Response.Write(writer.ToString());
Response.End();
CodeSharp
  • 15
  • 4
  • 1
    You can't. All you are doing here is sending out HTML and expecting Excel to convert it for you. – DavidG Dec 22 '16 at 17:50

0 Answers0