you can also send the appropraite headers to output directly to excel from the 
browser, i.e something like this:-

<? if($_GET['FORMAT'] == 'XLS'){
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: inline; filename=\"file.xls\"");
}
?>

this needs to be at the very start of the page and before any output to the browser, 
also in this case you'll need to send FORMAT=XLS in the GET array but you can of 
course take that bit out if you want the data to be in excel format always.

if you already have tables outputing to html then this will convert it excel and open 
an excel window and display the tables. Any formating you do to the html will be shown 
in the excel file as well. seems to easy to be true but it is!

change 'inline' to 'attachment' to simply download the file, or give the user the 
choice of what to do.



-----Original Message-----
From: Ramil Sagum [mailto:[EMAIL PROTECTED]
Sent: 20 August 2003 10:23
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?


have you tried saving the data as a set of comma separated values (CSV
file)?

Microsoft Excel can open/import these files.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 20, 2003 4:58 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?
>
>
> I've just done a search on goolge for this, and found several products
> that do it, but I'm convinced there's gotta be an open source option?
> Anyone able to point me in the right direction with this?
>


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


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

Reply via email to