Conditional Formatting: Alternate rows

Topics: User Forum
Jul 18, 2011 at 9:29 AM

Hey,

I'm trying to set alternate row formatting with conditional formatting using the same formula I use with excel. Excel 2007 removes the conditional formatting.

Conditional rules:

  $objConditional1 = new PHPExcel_Style_Conditional();
  $objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION);
  $objConditional1->addCondition('=MOD(ROW();2)');
  $objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW);
  $objConditional1->getStyle()->getFont()->setBold(true);

Is the formula incorrect? It works in excel.. I would like to use conditional formatting instead of setting fills for each row.