background color phpexcel code example

Example: phpexcel fill background color

$page = 0;
$this->PhpExcel->createSheet($page);
$this->PhpExcel->setActiveSheetIndex($page);
$sheet = $this->PhpExcel->getActiveSheet();

$sheet->getStyle("A1:A7")->applyFromArray(
  array(
    'fill' => array(
      'type' => PHPExcel_Style_Fill::FILL_SOLID,
      'color' => array('rgb' => 'FFE699')
    ),
    'borders' => array (
      'allborders' => array (
        'style' => PHPExcel_Style_Border::BORDER_THIN,
        'color' => array('rgb' => '000000'),        // BLACK
      )
    )
  )
);

Tags:

Php Example