Example:
$workbook = new cells\Workbook();
$sheet = $workbook->getWorksheets()->get(0);
//Adds an empty conditional formatting
$index = $sheet->getConditionalFormattings()->add();
$fcs = $sheet->getConditionalFormattings()->get($index);
//Sets the conditional format range
$ca = new cells\CellArea();
$ca->StartRow = 0;
$ca->EndRow = 2;
$ca->StartColumn = 0;
$ca->EndColumn = 0;
$fcs->addArea($ca);
//Adds condition
$idx = $fcs->addCondition(cells\FormatConditionType::DATA_BAR);
$fcs->addArea($ca);
$cond = $fcs->get($idx);
//Get Databar
$dataBar = $cond->getDataBar();
$dataBar->setColor(cells\Color::getOrange());
//Set Databar properties
$dataBar->getMinCfvo()->setType(cells\FormatConditionValueType::PERCENTILE);
$dataBar->getMinCfvo()->setValue(30);
$dataBar->setShowValue(false);
//Put Cell Values
$sheet->getCells()->get("A1")->putValue(10);
$sheet->getCells()->get("A2")->putValue(120);
$sheet->getCells()->get("A3")->putValue(260);
| Property Getters/Setters Summary | ||
|---|---|---|
function | getAxisColor() | |
function | setAxisColor(value) | |
| Gets the color of the axis for cells with conditional formatting as data bars. | ||
function | getAxisPosition() | |
function | setAxisPosition(value) | |
| Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant. | ||
function | getBarBorder() | |
Gets an object that specifies the border of a data bar.
|
||
function | getBarFillType() | |
function | setBarFillType(value) | |
| Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant. | ||
function | getColor() | |
function | setColor(value) | |
| Get or set this DataBar's Color. | ||
function | getDirection() | |
function | setDirection(value) | |
| Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant. | ||
function | getMaxCfvo() | |
Get or set this DataBar's max value object.
Cannot set null or CFValueObject with type FormatConditionValueType.Min to it.
|
||
function | getMaxLength() | |
function | setMaxLength(value) | |
| Represents the max length of data bar . | ||
function | getMinCfvo() | |
Get or set this DataBar's min value object.
Cannot set null or CFValueObject with type FormatConditionValueType.Max to it.
|
||
function | getMinLength() | |
function | setMinLength(value) | |
| Represents the min length of data bar . | ||
function | getNegativeBarFormat() | |
Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
|
||
function | getShowValue() | |
function | setShowValue(value) | |
| Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true. | ||
| Method Summary | ||
|---|---|---|
function | toImage(cell, imgOpts) | |
Render data bar in cell to image byte array.
|
||
function getAxisColor() / function setAxisColor(value)
function getAxisPosition() / function setAxisPosition(value)
function getBarFillType() / function setBarFillType(value)
function getDirection() / function setDirection(value)
function getBarBorder()
function getNegativeBarFormat()
function getMinCfvo()
function getMaxCfvo()
function getColor() / function setColor(value)
function getMinLength() / function setMinLength(value)
function getMaxLength() / function setMaxLength(value)
function getShowValue() / function setShowValue(value)