You are here

public function PHPExcel_Style_Alignment::setTextRotation in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Alignment.php \PHPExcel_Style_Alignment::setTextRotation()

* Set TextRotation * *

Parameters

int $pValue: * @throws PHPExcel_Exception * @return PHPExcel_Style_Alignment

1 call to PHPExcel_Style_Alignment::setTextRotation()
PHPExcel_Style_Alignment::applyFromArray in vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Alignment.php
* Apply styles from array * * <code> * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( * array( * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, …

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Alignment.php, line 289

Class

PHPExcel_Style_Alignment
PHPExcel_Style_Alignment

Code

public function setTextRotation($pValue = 0) {

  // Excel2007 value 255 => PHPExcel value -165
  if ($pValue == 255) {
    $pValue = -165;
  }

  // Set rotation
  if ($pValue >= -90 && $pValue <= 90 || $pValue == -165) {
    if ($this->_isSupervisor) {
      $styleArray = $this
        ->getStyleArray(array(
        'rotation' => $pValue,
      ));
      $this
        ->getActiveSheet()
        ->getStyle($this
        ->getSelectedCells())
        ->applyFromArray($styleArray);
    }
    else {
      $this->_textRotation = $pValue;
    }
  }
  else {
    throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90.");
  }
  return $this;
}