public function PHPExcel_Style_Fill::applyFromArray in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Fill.php \PHPExcel_Style_Fill::applyFromArray()
* Apply styles from array * * <code> * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( * array( * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, * 'rotation' => 0, * 'startcolor' => array( * 'rgb' => '000000' * ), * 'endcolor' => array( * 'argb' => 'FFFFFFFF' * ) * ) * ); * </code> * *
Parameters
array $pStyles Array containing style information: * @throws PHPExcel_Exception * @return PHPExcel_Style_Fill
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Style/ Fill.php, line 162
Class
- PHPExcel_Style_Fill
- PHPExcel_Style_Fill
Code
public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this
->getActiveSheet()
->getStyle($this
->getSelectedCells())
->applyFromArray($this
->getStyleArray($pStyles));
}
else {
if (array_key_exists('type', $pStyles)) {
$this
->setFillType($pStyles['type']);
}
if (array_key_exists('rotation', $pStyles)) {
$this
->setRotation($pStyles['rotation']);
}
if (array_key_exists('startcolor', $pStyles)) {
$this
->getStartColor()
->applyFromArray($pStyles['startcolor']);
}
if (array_key_exists('endcolor', $pStyles)) {
$this
->getEndColor()
->applyFromArray($pStyles['endcolor']);
}
if (array_key_exists('color', $pStyles)) {
$this
->getStartColor()
->applyFromArray($pStyles['color']);
}
}
}
else {
throw new PHPExcel_Exception("Invalid style array passed.");
}
return $this;
}