Skip to content

Instantly share code, notes, and snippets.

@andreconghau
Created September 13, 2021 07:37
Show Gist options
  • Save andreconghau/1ea41050fc8019c60f9e0065470865df to your computer and use it in GitHub Desktop.
Save andreconghau/1ea41050fc8019c60f9e0065470865df to your computer and use it in GitHub Desktop.
phpexcel format cell 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
)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment