I want to generate a CSV
file using php
. I am able to generate simple CSV
file but I want to set font-size and font-color dynamically for headings. I found some libraries but those were not upto the mark.
Here is the code by which I can generate simple CSV file
$fp = fopen(FCPATH .'assets/' . $filename,'w');
$content = "";
foreach ($query_pairs->result() as $pair) {
$content .= '<th>' . @$users[$pair->uid1]->name . '</th>' . $sep . ' ' . @$users[$pair->uid2]->name . PHP_EOL;
}
fwrite($fp,$content);
fclose($fp);
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=".$filename);
header("Pragma: no-cache");
header("Expires: 0");
readfile(FCPATH .'assets/' . $filename);
Please help