Asp.net - Output Excel Sheet from Memory Stream
This will allow the user to save the excel doc from the web.
MemoryStream ms = new MemoryStream();
//use whatever to save the excel workbook data to the memorystream
byte[] array = ms.ToArray();
Response.Clear();
Response.ContentType = "application/xlsx";
Response.AddHeader("Content-Disposition", "attachment; filename=test.xlsx");
Response.BinaryWrite(array);
Response.Flush();
Response.Close();
Response.End();
MemoryStream ms = new MemoryStream();
//use whatever to save the excel workbook data to the memorystream
byte[] array = ms.ToArray();
Response.Clear();
Response.ContentType = "application/xlsx";
Response.AddHeader("Content-Disposition", "attachment; filename=test.xlsx");
Response.BinaryWrite(array);
Response.Flush();
Response.Close();
Response.End();
Comments
Post a Comment