Hello,
This is the code I am using to download the excel file(generated by aspose).
var workbook = … //Workbook that is created by Aspose
var excelMemoryStream = new MemoryStream();
excelMemoryStream = workbook.SaveToStream();
workbook.Save(excelMemoryStream, SaveFormat.Xlsx);
excelMemoryStream.Seek(0, SeekOrigin.Begin);
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StreamContent(excelMemoryStream);
result.Content.Headers.ContentType = new MediaTypeHeaderValue(“application/force-download”);
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(“attachment”);
result.Content.Headers.ContentDisposition.Name = “formName”;
result.Content.Headers.ContentDisposition.FileName = “Report.xlsx”;
I am able to download the excel to my PC but when I open it I get an error(refer attachment).
This does not happen with Xls file format. I need to have the file saved in Xlsx format as it has a higher row limit than Xls file format.
Thanks,
Suraj