PhpSpreadsheet/tests/PhpSpreadsheetTests/Writer/Html
oleibman e97428ba67
Html Writer - Do Not Generate background-color When Fill is None (#3016)
* Html Writer - Do Not Generate background-color When Fill is None

For PR #3002, I noted that there was a problem with Dompdf truncating images. I raised an issue with them (https://github.com/dompdf/dompdf/issues/2980), and they agree that there is a bug; however, they also suggested a workaround, namely omitting background-color from any cells which the image overlays. That did not at first appear to be a solution which could be generalized for PhpSpreasheet. However, investigating further, I saw that Html Writer is generating background-color for all cells, even though most of them use the default Fill type None (which suggests that background-color should not be specified after all). So this PR changes HTML Writer to generate background-color only when the user has actually set Fill type to something other than None. This is not a complete workaround for the Dompdf problem - we will still see truncation if the image overlays a cell which does specify a Fill type - however, it is almost certainly good enough for most use cases.

In addition to that change, I made the generated Html a little smaller and the code a little more efficient by combining the TD and TH styles for each cell into a single declaration and calling createCssStyle only once.

* Revamp One Test

Look for both td.style and th.style instead of just td.style in test.
2022-08-24 18:00:37 -07:00
..
AllOrOneSheetTest.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
CallbackTest.php Phpstan Differences from Php7 to Php8, Again (#2665) 2022-03-11 23:28:30 -08:00
ExtendForChartsAndImagesTest.php Don't ouput row and columns without any cells in HTML writer 2020-06-28 22:03:37 +09:00
GridlinesTest.php Phpstan Differences from Php7 to Php8, Again (#2665) 2022-03-11 23:28:30 -08:00
HtmlCommentsTest.php Phpstan Differences from Php7 to Php8, Again (#2665) 2022-03-11 23:28:30 -08:00
HtmlNumberFormatTest.php Changes to the default arguments for `htmlspecialchars()` and `html_entity_decode()` requires setting of the argument value explicitly to prevent changes in behaviour. (#2176) 2021-06-21 12:56:03 +02:00
ImageCopyTest.php Copy from Xls(x) to Html/Pdf Loses Drawings (#2788) 2022-05-07 08:10:24 -07:00
ImagesRootTest.php 2 Tests vs. Scrutinizer/Phpstan 2021-07-01 11:15:02 +02:00
InvalidFileNameTest.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
RepeatedRowsTest.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
TextRotationTest.php Fix Some Pdf Problems (#2960) 2022-07-29 06:14:28 -07:00
VisibilityTest.php Html Writer - Do Not Generate background-color When Fill is None (#3016) 2022-08-24 18:00:37 -07:00
XssVulnerabilityTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00