Skip to content

Instantly share code, notes, and snippets.

@ctrl-f5
Created January 5, 2016 16:23
Show Gist options
  • Save ctrl-f5/0ee59bc9153ff09774d1 to your computer and use it in GitHub Desktop.
Save ctrl-f5/0ee59bc9153ff09774d1 to your computer and use it in GitHub Desktop.
<?php
$excel = new \PHPExcel();
$sheet = $excel->getActiveSheet();
$style = new \PHPExcel_Style();
$style
->getFill()
->setFillType(\PHPExcel_Style_Fill::FILL_SOLID)
// it's a solid color, do I have to set start or end? or are both required?
->setStartColor(new \PHPExcel_Style_Color(\PHPExcel_Style_Color::COLOR_RED))
->setEndColor(new \PHPExcel_Style_Color(\PHPExcel_Style_Color::COLOR_RED))
;
$cell = $sheet->getCell('A1');
// can't style a cell?
//$cell->setStyle(...)
// but I have to... duplicate the styling?
$sheet->duplicateStyle($style, 'A1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment