PhpSpreadsheet/samples/Basic
oleibman 67bf45d700
Fill Pattern Start and End Colors (#2444)
* Fill Pattern Start and End Colors

Fix #2441. The Fill constructor sets start color to white and end color to black and the Xlsx writer writes these values to the output file. This appears to be the wrong setting for all 7 LIGHT* pattern types, 2 of the 7 DARK* patterns (DARKGRAY and DARKTRELLIS), and 1 of the 3 GRAY patterns (GRAY0625). When the wrong colors are written at save time, those patterns are not as expected. Xls writer does not appear to have the same problem.

The XML does not require either a start or end color, and the omission of these colors in the file being read was responsible for the problem. The code is changed to mimic that behavior by omitting the color tags at write time if they have not changed from when they were created by the Fill constructor (they will be written for gradient or solid patterns regardless).

This is another change which is easier to confirm via samples rather than tests. There are separate samples for Xlsx and Xls; as Excel will be quick to warn you, Xls is not as fully functional as Xlsx with respect to fill patterns. The samples do include a cell where one of the cells (LightGrid in C11) explicitly specifies the "default" colors.

* Scrutinizer

It somehow ascribed to me a problem in code which was unchanged by this PR. Correct it anyhow, along with some Phpstan fixes (errors now ignored because of change).

* Added Tests

Also corrected some docBlock problems with Style/*/parent and getSharedComponent.

* Create 2 Abstract Methods

Scrutinizer complained that 2 methods found in all Supervisor sub-types were not defined in Supervisor. Add abstract methods to satisfy it.

* Scrutinizer Ignoring Typehints

Try this instead.

* Slight Improvement

Better handling of Style->getParent().
2021-12-18 08:53:23 -08:00
..
data/continents Merge all examples together 2017-10-01 17:48:59 +09:00
01_Simple.php Document Properties - Coverage and 32-bit-safe Timestamps (#2113) 2021-05-30 13:55:58 +02:00
01_Simple_download_ods.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_pdf.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_xls.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_xlsx.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
02_Types.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
03_Formulas.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
04_Printing.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
05_Feature_demo.php Merge all examples together 2017-10-01 17:48:59 +09:00
05_UnexpectedCharacters.php Special Characters in Image File Name (#2416) 2021-12-06 06:50:09 -08:00
06_Largescale.php Merge all examples together 2017-10-01 17:48:59 +09:00
07_Reader.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
08_Conditional_formatting.php Upgrade to latest PHP_CodeSniffer 2018-08-06 11:02:16 +09:00
08_Conditional_formatting_2.php Upgrade to latest PHP_CodeSniffer 2018-08-06 11:02:16 +09:00
09_Pagebreaks.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
11_Documentsecurity.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
12_CellProtection.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
13_Calculation.php PSR12 code style 2020-07-26 14:13:11 +09:00
13_CalculationCyclicFormulae.php PSR12 code style 2020-07-26 14:13:11 +09:00
14_Xls.php Merge all examples together 2017-10-01 17:48:59 +09:00
15_Datavalidation.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
16_Csv.php Fix for Issue 2042 (SUM Partially Broken) (#2045) 2021-05-03 18:31:01 +02:00
17_Html.php Merge all examples together 2017-10-01 17:48:59 +09:00
17a_Html.php Improve HTML Writer (#1464) 2020-05-18 12:43:18 +09:00
17b_Html.php Different Example for Callback 2020-06-09 00:22:22 -07:00
18_Extendedcalculation.php Rename classes to keep them in their related namespaces 2017-10-29 17:39:42 +09:00
19_Namedrange.php Two Problems with Sample19 2021-05-09 15:41:36 -07:00
20_Read_Excel2003XML.php Improving Coverage for Excel2003 XML Reader (#1557) 2020-10-11 13:26:56 +02:00
20_Read_Gnumeric.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Ods.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Sylk.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Xls.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
22_Heavily_formatted.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
23_Sharedstyles.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
24_Readfilter.php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
25_In_memory_image.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
26_Utf8.php Remove tests that include tcPDF and DomPDF libraries when running against PHP8, because neither library is yet PHP8-ready 2020-10-09 14:31:16 +02:00
27_Images_Xls.php Merge all examples together 2017-10-01 17:48:59 +09:00
28_Iterator.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
29_Advanced_value_binder.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
30_Template.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
30_Templatebiff5.php Stacked Alignment - Use Class Constant Rather than Literal (#1716) 2021-02-03 23:53:04 +01:00
31_Document_properties_write.php Minor improvements (#1028) 2019-06-22 21:24:51 +02:00
31_Document_properties_write_xls.php Minor improvements (#1028) 2019-06-22 21:24:51 +02:00
37_Page_layout_view.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
38_Clone_worksheet.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
39_Dropdown.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
40_Duplicate_style.php Additional conditionals from math trig (#1885) 2021-02-28 10:24:33 +01:00
41_Password.php Merge all examples together 2017-10-01 17:48:59 +09:00
42_RichText.php Improve Coverage for HTML Reader 2020-06-25 22:42:38 -07:00
43_Merge_workbooks.php Initial Formula Translation tests (#1886) 2021-02-28 13:18:51 +01:00
44_Worksheet_info.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
45_Quadratic_equation_solver.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
46_ReadHtml.php Merge all examples together 2017-10-01 17:48:59 +09:00
47_xlsfill.php Fill Pattern Start and End Colors (#2444) 2021-12-18 08:53:23 -08:00
47_xlsxfill.php Fill Pattern Start and End Colors (#2444) 2021-12-18 08:53:23 -08:00