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) | → inherited from CollectionBase |
Reserved for internal use. | ||
function | clear() | → inherited from CollectionBase |
function | contains(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
function | copy(cfs) | |
Copies condtional formattings. | ||
function | get(index) | → inherited from CollectionBase |
Reserved for internal use. | ||
function | indexOf(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
function | iterator() | → inherited from CollectionBase |
function | removeArea(startRow, startColumn, totalRows, totalColumns) | |
Remove all conditional formattings in the range. | ||
function | removeAt(index) | → inherited from CollectionBase |
Property Getters/Setters Detail |
---|
getCount : Number | |
function getCount() |
get : FormatConditionCollection | |
function get(index) |
index
- The zero based index of the element.Method Detail |
---|
removeArea | |
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.copy | |
function copy(cfs) |
cfs: ConditionalFormattingCollection
- The condtional formattingsadd | |
function add() |
clear | |
function clear() |
removeAt | |
function removeAt(index) |
iterator | |
function iterator() |
get | |
function get(index) |
contains | |
function contains(value) |
add | |
function add(value) |
indexOf | |
function indexOf(value) |