Hi all,

I'm using PHP with PHPExcel to create an excel sheet that I can then send as an email using mail().

Everything is working but the conditional formatting.

My code is as follows for the conditional formatting part:

// Conditions for data
$objConditional1 = new PHPExcel_Style_Conditional();

$objConditional2 = new PHPExcel_Style_Conditional();

$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B'.$row_condition_start)->getConditionalStyles();
array_push($conditionalStyles, $objConditional1);
array_push($conditionalStyles, $objConditional2);

//  duplicate the conditional styles across a range of cells

echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL;

Where $row_condition_start == 4 before this code snippet and $row_number == 9.
I am trying to use the conditional formatting on cells B4:B8.
If the cell value > 15 => Green, and < 10 => Red.

I can't see where I'm going wrong.

Thanks for any help offered.

5 Years
Discussion Span
Last Post by Tinnin
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.