Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['name'])) {
                $this->setName($pStyles['name']);
            }
            if (isset($pStyles['bold'])) {
                $this->setBold($pStyles['bold']);
            }
            if (isset($pStyles['italic'])) {
                $this->setItalic($pStyles['italic']);
            }
            if (isset($pStyles['superscript'])) {
                $this->setSuperscript($pStyles['superscript']);
            }
            if (isset($pStyles['subscript'])) {
                $this->setSubscript($pStyles['subscript']);
            }
            if (isset($pStyles['underline'])) {
                $this->setUnderline($pStyles['underline']);
            }
            if (isset($pStyles['strikethrough'])) {
                $this->setStrikethrough($pStyles['strikethrough']);
            }
            if (isset($pStyles['color'])) {
                $this->getColor()->applyFromArray($pStyles['color']);
            }
            if (isset($pStyles['size'])) {
                $this->setSize($pStyles['size']);
            }
        }

        return $this;
    }
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['name'])) {
                $this->setName($pStyles['name']);
            }
            if (isset($pStyles['bold'])) {
                $this->setBold($pStyles['bold']);
            }
            if (isset($pStyles['italic'])) {
                $this->setItalic($pStyles['italic']);
            }
            if (isset($pStyles['superscript'])) {
                $this->setSuperscript($pStyles['superscript']);
            }
            if (isset($pStyles['subscript'])) {
                $this->setSubscript($pStyles['subscript']);
            }
            if (isset($pStyles['underline'])) {
                $this->setUnderline($pStyles['underline']);
            }
            if (isset($pStyles['strikethrough'])) {
                $this->setStrikethrough($pStyles['strikethrough']);
            }
            if (isset($pStyles['color'])) {
                $this->getColor()->applyFromArray($pStyles['color']);
            }
            if (isset($pStyles['size'])) {
                $this->setSize($pStyles['size']);
            }
        }

        return $this;
    }
public function applyFromArray ( array $ pStyles ) { if ( $ this -> isSupervisor ) { $ this -> getActiveSheet ( ) -> getStyle ( $ this -> getSelectedCells ( ) ) -> applyFromArray ( $ this -> getStyleArray ( $ pStyles ) ) ; } else { if ( isset ( $ pStyles [ 'name' ] ) ) { $ this -> setName ( $ pStyles [ 'name' ] ) ; } if ( isset ( $ pStyles [ 'bold' ] ) ) { $ this -> setBold ( $ pStyles [ 'bold' ] ) ; } if ( isset ( $ pStyles [ 'italic' ] ) ) { $ this -> setItalic ( $ pStyles [ 'italic' ] ) ; } if ( isset ( $ pStyles [ 'superscript' ] ) ) { $ this -> setSuperscript ( $ pStyles [ 'superscript' ] ) ; } if ( isset ( $ pStyles [ 'subscript' ] ) ) { $ this -> setSubscript ( $ pStyles [ 'subscript' ] ) ; } if ( isset ( $ pStyles [ 'underline' ] ) ) { $ this -> setUnderline ( $ pStyles [ 'underline' ] ) ; } if ( isset ( $ pStyles [ 'strikethrough' ] ) ) { $ this -> setStrikethrough ( $ pStyles [ 'strikethrough' ] ) ; } if ( isset ( $ pStyles [ 'color' ] ) ) { $ this -> getColor ( ) -> applyFromArray ( $ pStyles [ 'color' ] ) ; } if ( isset ( $ pStyles [ 'size' ] ) ) { $ this -> setSize ( $ pStyles [ 'size' ] ) ; } } return $ this ; }
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
[
'name' => 'Arial',
'bold' => TRUE,
'italic' => FALSE,
'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
'strikethrough' => FALSE,
'color' => [
'rgb' => '808080'
]
]
);
</code>

@param array $pStyles Array containing style information

@throws PhpSpreadsheetException

@return Font
Apply styles from array .