CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Exporting a Grid to Excel or Word

Print topic Send  topic

Author Message
George L.
Posted: 04/30/2002, 3:30 PM

I am already aware of outputting the results of a query to an excel document,etc., but I am wondering if there is an "easy" way of exporting the results of a query AFTER the normal grid page is displayed.

Example:
1. select whatever from whateverTable

2. After results are displayed in C.C. grid page, show a link at top or bottom of grid displaying "Export Results to MS Excel".

3. When link is click-on, the same results already displayed get exported into a seperate page with an excel MIME-Type.

Anyone know if this is possible?

Thks
g.
spaceclown
Posted: 04/30/2002, 4:55 PM

I would like to know this also. I use ASP w/temp and SQL
George L.
Posted: 05/01/2002, 12:05 PM

Tom
Posted: 05/01/2002, 12:15 PM

Here is how I do this:
I have three pages in Code Charge
1. Search Form
2. Result Grid
3. Export Grid

Have your Search Form(Page 1) go to Result Grid (Page 2) with normal search parameters in the input. In the Header of the Result Grid place this: <a href="Export.asp">Export To Excel</a> Then in the Export Grid form Events Property "Open" put this in:

'No Header or Footer needed
sHeaderFileName=""
sFooterFileName=""
'Change HTML header to specify Excel's MIME content type
Response.Contenttype="application/vnd.ms-excel"

Hope I'm clear enough.
rax
Posted: 05/01/2002, 3:38 PM

Do you have an example?
this sounds great!
Tom
Posted: 05/02/2002, 10:36 AM

Tha example can be found here:

http://www.jadian.com/ExportExample.zip

I forgot one thing in the Header Link it should be this:

<a href="Export.asp?{FormParams}">Export To Excel</a>
George L.
Posted: 05/02/2002, 3:14 PM

Yeah. Thanks.
This also works if you have transit params set on your variables (PHP):

<a href="exportExcel.php?FormName=SearchInType&FormAction=search&{TransitParams}">Export Search Results to MS Excel Document</a>


George L.
Posted: 05/02/2002, 3:34 PM

Yeah. It works pretty good.

This also works for you PHP dudes/ladies:


Example using transit params in your variables.
<a href="exportExcel.php?FormName=SearchInType&FormAction=search&{TransitParams}">Export To MS Excel</a>

You could theoretically use this also with Word or PDF or some other MIME Doc Type.
Just be sure to correctly format your page style. It can look wacky if your not careful to use a custom one. Plain probably works best.

Thks

g.
Brian
Posted: 10/08/2002, 2:00 PM

Followed the example, but the page comes up empty in excel. Any idea where it's breaking?


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.