Hello there,
Hi,
Thanks for your posting and using Aspose.Cells.
Please try the following code and see if it fixes your issue.
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();
Thank you for your reply.
var
book = new Aspose.Cells.Workbook(MapPath(“book1.xlsx”));
MemoryStream ms = new MemoryStream(); book.Save(ms,
Aspose.Cells.SaveFormat.Excel97To2003); this.Response.ContentType
= “application/vnd.ms-excel”; this.Response.AddHeader(“content-disposition”,
“attachment; filename=sample.xls”); this.Response.AddHeader(“Content-Length”,
ms.Length.ToString()); this.Response.BinaryWrite(ms.ToArray());
this.Response.End(); <o:p></o:p>
Hi Janaka,
Thanks for your posting and using Aspose.Cells.
It is good to know that you were able to sort out this issue. We also recommend you to upgrade your code to newer version so that you could make use of new features, enhancements and bug fixes. Let us know if you encounter any other issue, we will be glad to look into it and help you further.