You are here

public function PHPExcel_Style_Protection::applyFromArray in Loft Data Grids 6.2

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

Apply styles from array

<code> $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array( 'locked' => TRUE, 'hidden' => FALSE ) ); </code>

Parameters

array $pStyles Array containing style information:

Return value

PHPExcel_Style_Protection

Throws

PHPExcel_Exception

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Protection.php, line 117

Class

PHPExcel_Style_Protection
PHPExcel_Style_Protection

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['locked'])) {
        $this
          ->setLocked($pStyles['locked']);
      }
      if (isset($pStyles['hidden'])) {
        $this
          ->setHidden($pStyles['hidden']);
      }
    }
  }
  else {
    throw new PHPExcel_Exception("Invalid style array passed.");
  }
  return $this;
}