ibanez270dx Posted August 10, 2006 Share Posted August 10, 2006 Hi, I have a portion of code that dynamically creates an XLS file - which works - and then it posts the information into the correct cells - which works. The problem is that only a bit of it actually formats correctly according to my code.So the top bar (the column labels) works pretty ok. The bgcolor tag works and so does the text formatting in each cell. However, the width tag doesn't work - same with the style tag. Oddly enough, the bottoms of the cells are misaligned in every other cell. Even a bigger problem, none of the tags in the second table (data) work, except the text formatting. I still need it to be vertically aligned in the middle, and the cell background be #e5e5e5 in every other cell. Lastly, there are no gridlines when the file is opened... which seems really weird. Here is my code:[code=php:0]$catanames = "<table width=95% style=border: 1px solid; border-color:#000000;><tr><td bgcolor=#000000 width=100><font color=#FFFFFF><center><b>Type</b></center></font></td><td bgcolor=#000000 width=100><font color=#FFFFFF><center><b>Date</b></center></font></td><td bgcolor=#000000 width=100><font color=#FFFFFF><center><b>Downtime</b></center></font></td><td bgcolor=#000000 width=100><font color=#FFFFFF><center><b>Hours Down</b></center></font></td><td bgcolor=#000000 width=100><font color=#FFFFFF><center><b>ATA</b></center></font></td><td bgcolor=#000000><font color=#FFFFFF><center><b>Discrepancy</b></center></font></td><td bgcolor=#000000><font color=#FFFFFF><center><b>Resolution</b></center></font></td><td bgcolor=#000000 width=120><font color=#FFFFFF><center><b>Logged</b></center></font></td><td bgcolor=#000000 width=150><font color=#FFFFFF><center><b>Logged By</b></center></font></td></tr></table>"; $data .= "<table width=95%><tr><td bgcolor=#e5e5e5 width=100 valign=middle valign=middle><center>$dwntime_type</center></td><td width=100 valign=middle><center>$dwntime_date</center></td><td width=100 valign=middle bgcolor=#e5e5e5><center>$dwntime_times</center></td><td width=100 valign=middle><center>$dwntime_hrs</center></td><td width=100 valign=middle bgcolor=#e5e5e5><center>$dwntime_ata</center></td><td valign=middle><center>$dwntime_reason</center></td><td valign=middle bgcolor=#e5e5e5><center>$dwntime_solution</center></td><td width=120 valign=middle><center>$dwntime_log</center></td><td width=150 valign=middle bgcolor=#e5e5e5><center>$dwntime_log_by</center></td></tr><tr><td colspan=9><hr size=1></td></tr></table>"; }$fp = fopen($filename2,"a"); if($fp) { fwrite($fp, $catanames); fwrite($fp, $data); fclose($fp); echo "File saved successfully. <a href=$filename2>click here to access $filename2</a>"; } else { echo "Error saving file!"; }[/code]this ends up looking like:[img]http://www.loaded-designs.com/images/excel.gif[/img]Can anyone help me figure out why it won't format correctly?Thanks!! - Jeff Quote Link to comment https://forums.phpfreaks.com/topic/17172-formatting-for-dynamically-made-xls-not-working/ Share on other sites More sharing options...
mainewoods Posted August 11, 2006 Share Posted August 11, 2006 Use double quotes in your style tag:[code]style="border: 1px solid; border-color:#000000;"[/code]-the border tag should be coded:[code]style="border: 1px #000000 solid;"[/code]Lose the width=95%:[code]<table style="border: 1px #000000 solid";>[/code]-it fights with your width=100 and such for who rules Quote Link to comment https://forums.phpfreaks.com/topic/17172-formatting-for-dynamically-made-xls-not-working/#findComment-72806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.