![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| Well, our users just love to have any tabular output downloadable as an Excel spreadsheet. I'm been trying to find a quick and easy way to do this and wondering why the following doesn't work as expected: Code: <html>
<head>
<META http-equiv="Content-Disposition" content="attachment; filename=testdocument.xml">\n';
<META http-equiv="Content-Type" content="application/vnd.ms-excel">\n';
<style type="text/css">
td {padding:2em; background-color:yellow; border:1px dotted #000;}
</style>
</head>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>=sum(a1:d1)</td>
<td>3</td>
<td>4</td>
<td>1</td>
</tr>
</table>
</body>
</html>
Interestingly (so far) the following works: Code: <%response.ContentType = "application/vnd.ms-excel"%> <%response.AddHeader "Content-Disposition", "attachment; filename=testdocument"%> <html> Before I drive myself more loony, have I got this wrong? |
| Sponsored Links |
|
#2
| ||||
| ||||
| What's with the /n'; at the end? I've never seen that used before in a meta tag. Try running the ASP version and then view the page source to see what it outputs.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.Join our Folding team: DeveloperBarn Folding |
|
#3
| ||||
| ||||
| Bah. A sloppy cut and paste I'm afraid. The ASP version gives me the option to save as and xls file, which them opens in Excel. No option to view source |
|
#4
| ||||
| ||||
| Perhaps it's the order the tags are in...notice how the ASP version is in a different order. Try: Code: <meta http-equiv="Content-type" content="application/vnd.ms-excel"> <meta http-equiv="Content-Disposition" content="attachment; filename=testdocument.xls"> |
|
#5
| ||||
| ||||
| Tried reversing the meta tags -- even tried running this with the Cassini server -- all no-joy. When I view source, I see: Code: <html> <head> <META http-equiv="Content-Disposition" content="attachment; filename=testdocument.xml"> <META http-equiv="Content-Type" content="application/vnd.ms-excel" Humpf! |
|
#6
| ||||
| ||||
| Interesting. I was able to duplicate this problem on my machine. I did some research and came up with nothing. Most people use some sort of server-side script to add these headers, whether it be php, ASP, or ASP.Net. I'm interested in seeing if anyone has any information on this. |
|
#7
| ||||
| ||||
| Server side scripting is the tack I've normally taken with this -- just seem silly to do another trip to the server to generate something that I already have. Oh well. |
|
#8
| |||
| |||
| You're trying to output formatted excel from server side right wolffy? I've got an example laying around at work using c#, let me know if you'd like it |
|
#9
| ||||
| ||||
| Thanks for the offer Lewy, but my goal here was to do this on the CLIENT side. I've already got the table displayed in the browser and was hoping I could save another trip to the server (and oracle) by opening a new browser window on the client with the necessary header info to 'fool' IE6 (the only browser I need to support ) into opening it as an excel spreadsheet.Coldfusion (in which this puppy is written) seems to be able to set this header info using CF tags on the server -- so I have a server solution working. Thank again |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|