Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['left'])) {
                $this->getLeft()->applyFromArray($pStyles['left']);
            }
            if (isset($pStyles['right'])) {
                $this->getRight()->applyFromArray($pStyles['right']);
            }
            if (isset($pStyles['top'])) {
                $this->getTop()->applyFromArray($pStyles['top']);
            }
            if (isset($pStyles['bottom'])) {
                $this->getBottom()->applyFromArray($pStyles['bottom']);
            }
            if (isset($pStyles['diagonal'])) {
                $this->getDiagonal()->applyFromArray($pStyles['diagonal']);
            }
            if (isset($pStyles['diagonalDirection'])) {
                $this->setDiagonalDirection($pStyles['diagonalDirection']);
            }
            if (isset($pStyles['allBorders'])) {
                $this->getLeft()->applyFromArray($pStyles['allBorders']);
                $this->getRight()->applyFromArray($pStyles['allBorders']);
                $this->getTop()->applyFromArray($pStyles['allBorders']);
                $this->getBottom()->applyFromArray($pStyles['allBorders']);
            }
        }

        return $this;
    }
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['left'])) {
                $this->getLeft()->applyFromArray($pStyles['left']);
            }
            if (isset($pStyles['right'])) {
                $this->getRight()->applyFromArray($pStyles['right']);
            }
            if (isset($pStyles['top'])) {
                $this->getTop()->applyFromArray($pStyles['top']);
            }
            if (isset($pStyles['bottom'])) {
                $this->getBottom()->applyFromArray($pStyles['bottom']);
            }
            if (isset($pStyles['diagonal'])) {
                $this->getDiagonal()->applyFromArray($pStyles['diagonal']);
            }
            if (isset($pStyles['diagonalDirection'])) {
                $this->setDiagonalDirection($pStyles['diagonalDirection']);
            }
            if (isset($pStyles['allBorders'])) {
                $this->getLeft()->applyFromArray($pStyles['allBorders']);
                $this->getRight()->applyFromArray($pStyles['allBorders']);
                $this->getTop()->applyFromArray($pStyles['allBorders']);
                $this->getBottom()->applyFromArray($pStyles['allBorders']);
            }
        }

        return $this;
    }
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
[
'bottom' => [
'borderStyle' => Border::BORDER_DASHDOT,
'color' => [
'rgb' => '808080'
]
],
'top' => [
'borderStyle' => Border::BORDER_DASHDOT,
'color' => [
'rgb' => '808080'
]
]
]
);
</code>

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
[
'allBorders' => [
'borderStyle' => Border::BORDER_DASHDOT,
'color' => [
'rgb' => '808080'
]
]
]
);
</code>

@param array $pStyles Array containing style information

@throws PhpSpreadsheetException

@return Borders