php - Set background color for heading in export CSV format in laravel maatwebsite -
i trying set background color below export csv file. background color not setting first row. works xls format. please help. in advance.
$filename = $filename."_".date('dmyhis'); \excel::create($filename,function($excel) use($newarray){ $excel->settitle('tasks'); $excel->setcreator('admin'); $excel->setcompany('company'); $excel->setdescription('time sheet'); $excel->sheet('sheet1',function($sheet) use($newarray){ $sheet->fromarray($newarray, null, 'a1', false, false); $sheet->cells('a1:n1', function($cells) { $cells->setbackground('#aaaaff'); }); }); })->download('csv');
comma-separated values (csv) file stores tabular data (numbers , text) in plain text, can't assign background color in csv file. should use excel (xls or xlsx) format.
Comments
Post a Comment