You are here

public function PHPExcel_Style_NumberFormat::applyFromArray in Loft Data Grids 6.2

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

* Apply styles from array * * <code> * $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( * array( * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE * ) * ); * </code> * *

Parameters

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

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/NumberFormat.php, line 164

Class

PHPExcel_Style_NumberFormat
PHPExcel_Style_NumberFormat

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('code', $pStyles)) {
        $this
          ->setFormatCode($pStyles['code']);
      }
    }
  }
  else {
    throw new PHPExcel_Exception("Invalid style array passed.");
  }
  return $this;
}