Multi range
Methods
ConditionalFormat::multiRange(string $range): self
ConditionalFormat::stopIfTrue(bool $on = true): selfstring $range
bool $on
Multi-range example
$config = ['path' => './tests'];
$excel = new \Vtiful\Kernel\Excel($config);
$fileObject = $excel->fileName('tutorial.xlsx');
$fileHandle = $fileObject->getHandle();
$highlight = (new \Vtiful\Kernel\Format($fileHandle))
->background(\Vtiful\Kernel\Format::COLOR_RED)
->fontColor(\Vtiful\Kernel\Format::COLOR_WHITE)
->toResource();
$cf = new \Vtiful\Kernel\ConditionalFormat();
$cf->type(\Vtiful\Kernel\ConditionalFormat::TYPE_CELL)
->criteria(\Vtiful\Kernel\ConditionalFormat::CRITERIA_GREATER_THAN)
->value(50)
->format($highlight)
->multiRange('A2:A6 C2:C6 E2:E6');
// conditionalFormatRange still needs a starting range for the first parameter;
// the actual targets come from the multiRange() string above.
$fileObject->header(['x', '_', 'y', '_', 'z'])
->data([
[10, '', 60, '', 30],
[70, '', 20, '', 80],
[55, '', 45, '', 90],
[40, '', 35, '', 25],
[85, '', 65, '', 15],
])
->conditionalFormatRange('A2:A6', $cf)
->output();stopIfTrue example
Last updated