Reputation: 674
I'm using clean php to draw excel table:
$xls .= "Field\t\Cell1\t\Cell2\tCell3\r\n"
$xls .= chr(hexdec('FF')) . chr(hexdec('FE')) . $xls; //headers
echo $xls;
Is there any way to draw cell borders without using excel-library?
Upvotes: 0
Views: 7325
Reputation: 14173
Excel has the knowledge to work with plain HTML tables. This will generate a warning from excel, but if you continue, it will show a table with border/colors/etc.
<?
header('Content-Type: application/vnd.ms-excel');
?>
<table border='1'>
<tr>
<td style='background-color:#f00;'>header</td>
<td style='background-color:#f00;'>header</td>
</tr>
</table>
Upvotes: 2
Reputation: 641
If you really want to output an Excel file with almostly everything possible in Excel, you should use the following easy to use set of PHP classes:
Upvotes: 1
Reputation: 117615
No, you can't control formatting in a CSV file.
Excel accepts a multitude of formats though, so if you don't feel like breaking out phpexcel, you could create a SpreadsheetML file instead. It's a format quite similar to html and you can control a lot of formatting in there.
Upvotes: 1