Using expression for conditional formatting

Topics: Developer Forum, Project Management Forum, User Forum
Oct 30, 2008 at 12:10 PM
Edited Oct 30, 2008 at 12:11 PM
Hi Everyone,
The conditional formatting now has new constant CONDITION_EXPRESSION, how to use this, I to want apply `between` rule in my application.
Thanks in advance
Oct 31, 2008 at 12:22 PM
Edited Oct 31, 2008 at 12:29 PM
I'm quite sure that the between is not currently supported in PHPExcel. I created work item for monitoring.

As you suggest, a workaround is to use a formula returning true when the cell value is within a certain interval. It is not so elegant because you are required to know the coordinates of the cell the rule is applied to, but it may work:

$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();

$styleArray = array(
    'font' => array(
        'bold' => true,
        'color' => array(
            'rgb' => 'ff0000',
$styleConditional = new PHPExcel_Style_Conditional();

$conditionalsStyles[] = $styleConditional;


$writer = new PHPExcel_Writer_Excel2007($excel);

Oct 31, 2008 at 1:16 PM
will not solve my problem, but want to know more about CONDITION_EXPRESSION.