Return to Snippet

Revision: 8792
at October 8, 2008 11:31 by stavelin


Initial Code
<?php
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: application/vnd.ms-excel;charset:UTF-8");
header("Content-Disposition: attachment; filename=filename.xls"); 
print "\n"; // Add a line, unless excel error..
?>
<table border="1">
<tr>
<th>header 1</th>
<th>header 2</th>
</tr>
<tr>
<td>data 1</td>
<td>data 2 - nordic letters æ, æ, å</td>
</tr>
</table>

Initial URL
http://www.gersh.no/posts/view/easy-excel-export-from-php

Initial Description
This is saved from Gerhard Slettens weblog www.gersh.no. I just want yo keep it on snipplr so it easily can be fetched through textmate.

Initial Title
Easy Excel export from PHP

Initial Tags
php, excel

Initial Language
PHP