Zoumaho / excellibrary

Automatically exported from code.google.com/p/excellibrary
0 stars 0 forks source link

How do I export the generated excel on the web app using asp.net/c#? #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by chiragbh...@gmail.com on 25 May 2011 at 9:42

GoogleCodeExporter commented 9 years ago
Please help!

Original comment by chiragbh...@gmail.com on 1 Jun 2011 at 7:26

GoogleCodeExporter commented 9 years ago
I've already done this modifications to enable this.
I hope to check-in tomorrow.
Thank you for waiting.

Original comment by regisbsb...@gmail.com on 27 Jun 2011 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by regisbsb...@gmail.com on 27 Jun 2011 at 11:10

GoogleCodeExporter commented 9 years ago

Original comment by regisbsb...@gmail.com on 27 Jun 2011 at 12:40

GoogleCodeExporter commented 9 years ago
you can do in .net 4:

        MemoryStream m = new MemoryStream(); // Temp Stream
        workbook.Save(m);
        m.CopyTo(Response.OutputStream);

Original comment by yaniv...@gmail.com on 4 Jul 2011 at 2:17

GoogleCodeExporter commented 9 years ago
Hi,

Is there any update on this?

Thanks for your help,
Chirag

Original comment by chiragbh...@gmail.com on 29 Jul 2011 at 2:44

GoogleCodeExporter commented 9 years ago
Yes, 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);

Original comment by regisbsb...@gmail.com on 30 Jul 2011 at 2:54

GoogleCodeExporter commented 9 years ago

Original comment by regisbsb...@gmail.com on 30 Jul 2011 at 2:55

GoogleCodeExporter commented 9 years ago
it doesnt work, after that the screem show symbols and cant open dialog window 
open/save

Original comment by quinto...@hotmail.com on 28 Aug 2013 at 9:48

GoogleCodeExporter commented 9 years ago
��ࡱ�R߆ӛݦB�&�^>#�>�� 
��������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
����������������������������
���������������������  
 
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop
qrstuvwxyz{|}~�Root 
Entry��������c�r�8��c�r�8��Workbook�
�����������?y�8��?y�8��A� � 
�B�=@ 8

Original comment by quinto...@hotmail.com on 28 Aug 2013 at 9:53

GoogleCodeExporter commented 9 years ago
You 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");

Original comment by clmsg...@gmail.com on 26 Jun 2014 at 10:16