Set Background cell color in PHPExcel

user198003 picture user198003 · Jul 21, 2011 · Viewed 207.4k times · Source

How to set specific color to active cell when creating XLS document in PHPExcel?

Answer

user198003 picture user198003 · Jul 21, 2011
$sheet->getStyle('A1')->applyFromArray(
    array(
        'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => 'FF0000')
        )
    )
);

Source: http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/