You are here

public function PHPExcel_Style_Color::applyFromArray in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Color.php \PHPExcel_Style_Color::applyFromArray()

* Apply styles from array * * <code> * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') ); * </code> * *

Parameters

array $pStyles Array containing style information: * @throws PHPExcel_Exception * @return PHPExcel_Style_Color

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Color.php, line 160

Class

PHPExcel_Style_Color
PHPExcel_Style_Color

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('rgb', $pStyles)) {
        $this
          ->setRGB($pStyles['rgb']);
      }
      if (array_key_exists('argb', $pStyles)) {
        $this
          ->setARGB($pStyles['argb']);
      }
    }
  }
  else {
    throw new PHPExcel_Exception("Invalid style array passed.");
  }
  return $this;
}