[PHP] output to Excel

2003-09-16 Thread Jackson Miller
Is there a way to output PHP to MS Excel format?

-Jackson
-- 
jackson miller
 
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
 
 
cold feet presents Emma
the world's easiest email marketing
Learn more @  http://www.myemma.com

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



Re: [PHP] output to Excel

2003-09-16 Thread Payne
Jackson Miller wrote:

Is there a way to output PHP to MS Excel format?

-Jac
 

One you can do a dump with mysqladmin save the file as myfile.csv , 
excel can read cvs formatted files.

Two you can use phpMyAdmin to do the save things.

Chuck Payne

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


Re: [PHP] output to Excel

2003-09-16 Thread Jackson Miller
On Tuesday 16 September 2003 4:17, Payne wrote:
 Jackson Miller wrote:
 Is there a way to output PHP to MS Excel format?
 
 -Jac

 One you can do a dump with mysqladmin save the file as myfile.csv ,
 excel can read cvs formatted files.

 Two you can use phpMyAdmin to do the save things.

Yes, I am currently using csv files.  I want my web app to output in a way 
that will either open excel or prompt for a save as and have the file be 
a .xls

-Jackson

 Chuck Payne

-- 
jackson miller
 
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
 
 
cold feet presents Emma
the world's easiest email marketing
Learn more @  http://www.myemma.com

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



RE: [PHP] output to Excel

2003-09-16 Thread Jennifer Goodie
 Is there a way to output PHP to MS Excel format?

Send the headers for the appropriate application type and then format your
output as HTML with Excel's styles.  In order to get a feel for what my
output should be, I just create a sample of what I want in Excel, save as
html and then open the file in a text editor. Once you look at a few it's
pretty easy to understand.

Here's a small example (okay, it is kind of long, but is probably helpful):

?php
Code to execute a query, etc.  my result identifier is $results
header(Content-disposition: filename=$file_title.xls);
header(Content-type: application/vnd.ms-excel);
header(Pragma: no-cache);
header(Expires: 0);
?
html xmlns:o=urn:schemas-microsoft-com:office:office
xmlns:x=urn:schemas-microsoft-com:office:excel
xmlns=http://www.w3.org/TR/REC-html40;

head
meta http-equiv=Content-Type content=text/html; charset=windows-1252
meta name=ProgId content=Excel.Sheet

!-- STYLES --
style id=Book1_29054_Styles
!-- //this is all swiped from excel, but I removed most of the content
//--
!--table
{mso-displayed-decimal-separator:\.;
mso-displayed-thousand-separator:\,;}
.general
{BUNCH of STUFF}
.col_header
{BUNCH of STUFF}
.date
 {BUNCH of STUFF}
//--
/style
/head

body
div id=Book1 align=center x:
table x:str border=1 cellpadding=0 cellspacing=0
style='border-collapse:collapse;table-layout:fixed;border-color:#B71E00;'
   tr
td colspan=4 class='col_header' align='center'b?php
echo $title;?/b/td
/tr
tr
td class='col_header'ID/td
td class='col_header'Email/td
td class='col_header'Visits/td
td class='col_header'Date Applied/td
 /tr
?php
while ($row = $db-fetch_array($results)){
foreach($row as $key=$val){
$$key = ($val ==
'')?'nbsp;':htmlentities(stripslashes($val),ENT_QUOTES);
}
printf (tr
td class='general'%d/td
td class='general'%s/td
td class='general'%d/td
td class='date'%s/td
 /tr\n,++$count, $email,$visits,$apply_date);
}
print /table/div/body/html;
?

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



Re: [PHP] output to Excel

2003-09-16 Thread Jason Sheets
PEAR has an Excel Spreadsheet Writer class, view it at: 
http://pear.php.net/package/Spreadsheet_Excel_Writer

Jason

Payne wrote:

Jackson Miller wrote:

Is there a way to output PHP to MS Excel format?

-Jac
 

One you can do a dump with mysqladmin save the file as myfile.csv , 
excel can read cvs formatted files.

Two you can use phpMyAdmin to do the save things.

Chuck Payne

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