-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: SijuInfinite
Message 4 in Discussion
>From where the datas are coming..?Is it from
Database.
You can do onet hing store the datas in DataSet or
DataReader.
Iterate it and Geneate it like a table kind of
format using the classes
HtmlTable,HtmlTableRow,HtmlTableCell.
Then write the following lines of code
System.IO.StringWriter stringWrite = new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new
System.Web.UI.HtmlTextWriter(stringWrite);
HtmlTable.RenderControl(htmlWrite);
Response.ContentType =
"application/vnd.ms-excel";
Response.Write(stringWrite.ToString());
Siju.C
Infinite Computer Solutions (India)
Pvt.Ltd.
A SEI-CMMi L5 Company
Phone: +91-080-25212901/0622 Extn:
171
----- Original Message -----
From:
BDOTNET
To: BDOTNET
Sent: Tuesday, July 06, 2004 4:40
PM
Subject: Re: how To download Excel file
in ASP.Net using C#
New Message on BDOTNET
how To
download Excel file in ASP.Net using C#
Reply
Recommend
Message 3 in
Discussion
From: AshishinBangalore
Priyanka,
I did a similar
thing about a year back.
I assume the data to be
populated in your Excel file comes from a database.
It
did the following:
1. Collect the data from various database
tables (depending on the filter criteria specified) into a
temporary table.
2. Format that data in a temporary
table.
3. Move the contents of the temporary table to a
physical file on the hard disk (the extension of the file should
be �xls�). This can be done by BCP (Bulk Copy Program) command
in SQL Server.
4. Zip the file, this is needed because the
file to be downloaded must not be heavy. You can zip a file in
hard drive from inside the stored procedure by calling a system
stored procedure �xp_cmdshell�. You can specify any zip file
utility like winzip or pkZip to be used for zipping the file.
5. Ensure a forced download. (You need to search the code
from the net). Let me know if you are not able get hold of
it.
Steps 1-4 were accomplished inside a stored
procedure. Last step was through a ASP scriplet.
---------------------------
Thanks &
Regards,
Ashish Malhotra
Thomson,
Bangalore
91-80-25550333 X
1140
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]