Search code examples
phpexcel

Set Background cell color in PHPExcel


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


Solution

  • $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/