Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Two Conditional Style on the same cell #733

@iceman2hot4u

Description

@iceman2hot4u

Hey, I've been trying to make some conditional formatting on some cells but it keeps failing. It doesn't give me an error, it just doesn't popup the 'Save as (download)'. Here is my code:

    $objConditional1 = new \PHPExcel_Style_Conditional();
    $objConditional1->setConditionType(\PHPExcel_Style_Conditional::CONDITION_CELLIS);
    $objConditional1->setOperatorType(\PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN);
    $objConditional1->addCondition("0");
    $objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel_Style_Color::COLOR_DARKGREEN);

    $objConditional2 = new \PHPExcel_Style_Conditional();
    $objConditional2->setConditionType(\PHPExcel_Style_Conditional::CONDITION_CELLIS);
    $objConditional2->setOperatorType(\PHPExcel_Style_Conditional::OPERATOR_LESSTHAN);
    $objConditional2->addCondition("0");
    $objConditional2->getStyle()->getFont()->getColor()->setARGB(\PHPExcel_Style_Color::COLOR_RED);

    $conditionalStyles = $ews->getStyle($secondColumn)->getConditionalStyles();

    array_push($conditionalStyles, $objConditional1);
    array_push($conditionalStyles, $objConditional2);

    $ews->getStyle($secondColumn)->setConditionalStyles($conditionalStyles);

If I comment the second array_push it works. Any idea?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions