This project has moved and is read-only. For the latest updates, please go here.

EPPlus error with ajax request

Jun 30, 2015 at 11:52 AM
I cannot seem to get the download to work - I keep getting garbage.  Here is my code:
public void DumpExcel(DataTable dt, string fileName)
            using (ExcelPackage pck = new ExcelPackage())
                ExcelWorksheet ws = pck.Workbook.Worksheets.Add(fileName);
                ws.Cells["A1"].LoadFromDataTable(dt, true);
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Byte[] bytes = pck.GetAsByteArray();
                Response.AddHeader("content-disposition","attachment;filename=" + fileName + ".xlsx");
But I get illegal characters in the response. I want to show a screen shot of the result but cannot insert a picture here. Please help!
Jun 30, 2015 at 12:05 PM
You could always upload the screenshot to and linking it here.

Jun 30, 2015 at 1:47 PM
Jul 1, 2015 at 8:48 AM
You're requesting it via AJAX?

Try doing it via a normal form post or redirect...
It looks like AJAX is writing the byte[] down to text...