Displaying workbook in IE8

I am saving my completed workbook to a stream and then writing it to the response. In IE8 ONLY, the workbook is being corrupted.

Using

as As New MemoryStream()

wb.Save(ms, SaveFormat.Xlsx)

Dim bytes() As Byte = ms.ToArray()

response.ContentType =

“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”


response.AddHeader(“content-disposition”, “attachment; filename=” + rptType.ToString() + “.xlsx”)

response.OutputStream.Write(bytes, 0, bytes.Length)

response.End()

End Using

v

Hi,

Thanks for your posting and using Aspose.Cells.

Please use this code to save your file in XLS or in XLSX format in Response stream.

C#


//Save file and send to client browser using selected format
if (yourFileFormat == “XLS”)
{
workbook.Save(HttpContext.Current.Response, “output.xls”, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));

}
else
{
workbook.Save(HttpContext.Current.Response, “output.xlsx”, ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsx));
}

HttpContext.Current.Response.End();