protected function Xls::setHeaderRowBackgroundColor in Excel Serialization 8
Set background color of the header (first) row.
Parameters
\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet: The worksheet to set the background color of the header row.
string $rgb: The worksheet to set the background color of the header row.
Throws
\PhpOffice\PhpSpreadsheet\Exception
1 call to Xls::setHeaderRowBackgroundColor()
- Xls::encode in src/
Encoder/ Xls.php - Encodes data into the given format.
File
- src/
Encoder/ Xls.php, line 380
Class
- Xls
- Adds XLS encoder support for the Serialization API.
Namespace
Drupal\xls_serialization\EncoderCode
protected function setHeaderRowBackgroundColor(Worksheet $sheet, $rgb) {
$style = [
'fill' => [
'fillType' => Fill::FILL_SOLID,
'startColor' => [
'argb' => 'FF' . $rgb,
],
'endColor' => [
'argb' => 'FF' . $rgb,
],
],
];
$sheet
->getStyle('A1:' . $sheet
->getHighestDataColumn() . '1')
->applyFromArray($style);
}