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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 24, 2002 5:11 PM
> To: [EMAIL PROTECTED]
> 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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to