Reply
Send down Excel files w/o Excel - just regular code
Old 09-18-2007, 01:52 AM Send down Excel files w/o Excel - just regular code
ForrestCroce's Avatar
Half Man, Half Amazing

Latest Blog Post:
Talapus Lake in June Snow
Posts: 3,016
Name: Forrest Croce
Location: Seattle, WA
Since Office 2002, which most people have by now, Excel has supported a format called "XML Spreadsheet." As the name implies, it's just a text file, so you can produce these things on the fly without having to buy a thing. And everyone loves using Excel to filter, sort, and graph data; it makes them feel smart. Plus, it prints a lot better than raw html. Check Microsoft's reference to make sure you get the number formats right.

One approach is xslt transforms on the server; most browsers have xslt, but not when you want to use different mime types. You're better off taking a sample report in the format you like, then using File -> Save As -> File Type: XML Spreadsheet, then finding the few edits you'll need to make. One is obvious, the data itself, but you'll have to change the size of the worksheet, too.

Finally, either use Response.Write("<content type=application/vnd.ms-excel>") or Response.ContentType = "application/vnd.ms-excel" and send the data. Or, build the file in advance and link to it, letting IIS actually serve it up.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
When You Register, These Ads Go Away!
     
Old 09-18-2007, 07:23 AM Re: Send down Excel files w/o Excel - just regular code
Experienced Talker

Posts: 44
Thanks for sharing the info.It seems to be quite useful.
__________________
www.coderewind.com
Best Place to hunt for Code
codingmaster is offline
Reply With Quote
View Public Profile
 
Old 09-18-2007, 01:29 PM Re: Send down Excel files w/o Excel - just regular code
Learning Newbie's Avatar
Moderator

Posts: 4,585
Name: John Alexander
You can use XML in the old school ASP? Are you sure?
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 09-18-2007, 11:03 PM Re: Send down Excel files w/o Excel - just regular code
ForrestCroce's Avatar
Half Man, Half Amazing

Latest Blog Post:
Talapus Lake in June Snow
Posts: 3,016
Name: Forrest Croce
Location: Seattle, WA
Of course you can use XML in asp 3.0! It's plain text - that's the appeal. All you need to do is stream a particular flavor of XML down to the client with search and replace string functionality. It's actually pretty easy.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 09-24-2007, 07:48 AM Re: Send down Excel files w/o Excel - just regular code
Junior Talker

Posts: 2
Hi,
Its very interesting and informative.As i am a bud in this technology ,Really it is useful and helpful for me.Thanks for sharing with us.
Raeligh is offline
Reply With Quote
View Public Profile
 
Old 09-24-2007, 12:53 PM Re: Send down Excel files w/o Excel - just regular code
Skilled Talker

Posts: 97
Name: Ganesh
If its a single sheet report a simplest and fastest way to reproduce excel output is.

Using the FileSystem object create the flat file with html table statements like below and save as .xls file. When the html get opened in excel, it uses the table structure to rows and columns, fastest ever.

This code will trigger excel to open with the desired output.


Code:
<%
Response.ContentType = "application/vnd.ms-excel"
Response.write("<table>")
Response.write("<tr>")
Response.write("<th>")
Response.write("column  header 1")
Response.write("</th>")
Response.write("<th>")
Response.write("column  header 2")
Response.write("</th>")
Response.write("</tr>")
 
Response.write("<tr>")
Response.write("<td>")
Response.write("Row 1 column  data 1")
Response.write("</td>")
Response.write("<td>")
Response.write("Row 1 column  data 2")
Response.write("</td>")
Response.write("</tr>")
 
Response.write("<tr>")
Response.write("<td>")
Response.write("Row 2 column  data 1")
Response.write("</td>")
Response.write("<td>")
Response.write("Row 2 column  data 2")
Response.write("</td>")
Response.write("</tr>")
Response.write("</table>")
 
%>
__________________
Gather. Search. Compare. Save on Hotel and Flight Prices @ www.vtrip.info
sri_gan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Send down Excel files w/o Excel - just regular code
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16393 seconds with 13 queries