RE: [PHP] Exporting HTML to Excel
| From: | Graham Cossey | Date: | Tue, 12 Oct 2004 22:06:53 +0000 |
| Subject: | RE: [PHP] Exporting HTML to Excel | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199308@lists.php.net to get a copy of this message | ||
Philip, have you checked the php freaks website? I do recall seeing a script
in their tutorials library that claimed to create Excel files.
http://www.phpfreaks.com
Just had a search and came up with:
<?
header("Content-Type: application/vnd.ms-excel");
^^^^
echo "<table border=1>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>";
?>
HTH
Graham
> -----Original Message-----
> From: Philip Thompson [mailto:prthomp@uark.edu]
> Sent: 12 October 2004 22:21
> To: php-general@lists.php.net
> Subject: [PHP] Exporting HTML to Excel
>
>
> Hi all.
>
> This may not be completely a PHP question, but hopefully you will be
> able to provide some insight. I have a table in HTML that I want to
> export to an excel spreadsheet. Using PHP, I can create an excel
> document - however, it's empty/blank. I think I am just doing it
> incorrectly. Anybody done this before and/or have any ideas? I would
> prefer to NOT use a third-party program.
>
> I've searched the web and php.net, but have been somewhat unsuccessful
> in finding anything. Here's what I have so far:
>
> -------------
> <?php
> header('Content-Type: application/ms-excel');
> header('Content-Disposition: attachment; filename="project.xls"');
> ?>
>
> <table>
> <tr>
> <td>Something</td>
> </td>Something else</td>
> </tr>
> </table>
> -------------
>
> I just want it to have that content in the spreadsheet. It's actually
> more involved than that, but that's the gist of it.
>
> Thanks in advance.
> ~Philip
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>