-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cell style modified #2441
Comments
I can tell you what happened. I need to do some research to figure out what should happen. Fill patterns are assigned a start and end color in the constructor. In your original spreadsheet, the fill pattern is output without a start and end color. In the copied version, it is output with a start and end color, which I believe is correct for some other patterns, but apparently not correct for lightUp and, presumably, other patterns. |
Fix PHPOffice#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.
I have similar problem, when set a background color in 1.20.0 version dont fill range cell but works well in 1.17.1
I dont know if same problem. Which versions of PhpSpreadsheet and PHP are affected? "name": "phpoffice/phpspreadsheet", |
I am guessing that you are specifying |
* 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().
This is:
What is the expected behavior?
Cell Style not modified
What is the current behavior?
Cell Style modified
What are the steps to reproduce?
I created an xlsx model with Excel with cells like that
I made a reader.
I modified some cells (not the cell I show)
I made a writer.
I opened the file. The cell style was modified like that
File :
Classeur1.xlsx
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
PHP 7.3.21 (cli) (built: Aug 4 2020 11:21:19) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.21, Copyright (c) 1998-2018 Zend Technologies
"name": "phpoffice/phpspreadsheet",
"version": "1.20.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02"
The text was updated successfully, but these errors were encountered: