Excel found unreadable content in "xxxxxx.xlsx"

Feb 22, 2013 at 1:23 PM
Hi Guys, I am using following code to write the DATATABLE into ExcelSheet.
Public Shared Sub DumpExcel(ByVal dr As SqlDataReader, ByVal filename As String)
        Dim tbl As New DataTable
        Using pck As New OfficeOpenXml.ExcelPackage()
            'Create the worksheet
            Dim ws As OfficeOpenXml.ExcelWorksheet = pck.Workbook.Worksheets.Add(filename)

            'Load the datatable into the sheet, starting from cell A1. Print the column names on row 1
            ws.Cells("A1").LoadFromDataTable(tbl, True)

            'Write it back to the client
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            HttpContext.Current.Response.AddHeader("content-disposition", String.Format("attachment;  filename={0}.xlsx", filename))
        End Using
End Sub
But I am getting following error :
Excel found unreadable content in "xxxxxx.xlsx". Do you want to recover the contents of this workbook?

Mar 14, 2013 at 8:13 PM
I think you are missing