p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   help exporting data to excel (http://p2p.wrox.com/showthread.php?t=67454)

MarkGT April 16th, 2008 12:20 PM

help exporting data to excel
 
Hi,

I have an asp page that displays query results in a datagrid. Id like to add a button to the datagrid to allow the user to view the data in a pre-formatted excel spreadsheet so it looks nicer and automatically creates graphs and charts.

How do I go about exporting the datagrid data to the pre-formatted excel spreadsheet (in the cells that I specify)?

thanks


mat41 April 16th, 2008 06:04 PM

You say datagrid - This sounds like a .net question to me. Are you .neting? If so this is the classic ASP area of worx. If not I use:

Response.ContentType = "application/vnd.ms-excel"

to achieve this, it works very well. Throw the above syntax into Google you will come up with useful links liek the following which holds your solution:

http://www.15seconds.com/issue/970515.htm

Wind is your friend
Matt
www.elitemarquees.com.au

MarkGT April 19th, 2008 07:48 AM

Yes its classic asp. I was mistaken, it is not a data grid. I'm just learning asp. Thank you for the help.

I have another question. I currently have four drop down lists that are independently populated by sql statements. How do I go about making the second list populate based on the selection from the first list, the third based on the selection from the second list and finally the fourth based on the selection from the third lst?


mat41 April 20th, 2008 07:53 PM

I use the onChange / post and reload event inside the select tag. There is a smarter way to get this done without reloading the page. Google knows loads of options:

http://www.google.com.au/search?hl=e...+boxes&spell=1

IMO start another post so others may benefit. knowbody will look here for that solution given the title of this post

Wind is your friend
Matt
www.elitemarquees.com.au

MarkGT April 29th, 2008 08:31 AM

Back to the original excel question...I got the:

Code:

Response.ContentType = "application/vnd.ms-excel"
to work, but it doesn't do what I need. I need the excel file to be pre formatted so charts and graphs are automatically created.

Is it possible run queries on an asp page and send the data to specific cells in an excel file that has already been created?



mat41 April 29th, 2008 06:13 PM

;;;I need the excel file to be pre formatted so charts and graphs are automatically created
I am unaware of a way to create charts and graphs in the way you describe. You can however load images of charts and graphs of course

;;Is it possible run queries on an asp page and send the data to specific cells in an excel file that has already been created?
No sure about that one, I have never had this need. Here is a useful link for you:

http://www.greggriffiths.org/webdev/both/excel/

Wind is your friend
Matt
www.elitemarquees.com.au


All times are GMT -4. The time now is 06:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.