Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['fillType'])) {
                $this->setFillType($pStyles['fillType']);
            }
            if (isset($pStyles['rotation'])) {
                $this->setRotation($pStyles['rotation']);
            }
            if (isset($pStyles['startColor'])) {
                $this->getStartColor()->applyFromArray($pStyles['startColor']);
            }
            if (isset($pStyles['endColor'])) {
                $this->getEndColor()->applyFromArray($pStyles['endColor']);
            }
            if (isset($pStyles['color'])) {
                $this->getStartColor()->applyFromArray($pStyles['color']);
                $this->getEndColor()->applyFromArray($pStyles['color']);
            }
        }

        return $this;
    }
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['fillType'])) {
                $this->setFillType($pStyles['fillType']);
            }
            if (isset($pStyles['rotation'])) {
                $this->setRotation($pStyles['rotation']);
            }
            if (isset($pStyles['startColor'])) {
                $this->getStartColor()->applyFromArray($pStyles['startColor']);
            }
            if (isset($pStyles['endColor'])) {
                $this->getEndColor()->applyFromArray($pStyles['endColor']);
            }
            if (isset($pStyles['color'])) {
                $this->getStartColor()->applyFromArray($pStyles['color']);
                $this->getEndColor()->applyFromArray($pStyles['color']);
            }
        }

        return $this;
    }
public function applyFromArray ( array $ pStyles ) { if ( $ this -> isSupervisor ) { $ this -> getActiveSheet ( ) -> getStyle ( $ this -> getSelectedCells ( ) ) -> applyFromArray ( $ this -> getStyleArray ( $ pStyles ) ) ; } else { if ( isset ( $ pStyles [ 'fillType' ] ) ) { $ this -> setFillType ( $ pStyles [ 'fillType' ] ) ; } if ( isset ( $ pStyles [ 'rotation' ] ) ) { $ this -> setRotation ( $ pStyles [ 'rotation' ] ) ; } if ( isset ( $ pStyles [ 'startColor' ] ) ) { $ this -> getStartColor ( ) -> applyFromArray ( $ pStyles [ 'startColor' ] ) ; } if ( isset ( $ pStyles [ 'endColor' ] ) ) { $ this -> getEndColor ( ) -> applyFromArray ( $ pStyles [ 'endColor' ] ) ; } if ( isset ( $ pStyles [ 'color' ] ) ) { $ this -> getStartColor ( ) -> applyFromArray ( $ pStyles [ 'color' ] ) ; $ this -> getEndColor ( ) -> applyFromArray ( $ pStyles [ 'color' ] ) ; } } return $ this ; }
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
[
'fillType' => Fill::FILL_GRADIENT_LINEAR,
'rotation' => 0,
'startColor' => [
'rgb' => '000000'
],
'endColor' => [
'argb' => 'FFFFFFFF'
]
]
);
</code>

@param array $pStyles Array containing style information

@throws PhpSpreadsheetException

@return Fill
Apply styles from array .