is there a way to alter cell width, cell color, etc.?i'm exporting it as a datastream, setting $titles to the titles on the MySQL table
$titles = "";for ($i = 0; $i < $numfieldsXL; $i++) { $titles .= mysql_field_name($resultXL, $i) . "\t";}
header("Content-type: application/x-msdownload");header("Content-Disposition: attachment; filename=$Name-$year.xls");header("Pragma: no-cache");header("Expires: 0");print "$titles\n$data";
7/26/2006 9:14:12 PM
You arent actually creating an excel file.A real excel file is a binary file.You are just basically in essence creating a csv file, which you can contain no formatting in.Search google on how to create an excel binary with php, and go that route.
7/26/2006 9:48:27 PM
http://pear.php.net/package/Spreadsheet_Excel_Writer
7/26/2006 9:58:28 PM
^^thx wolfmarsh, i'll look into that^yeah, i found that when i was looking for some solutions
7/26/2006 10:15:10 PM
If you can decipher the XML format Excel 2003 uses, you might be able to go with that. Otherwise, good luck with Google.
7/27/2006 7:27:51 AM
Excel accepts html code and does a decent job of displaying it. Try copying and pasting the code below into a new file and rename it such that it has an .xls extension. Open it in excel.
<table><tr> <td width="200" bgcolor="#c00000"><font color="#ffffff">Test 1</font></td> <td width="35" align="center" bgcolor="00c000"><font color="#ffffff">Test 2</font></td></tr></table>
<html><head><style type="text/css"> td.one { color: white; background-color: #c00000; vertical-align: middle; } td.two { color: black; background-color: #c0c0c0; text-align: center; }</style></head><body><table border="1"><tr> <td width="200" class="one">Test 1</td> <td width="35" class="two">Test 2</td></tr></table></body></html>
<?phpheader("Content-Type: application/vnd.ms-excel");header("Content-Disposition: attachment; filename=file.xls"); header("Expires: 0");header("Cache-Control: must-revalidate, post-check=0, pre-check=0");?>
7/27/2006 7:28:40 AM
bump per user request.
12/6/2006 9:57:34 AM
oh yeah almost forgot i wanted this bttted, thxi finally got back around to working on this and decided to go the route of usingSpreadsheetML or the XML that excel usesi'm getting errors on the file it makes though and was wondering if anyone is good at this sort of XML and could help me troubleshoot it
12/6/2006 10:52:16 AM
if you find a good solution, post it here. this is something on one of my todo lists too, i knew about the pear package but if something better exists, i'd like to look at it[Edited on December 6, 2006 at 3:09 PM. Reason : .]
12/6/2006 3:08:51 PM
what exactly are you looking for that the PEAR package can't do....
12/6/2006 4:32:54 PM
i don't want to install the PEAR package is my thingwhat i'm trying to do is output a SpreadsheetML file going by http://www-128.ibm.com/developerworks/opensource/library/os-phpexcel/it's just i'm getting frustrated at the XML and i'm not seeing whatever's not working properly[Edited on December 6, 2006 at 8:06 PM. Reason : ]
12/6/2006 8:05:06 PM
anyone know how to parse PDF text in php?
12/6/2006 8:30:29 PM
sweet got it working
12/16/2006 1:15:03 AM
details?
12/16/2006 10:25:33 AM
i just made an Excel sheet as an example to work off, used the Save As...>XML Spreadsheet function, opened it up in wordpad and had the php code generate something similari was mainly just having difficulty with the xml code, once i got to the error logs from excel things went much fasteri was doing things like using <cell> instead of <Cell> which will make things not show up, having wrong style names, setting Data as "Number" when it should be "String", etc. - SpreadsheetML is somewhat pickier than HTML or normal XMLhere's an example of what the SpreadsheetML looks like with some php code to generate it, but i didn't follow their code so i don't know how good it is: http://www-128.ibm.com/developerworks/opensource/library/os-phpexcel/
12/16/2006 1:11:31 PM