0
PHPExcel條件格式提供了一些有用的條件和運營商...PHPExcel日期格式存在的這個星期
我申請的條件,像這樣:
$aCondition = new PHPExcel_Style_Conditional();
$aCondition->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_EQUAL)
->addCondition('AND(($B2<>$B3),$B2<>"")');
$aCondition->getStyle()->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$aCondition->getStyle()->getNumberFormat()->setFormatCode($dateFormat);
$conditionalStyles = $sheet->getStyle('B2')->getConditionalStyles();
array_push($conditionalStyles, $aCondition);
$sheet->getStyle('$'.$letter.'2:$'.$letter.'10000')->setConditionalStyles($conditionalStyles);
然而,當我到Excel文檔中..它標記着細胞黃色,即使它不應該是......但是如果我然後進入細胞並按下enter ...細胞就會失去它的黃色,然後條件格式正常工作...
我對這個單元格的行應用格式如下:
$sheet->getStyle('M2:M9999')
->getNumberFormat()
->setFormatCode("dd/mm/yyyy");