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.
|