
excellibrary - issue #92
How do I export the generated excel on the web app using asp.net/c#?
Question: How Do I export the in-memory Excel Workbook on the web page that will display Open/Save dialog box, without saving the file into file system?
Steps to reproduce: 1. Get the data into DataSet object by executing command/query 2. Build Excel workbook/worksheet from DataSet
Sample code:
DataSet ds = GetData(); Workbook wb = BuildWorkbook(ds) ExportToExcel(wb); // ???
I am using ASP.NET and C# on Windows.
Thanks, Chirag
Comment #1
Posted on Jun 1, 2011 by Swift LionPlease help!
Comment #2
Posted on Jun 27, 2011 by Massive DogI've already done this modifications to enable this. I hope to check-in tomorrow. Thank you for waiting.
Comment #3
Posted on Jun 27, 2011 by Massive Dog(No comment was entered for this change.)
Comment #4
Posted on Jun 27, 2011 by Massive Dog(No comment was entered for this change.)
Comment #5
Posted on Jul 4, 2011 by Grumpy Catyou can do in .net 4:
MemoryStream m = new MemoryStream(); // Temp Stream
workbook.Save(m);
m.CopyTo(Response.OutputStream);
Comment #6
Posted on Jul 29, 2011 by Swift LionHi,
Is there any update on this?
Thanks for your help, Chirag
Comment #7
Posted on Jul 30, 2011 by Massive DogYes, there is. Please download new Library. Use like that:
DataSet ds = GetData(); MemoryStream m = new MemoryStream(); ExcelLibrary.DataSetHelper.CreateWorkbook(m , ds); m.WriteTo(Response.OutputStream);
Comment #8
Posted on Jul 30, 2011 by Massive Dog(No comment was entered for this change.)
Comment #9
Posted on Aug 28, 2013 by Grumpy Rabbitit doesnt work, after that the screem show symbols and cant open dialog window open/save
Comment #10
Posted on Aug 28, 2013 by Grumpy Rabbit��ࡱ�R߆ӛݦB�&�^>#�>�� ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~�Root Entry��������c�r�8��c�r�8��Workbook������������?y�8��?y�8��A� � �B�=@ 8
Comment #11
Posted on Jun 26, 2014 by Helpful HorseYou need to add this before you write to the output stream
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=Reports.xls");
Status: Fixed
Labels:
Type-Enhancement
Priority-Medium