Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())
                ->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['horizontal'])) {
                $this->setHorizontal($pStyles['horizontal']);
            }
            if (isset($pStyles['vertical'])) {
                $this->setVertical($pStyles['vertical']);
            }
            if (isset($pStyles['textRotation'])) {
                $this->setTextRotation($pStyles['textRotation']);
            }
            if (isset($pStyles['wrapText'])) {
                $this->setWrapText($pStyles['wrapText']);
            }
            if (isset($pStyles['shrinkToFit'])) {
                $this->setShrinkToFit($pStyles['shrinkToFit']);
            }
            if (isset($pStyles['indent'])) {
                $this->setIndent($pStyles['indent']);
            }
            if (isset($pStyles['readOrder'])) {
                $this->setReadOrder($pStyles['readOrder']);
            }
        }

        return $this;
    }
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())
                ->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['horizontal'])) {
                $this->setHorizontal($pStyles['horizontal']);
            }
            if (isset($pStyles['vertical'])) {
                $this->setVertical($pStyles['vertical']);
            }
            if (isset($pStyles['textRotation'])) {
                $this->setTextRotation($pStyles['textRotation']);
            }
            if (isset($pStyles['wrapText'])) {
                $this->setWrapText($pStyles['wrapText']);
            }
            if (isset($pStyles['shrinkToFit'])) {
                $this->setShrinkToFit($pStyles['shrinkToFit']);
            }
            if (isset($pStyles['indent'])) {
                $this->setIndent($pStyles['indent']);
            }
            if (isset($pStyles['readOrder'])) {
                $this->setReadOrder($pStyles['readOrder']);
            }
        }

        return $this;
    }
public function applyFromArray ( array $ pStyles ) { if ( $ this -> isSupervisor ) { $ this -> getActiveSheet ( ) -> getStyle ( $ this -> getSelectedCells ( ) ) -> applyFromArray ( $ this -> getStyleArray ( $ pStyles ) ) ; } else { if ( isset ( $ pStyles [ 'horizontal' ] ) ) { $ this -> setHorizontal ( $ pStyles [ 'horizontal' ] ) ; } if ( isset ( $ pStyles [ 'vertical' ] ) ) { $ this -> setVertical ( $ pStyles [ 'vertical' ] ) ; } if ( isset ( $ pStyles [ 'textRotation' ] ) ) { $ this -> setTextRotation ( $ pStyles [ 'textRotation' ] ) ; } if ( isset ( $ pStyles [ 'wrapText' ] ) ) { $ this -> setWrapText ( $ pStyles [ 'wrapText' ] ) ; } if ( isset ( $ pStyles [ 'shrinkToFit' ] ) ) { $ this -> setShrinkToFit ( $ pStyles [ 'shrinkToFit' ] ) ; } if ( isset ( $ pStyles [ 'indent' ] ) ) { $ this -> setIndent ( $ pStyles [ 'indent' ] ) ; } if ( isset ( $ pStyles [ 'readOrder' ] ) ) { $ this -> setReadOrder ( $ pStyles [ 'readOrder' ] ) ; } } return $ this ; }
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
[
'horizontal'   => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical'     => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
'textRotation' => 0,
'wrapText'     => TRUE
]
);
</code>

@param array $pStyles Array containing style information

@throws PhpSpreadsheetException

@return Alignment
Apply styles from array .