The above code will work in IE 4 and above. The client also
needs to have Microsoft Excel installed. The magic is the
Response.ContentType command. It tells the browser what type of
content to expect... in this case an Excel Spreadsheet. The rest
of what happens is all dependent on how Excel handles the HTML and
luckily it does a pretty darn good job.
While this won't let you do everything Excel is capable of, it
can be quite handy if, for example, you're developing an
Intranet and just want to send a user some data that they
then need to perform some calculations with. Just return
your data as standard HTML and let Excel handle it.
And don't hesitate to try things like borders or even complex
formatting... you'd be amazed at how much Excel knows about HTML.
If you have a tip you would like to submit, please send it to:
webmaster@asp101.com.