When creating an Excel spreadsheet using the Open XML SDK v2.0, our Excel output initially worked successfully for a number of months. Recently Excel (all versions) began to com
Check the following one by one to remove "Unreadable content error" from excel.
1.Ensure that the correct data written in correct cell in correct way. do it for all the cells.It might happen that wrongly written data in once cell causing this issue.Cell index is used correctly.
2.Try using Cell.DataType = new EnumValue(CellValues.String) instead of shared string.this may help to remove the error.
3.if any cell contain #VALUE/#REF/#NAME? or #DIV error,remove those error .
4.This issue comes up while downloading the file from server. Creating excel spreadheet in a web application, using a MemoryStream and downloading the same.
use the following code: HttpContext.Current.Response.Clear()
Response.ClearHeaders()
Response.Buffer = False
msReportStream = CType(controller.GetFromSession
(Constants.SESSION_REPORT), MemoryStream)
Response.ContentType = "application/vnd.openxmlformats-
officedocument.spreadsheetml.sheet"
Response.AddHeader("Connection", "Keep-Alive")
Response.AddHeader("Content-Disposition", String.Format("attachment;
filename={0}", strReportFileName))
Response.ContentEncoding = Encoding.UTF8
Response.BinaryWrite(msPNLReportStream.ToArray())
Response.Flush()
Response.Close()
Response.End()--use this when the code is deployed in server only not required in local.gives error in local.
msReportStream.Dispose()
msReportStream.Close()
if you are using ASPOSE technology,use
Me.Response.Clear()
Me.Response.Buffer = False
Me.Response.AddHeader("Accept-Ranges", "bytes")
Response.ContentType = "application/octet-stream"
Response.AddHeader("Connection", "Keep-Alive")
Response.ContentEncoding = Encoding.UTF8
asposeReport.ShowSavePopUp(Me.Response, controller.GetFromSession(Constants.SESSION_REPORT), strReportFileName)
Me.Response.Flush()
Me.Response.Close()
Me.Response.End()