You are here

public function PHPExcel_Style_Border::applyFromArray in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Border.php \PHPExcel_Style_Border::applyFromArray()

* Apply styles from array * * <code> * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( * array( * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, * 'color' => array( * 'rgb' => '808080' * ) * ) * ); * </code> * *

Parameters

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

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Border.php, line 195

Class

PHPExcel_Style_Border
PHPExcel_Style_Border

Code

public function applyFromArray($pStyles = null) {
  if (is_array($pStyles)) {
    if ($this->_isSupervisor) {
      $this
        ->getActiveSheet()
        ->getStyle($this
        ->getSelectedCells())
        ->applyFromArray($this
        ->getStyleArray($pStyles));
    }
    else {
      if (isset($pStyles['style'])) {
        $this
          ->setBorderStyle($pStyles['style']);
      }
      if (isset($pStyles['color'])) {
        $this
          ->getColor()
          ->applyFromArray($pStyles['color']);
      }
    }
  }
  else {
    throw new PHPExcel_Exception("Invalid style array passed.");
  }
  return $this;
}