RE: [PHP] using header() to display info in excel
| From: | John Holmes | Date: | Fri, 24 May 2002 22:10:00 +0000 |
| Subject: | RE: [PHP] using header() to display info in excel | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99173@lists.php.net to get a copy of this message | ||
I don't know if this is the best way or not, but I just use the
following function to send Excel headers, then just create your page as
a normal HTML table. Excel will take the HTML table and create a
spreadsheet with it.
##############################################
#
# Creates headers to send MS Excel file
#
##############################################
function COM_ExcelHeader($filename = "download")
{
//MS Excel Headers
header("Content-Type: application/vnd.ms-excel; name='excel'");
header("Content-Disposition: attachment; filename=" . $filename .
".xls");
}
---John Holmes...
> -----Original Message-----
> From: Sk8PR2k@aol.com [mailto:Sk8PR2k@aol.com]
> Sent: Friday, May 24, 2002 5:11 PM
> To: php-general@lists.php.net
> Subject: [PHP] using header() to display info in excel
>
> Hey,
>
> I am looking to read information from a database and when you click a
link
> all of those arrays will be displayed in excel using header();. I
have
> heard
> there are lots of commands in cgi but I don't know cgi and I am
wondering
> if
> it is still possible with php. I would also like info on reading
> information
> from excel to a mysql database using php.
>
> Thanks a lot,
> Kevin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php