mljonzs
Posts: 124
|
| Posted: 07/26/2006, 7:19 AM |
|
I haven't started this part of my project yet but wanted to post to see if I could get any ideas on best way to approach.
I would like to add a function to my web page that will create an export file (csv or xls) of the recordset being displayed.
Has anyone done something like this already or have any suggestions as to the easiest way to create this file??
In addition, I would add a button on the page that when clicked, would generate the export file and open it in Excel for the user. Anyone done this before??
THANKS!
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
Waspman
Posts: 948
|
| Posted: 07/26/2006, 10:14 AM |
|
Yep loads!
stick this after initialize on a page with your grid on it.
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
response.addHeader "Content-Disposition","inline; filename=Export.xls"
and remove all styles cos Excel will say it can't find um...
Tony
_________________
http://www.waspmedia.co.uk |
 |
 |
mljonzs
Posts: 124
|
| Posted: 07/26/2006, 11:55 AM |
|
Tony,
Thanks, I think this will work well for us! I appreciate it !!!
The only other question I have is this: How do I get the blank browser window to close after it sends the data to Excel? I dont' want the user to have to manually close this empty window but I can't seem to get it to close. I'm guessing I'm just trying to put code in the wrong place to close it but I need some help.
Thanks,
Michelle
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
Waspman
Posts: 948
|
| Posted: 07/27/2006, 1:45 PM |
|
It should open a download dialogue.
Have you tried it?
Tony
_________________
http://www.waspmedia.co.uk |
 |
 |
mljonzs
Posts: 124
|
| Posted: 07/27/2006, 2:26 PM |
|
Yes, I tried it. It opens the download dialog AND a blank window and I don't know how to get rid of the blank window.
Other than that it works GREAT!
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
mljonzs
Posts: 124
|
| Posted: 07/31/2006, 2:39 PM |
|
I was able to get rid of the "extra" blank web page by changing my button to a link. Works much better this way as it now works in Mozilla and Internet Explorer which are the two main browsers we support.
Thanks!!
Michelle J
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
Waspman
Posts: 948
|
| Posted: 08/03/2006, 12:43 AM |
|
Great
I've ver used it with a button only links and image links.
Strange it should make a difference.
T
_________________
http://www.waspmedia.co.uk |
 |
 |