Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Tue Nov 14, 2017 7:43 pm

I ACIEVED THIS IN open doc xml. Want to do the same with SPIRE xls. Is this possible? Need to have a dialog like open, save and save as as code below does.


HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + fname + "_" + today.ToString("yyyyMMddhhmmss") + ".xlsx");
using (MemoryStream MyMemoryStream = new MemoryStream())
{
wb.SaveAs(MyMemoryStream);
MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();

}

mguha
 
Posts: 11
Joined: Thu Nov 09, 2017 8:54 pm

Wed Nov 15, 2017 2:53 am

Hello,

Thanks for your inquiry. Please refer to the below code snippet to save document to HttpResponse.
Code: Select all
            Workbook wb = new Workbook();
            wb.Version = ExcelVersion.Version2010;
            wb.SaveToHttpResponse("result.xlsx",Response, HttpContentType.Excel2010);


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.XLS