By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,627 Members | 2,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,627 IT Pros & Developers. It's quick & easy.

how ASP.NET to generate excel report

P: n/a
ken
how ASP.NET to generate excel report(office 2003) to client
what component i need to reference into the asp.net application
and what component i need to install to the server?

Moreover, does it free?
Feb 22 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"ken" <ke*@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
how ASP.NET to generate excel report(office 2003) to client
what component i need to reference into the asp.net application
and what component i need to install to the server?

Moreover, does it free?


Hi Ken,

I don't know how much control you need, but I just generate a csv file for
the user. The user is then asked to save or open the file with the default
app (ussually Excel).

This ussually works enough that I can keep it as simple as possible. I also
generate a tocsv.aspx file, so it's generic.

Good luck,
John
Feb 22 '06 #2

P: n/a
Ken

Create a crystal report and export the content as Excel, that's the cheapest
way
see the sample code..

ReportDocument r=new ReportDocument();
crTableLogOnInfo=new TableLogOnInfo();

rptFiles=(MapPath("Reports\\xxx.rpt"));

r.Load(rptFiles);
crDatabase=r.Database;
for (int i = 0; i < crDatabase.Tables.Count; i++)
{
crTable = crDatabase.Tables[i];
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);

}
s=(System.IO.MemoryStream) r.ExportToStream(ExportFormatType.Excel);
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ContentType = "application/x-msexcel";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;
filename=Report.xls");
HttpContext.Current.Response.BinaryWrite(s.ToArray ());
HttpContext.Current.Response.End();
r.Close();

Hope this help you...

vinu

"ken" <ke*@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
how ASP.NET to generate excel report(office 2003) to client
what component i need to reference into the asp.net application
and what component i need to install to the server?

Moreover, does it free?

Feb 22 '06 #3

P: n/a
"John" <pl*@dont.spam.me.com> wrote in message
news:y3********************@news20.bellglobal.com. ..
I don't know how much control you need, but I just generate a csv file for
the user. The user is then asked to save or open the file with the
default app (ussually Excel).


Alternatively, if you want some more "presentation" formatting, create an
HTML document and then change its extension to .xls. Excel will just
"understand" what to do with it...
Feb 22 '06 #4

P: n/a

Ken.

Search google.com for
GridView Excel
or
DataGrid Excel
or even
Repeater Excel

There are some simple code snipplets out there ... to "export" one of those
controls,. and write it to Excel.

Here is one:
http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
"ken" <ke*@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
how ASP.NET to generate excel report(office 2003) to client
what component i need to reference into the asp.net application
and what component i need to install to the server?

Moreover, does it free?

Feb 22 '06 #5

P: n/a
Your easiest cheapest bet is to change the content type to excel and
response.write the content out. it will appear in the browser as a
spreadsheet. If you want more, you'll need to use a third party product.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"ken" <ke*@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
how ASP.NET to generate excel report(office 2003) to client
what component i need to reference into the asp.net application
and what component i need to install to the server?

Moreover, does it free?

Feb 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.