Forum OpenACS Q&A: Re: Can't exec a command in tcl page
The program as written doesn't add any formatting to the data, treating it all as plain strings, but it would be easy enough to add appropriate column widths, bolded column headers, etc. The format is documented at http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx Or you can open the spreadsheet in excel (or LibreOffice), reformat it as you like, and resave it in the same format (i.e., agree to save it in the old format when you get the pop-up), and simply examine what has changed w.r.t styles, fonts, document info, etc.
As far as it just working, I've found that if you save it as a ".xml" file (e.g., by content-disposition header), it will just work in excel (just don't remove the "mso-application" PI from the xml). However if the user just selects "open with excel" when downloading it, they will get a popup saying it's in the wrong format and they have to hit ok before opening it (because the browser sees fit to rename it to whatever.xml.xls), at least in firefox. Peversely, if you specify the mimetype as "application/xml" then the browser doesn't recognize it as an excel file and will open it with "xml editor", which recognizes it as a spreadsheet and opens it with excel with no complaints. And mockingly, it works cleanly in IE either way. All of this is on my machine of course, YMMV.