Re: Webactions: generating excel-compatible CLP page
Edi Weitz <[email protected]> Mon, 29 Mar 2004 09:47:23 +0200
| Newsgroups | gmane.lisp.open-source.franz |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 28 Mar 2004 21:43:28 -0800, Andrew Philpot <[email protected]> wrote: > I'd like to dynamically generate a CLP page which "lies" about its > content type (is syntactically HTML but says it's (:CONTENT-TYPE > "application/vnd.ms-excel")) so that MSIE will use its built-in > Excel viewer to display it. > > I thought that something like > > (webaction-project "myproject" > :map > '(("excelpage" "excelpage.clp" > (:content-type "application/vnd.ms-excel")))) > > where the content of the excelpage.clp is > > <HTML> > <HEAD> > <META http-equiv="content-type" content="application/vnd.ms-excel"> > </HEAD> > <BODY> > <TABLE> > <TR><TD>Raphael</TD><TD>Sally</TD></TR> > <TR><TD>Winfrey</TD><TD>Oprah</TD></TR> > <TR><TD>Lake</TD><TD>Ricki</TD></TR> > </TABLE> > </BODY> > </HTML> > > should work. If you drop this file onto Excel, it just "does the > right thing." Of course in the real application, this would be > dynamically generated rather than static. Also, I'm persuaded that > the embedded content-type declaration is probably ignored in this > case. > > It doesn't do what I would like, however. It just displays the > table normally, not as a spreadsheet. I don't know if that's your problem but IE has the annoying habit of sometimes ignoring the content-type header and trying to "do the right thing" (which usually isn't the right thing). It /might/ help to name the file "excelpage.xls" instead of "excelpage.clp". In any case you're lying, of course. The content type really is text/html, not application/vnd.ms-excel, and the browser is supposed to open this page with the application that's registered for this type - which happens to be the browser itself. Using CSV files with a correct content-type is probably the right way. Cheers, Edi.