Current location: Hot Scripts Forums » Programming Languages » ASP » Export to excel file asp


Export to excel file asp

Reply
  #1 (permalink)  
Old 07-30-04, 04:31 AM
traceMe traceMe is offline
Newbie Coder
 
Join Date: Oct 2003
Location: india(mumbai)
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Export to excel file asp

guys iam doing some research on exporting the data from database to access, excell, txt, files and ne other way through which i can export the data. Can you guys help me in this matter......
I have data in my ms-sql 2000 online now if i want to view it on my desk offline then i'll have to put the software in first case and then import it from online database.....but I dont intend to do that.......rather if I put up a link on a page that says export and that exports the data to a excel file.....I dont mind uploading a excel file..........or whatever.....
please help me.................
I had earlier seen a code that reads from excel file i guess in that case its also possible to write it in excel file.........
now I want to
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-01-04, 06:45 PM
ksroadrunner13 ksroadrunner13 is offline
Newbie Coder
 
Join Date: Mar 2004
Location: Wichita, Ks
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
I'm doing something similar on the site that I'm working on. I have to generate a monthly report from an access database in excel format. Excel spreadsheets are nothing more than XML code so I'm using ASP to dynamically create an XML page with the .xls extension just as if you would create an HTML page and it seems to work just fine. It's kind of a pain considering that one spread sheet can contain over 2,000 lines of XML code, but it requires no 3rd party software or com objects to do it.

Is that even close? Do you need more info?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-01-04, 10:07 PM
Mikeirv Mikeirv is offline
Newbie Coder
 
Join Date: May 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
There is a much easier way to do this than the XML appraoch. try this in an asp file and you will see how simple it can be

<%
''// Set the name of the file that you are going to output
FileName = "MySpreadsheet.xls"

''// Build up a regular HTML table (this translates into the rows and cells in excel)
sData = "<table><tr><th>Name</th><th>Age</th></tr>"

sData = sData & "<tr><td>Mike</td><td>26</td></tr>"

sData = sData & "</table>"

''// Write out the table
response.write sData

''// Set the Header info
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition","attachment; filename=" & FileName
%>

If you want, you can put this into a function on your page. Then just make a link back to your page with a querystring that you can check and if it is there, run the function. If you run this, you will see that it prompts you to save the excel doc from the page. Just loop through your records to populate the rows and you are all set.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
click in image then export to excel angela ASP 4 09-02-10 06:55 AM
Excel document containing records, need to save as a text file to upload to mysql bearslife PHP 1 06-05-04 04:24 AM
make pdf file via asp traceMe ASP 0 05-26-04 08:54 AM
Getting the created file (fopen/fwrite) Programme PHP 5 02-14-04 04:09 PM
Use an EXCEL file to update a table in MSSQL busypanda ASP.NET 0 11-12-03 09:51 AM


All times are GMT -5. The time now is 12:22 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.