note 35921 deleted from function.header by victor
| From: | victor@php.net | Date: | Sat, 27 Mar 2004 21:28:32 +0000 |
| Subject: | note 35921 deleted from function.header by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67260@lists.php.net to get a copy of this message | ||
Note Submitter: andrej at dairyweb dot com dot au
----
while looking for a solution to easily convert HTML->excel spreadsheets, while re-using as much
of the existing template system as possible.
i stumbled across a nifty little trick with headers that does the job nicely. (note: i have only
tested with IE 5.5+). Just call the headers before the HTML that you want to be rendered into a
excel document, and there u go
example:
--------[snip]--------
<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=\"test.xls\"");
?>
<table border="1" cellpadding="3" cellspacing="1">
<tr>
<td>CustomerID</td>
<td>CompanyName</td>
<td>ContactName</td>
</tr>
</table>
words words words
--------[snip]--------
hope it helps someone, as it saved me doing it with an external excel writer library