php - How to conditionally format duplicate values with PHPExcel -
i'm trying set conditional formatting duplicate values using phpexcel.
the class phpexcel_style_conditional
exports of conditions available in excel operator_greaterthan
, operator_lessthan
etc. can't find format duplicate values this:
i know, check duplicates myself , format them accordingly, using excel's own feature set more elegant.
does know how this?
after digging deeper phpexcel
's code, found out conditional type isn't supported yet.
so added myself , created pull request it: phpexcel - pr: add support conditionally formatting duplicate values
i'll update answer merged.
if you're inpatient, temporarily perform 2 (really small) changes pr on own. after can add conditional formatting of duplicate values excel sheets this:
$conditional = new phpexcel_style_conditional(); $conditional->setconditiontype(phpexcel_style_conditional::condition_duplicatevalues); $conditional->getstyle()->getfont()->getcolor()->setargb(phpexcel_style_color::color_red); $style = $sheet->getstyle('a1:a10'); $conditionalstyles = $style->getconditionalstyles(); array_push($conditionalstyles, $conditional); $style->setconditionalstyles($conditionalstyles);
Comments
Post a Comment