Search code examples
excelexport-to-excel

Excel Export Blank Sheet Problem


I've had some code that has worked for years to export an html table to Excel. It goes like this-

private void ExcelExport ( string core_number )
    {
      // set response up for excel export
      Response.Clear ();
      Response.Buffer = true;
      Response.ContentType = "application/vnd.ms-excel";
      Response.AddHeader ( "content-disposition", "attachment;filename=TEST.xls" );

 .. loops through generates an simple html table ...


   Response.Write ( "</table>" );
   Response.Flush ();
   Response.End();
}

I noticed Firefox now shows the file as an XML document instead of a Excel document, and when I open the generated document it will parse fail. Also some users report having export problems in some older versions of IE, even though I'm not having any problems in IE on my end (shows as an Excel document and opens properly).

Anyone seen this one before? Thanks for your time.


Solution

  • didn't find an answer, but worked around it for now.