From 720fb3eff52b1103ca4ddd278e5b081162ec9fd6 Mon Sep 17 00:00:00 2001 From: jacobsreynolds Date: Wed, 26 Oct 2016 12:52:04 -0500 Subject: [PATCH] Read background color of cells from HTML file If a in HTML has a bgcolor attribute, it is then applied to the spreadsheet file --- src/PhpSpreadsheet/Reader/HTML.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PhpSpreadsheet/Reader/HTML.php b/src/PhpSpreadsheet/Reader/HTML.php index d6818529..103d0ba6 100644 --- a/src/PhpSpreadsheet/Reader/HTML.php +++ b/src/PhpSpreadsheet/Reader/HTML.php @@ -466,6 +466,15 @@ class HTML extends BaseReader implements IReader } $sheet->mergeCells($column . $row . ':' . $columnTo . $row); $column = $columnTo; + } elseif (isset($attributeArray['bgcolor'])) { + $sheet->getStyle($column . $row)->applyFromArray( + [ + 'fill' => [ + 'type' => PHPExcel_Style_Fill::FILL_SOLID, + 'color' => ['rgb' => $attributeArray['bgcolor']], + ], + ] + ); } ++$column; break;