From e2f87e8b7a4482f44cfaf5743720dc911141bc3f Mon Sep 17 00:00:00 2001 From: bbinotto Date: Fri, 14 Feb 2020 14:32:41 +0100 Subject: [PATCH] Load with styles should not default to black fill color Fixes #1353 Closes #1361 --- CHANGELOG.md | 1 + src/PhpSpreadsheet/Reader/Xlsx.php | 2 -- tests/PhpSpreadsheetTests/Reader/XlsxTest.php | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f4bae1a..a25c9c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Fix loading styles from vmlDrawings when containing whitespace [#1347](https://github.com/PHPOffice/PhpSpreadsheet/issues/1347) - Fix incorrect behavior when removing last row [#1365](https://github.com/PHPOffice/PhpSpreadsheet/pull/1365) - MATCH with a static array should return the position of the found value based on the values submitted [#1332](https://github.com/PHPOffice/PhpSpreadsheet/pull/1332) +- Fix Xlsx Reader's handling of undefined fill color [#1353](https://github.com/PHPOffice/PhpSpreadsheet/pull/1353) ## [1.11.0] - 2020-03-02 diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 428014c3..566e9fbb 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -1620,8 +1620,6 @@ class Xlsx extends BaseReader $docStyle->getFill()->setFillType($patternType); if ($style->fill->patternFill->fgColor) { $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true)); - } else { - $docStyle->getFill()->getStartColor()->setARGB('FF000000'); } if ($style->fill->patternFill->bgColor) { $docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true)); diff --git a/tests/PhpSpreadsheetTests/Reader/XlsxTest.php b/tests/PhpSpreadsheetTests/Reader/XlsxTest.php index f178e851..246b5a47 100644 --- a/tests/PhpSpreadsheetTests/Reader/XlsxTest.php +++ b/tests/PhpSpreadsheetTests/Reader/XlsxTest.php @@ -83,8 +83,8 @@ class XlsxTest extends TestCase { $expectedColours = [ 1 => ['A' => 'C00000', 'C' => 'FF0000', 'E' => 'FFC000'], - 3 => ['A' => '7030A0', 'C' => '000000', 'E' => 'FFFF00'], - 5 => ['A' => '002060', 'C' => '000000', 'E' => '92D050'], + 3 => ['A' => '7030A0', 'C' => 'FFFFFF', 'E' => 'FFFF00'], + 5 => ['A' => '002060', 'C' => 'FFFFFF', 'E' => '92D050'], 7 => ['A' => '0070C0', 'C' => '00B0F0', 'E' => '00B050'], ];