I am trying to output an excel workbook that I created else where in the program through a Response.Write() call.
The issue I am having is that when I call the Response.Write(); it shows the download dialog for the excel file which it is supposed, but when opened, it opens two docs, the excel file, and then another page doc, which has Microsoft.Interop.Excel.Workbook in cell one.
And to add to the fun, the incorrect excel doc is visible, where as the correct one is hidden until the incorrect file is closed. At which point the correct file shows up exactly where the incorrect one just was. Below is the code I am using.
Excel.Workbook exWB = rm.GenerateNewEnrollmentReport(students); Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=Report.xls"); Response.Write(exWB); Response.End();
If anyone has any thoughts, I would be glad to hear them!