1
Vote

EPPlus 4.1.0 Excel Unreadable content issue

description

Hi Team,

Basically i am building Dynamic Excel using EPPlus 4.1.0. The problem am facing is when i download the excel and click open. Its throwing error as "Excel found unreadable content in .xlsx. Do you want to recover the contents of this workbook? If you trust the source of this workbook,click Yes"

I am using below steps to generate excel :
  1. Creating new Excel Package -- ExcelPackage ex = new ExcelPackage()
  2. Creating new worksheet -- ExcelWorksheet ws = ex.Workbook.Worksheets.Add("Demo");
  3. Working on that worksheet -- Content,alignment,coloring etc..
  4. Saving the response
            ex.Save();
            Response.Clear();
            Response.ClearHeaders();
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment;  filename=ExcelDemo.xlsx");
            Response.BinaryWrite(ex.GetAsByteArray());
            Response.End();
    5.On click of Download, ill get options to save open etc. When i select Open,it throws the above error.
    This error not happening in EPplus3. versions. But we need to use latest versions for building dynamic excel data with formatting in it.
Any way to resolve this issue would be of great help.

Kindly suggest.

Thanks,
Anand

file attachments

comments