Example:
$workbook = new cells\Workbook(); $sheet = $workbook->getWorksheets()->get(0); //Get Conditional Formattings $cformattings = $sheet->getConditionalFormattings(); //Adds an empty conditional formatting $index = $cformattings->add(); //Get newly added Conditional formatting $fcs = $cformattings->get($index); //Sets the conditional format range $ca = new cells\CellArea(); $ca->StartRow = 0; $ca->EndRow = 0; $ca->StartColumn = 0; $ca->EndColumn = 0; $fcs->addArea($ca); $ca = new cells\CellArea(); $ca->StartRow = 1; $ca->EndRow = 1; $ca->StartColumn = 1; $ca->EndColumn = 1; $fcs->addArea($ca); //Add condition $conditionIndex = $fcs->addCondition(cells\FormatConditionType::CELL_VALUE, cells\OperatorType::BETWEEN, "=A2", "100"); //Add condition $conditionIndex2 = $fcs->addCondition(cells\FormatConditionType::CELL_VALUE, cells\OperatorType::BETWEEN, "50", "100"); //Sets the background color $fc = $fcs->get($conditionIndex); $fc->getStyle()->setBackgroundColor(cells\Color::getRed());
Property Getters/Setters Summary | ||
---|---|---|
function | getCount() | |
function | get(index) | |
Gets the FormatConditions element at the specified index.
|
Method Summary | ||
---|---|---|
function | add() | |
Adds a FormatConditions to the collection.
|
||
function | add(value) | |
Reserved for internal use. |
||
function | clear() | |
function | contains(value) | |
Reserved for internal use. |
||
function | copy(cfs) | |
Copies conditional formatting.
|
||
function | get(index) | |
Reserved for internal use. |
||
function | indexOf(value) | |
Reserved for internal use. |
||
function | iterator() | |
function | removeArea(startRow, startColumn, totalRows, totalColumns) | |
Remove all conditional formatting in the range.
|
||
function | removeAt(index) | |
function getCount()
function get(index)
index
- The zero based index of the element.function removeArea(startRow, startColumn, totalRows, totalColumns)
startRow: Number
- The start row of the range.startColumn: Number
- The start column of the range.totalRows: Number
- The number of rows of the range.totalColumns: Number
- The number of columns of the range.function copy(cfs)
cfs: ConditionalFormattingCollection
- The conditional formattingfunction add()
function clear()
function removeAt(index)
function iterator()
function get(index)
function contains(value)
function add(value)
function indexOf(value)