I am using PHPExcel to export a MySql select and it's working fine.
I know PHPExcel is deprecate and now there is PHPspreadsheets, but it's an old project with an old php version
Anyway, I'd like to color all cells of the sheet based on two value and I am trying with this function code:
function cellColor($column, $row){
global $objPHPExcel;
$cell = $column.$row;
$cellValue = $objPHPExcel->getCellByColumnAndRow($column, $row)->getCalculatedValue();
$color = 'ffffff';
if($cellValue == 'OK')
$color = 'ff0000';
if($cellValue == 'NO')
$color = '30a30a';
$objPHPExcel->getActiveSheet()->getStyle($cell)->getFill()->applyFromArray(array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'startcolor' => array(
'rgb' => $color
)
));
}
Unfortunatelly it's not working. I'm trying to find others solutions online but I don't find anything
Thanks for your help