-
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
Image and gray disappear after IOFactory::createWriter and save #4248
Comments
I have downloaded your spreadsheet, and used PhpSpreadsheet to load and save it to a new file. Except for one svg image (we do not handle svg), all the images and the gray backgrounds are present in the output file. What do you think is missing? It might help if you upload your output file so that I can see where it differs from mine. |
Ah, yes, sorry I missed that. I will see what I can find. |
Looks like another simple problem that will be difficult to solve. Every fill style has a start color and an end color, which the constructor by default initializes to white and black. And what documentation there is always shows the Xml containing both a start and and end color. So, what's in your spreadsheet? Several fill styles with an end color and no start color. In the case of the "darkDown" pattern (and certainly other patterns), which is what the cells in question use, the start color is used as the color of the dots or stripes or whatever distinguishes this pattern from the other possibilities. When the start color is omitted, Excel uses an "automatic" color. In this case, the automatic color is black (I have no idea if this is always the case), but since we initialize the color to white, that's what is being used, and why you see a discrepancy between your input and output files. So I need to find a way to implement automatic colors in a manner which fixes your case without causing compatibility breaks for others. It could take a while. If you truly need this fixed while I am working on a solution, you could iterate through all the styles, and change the start color for darkdown patterns from white to black. I can supply code to do this if you need it. Other changes might be needed. |
It appears that background color can also be omitted, and pattern type can be omitted in conditional styles. |
Fix PHPOffice#4248. PhpSpreadsheet has used what appear to be default attributes and tags when they are missing from Fill patterns and colors. However, Excel handles their absence a little differently from what the "default" would require. PhpSpreadsheet is changed to omit the attributes and tags in question when missing. This change is mostly targeted towards Xlsx read and write, but minor changes for Xls and Html write are also included. This seems like it could be a breaking change, but I don't think it is. One test (DefaultFillTest introduced by PR PHPOffice#2050) must change, but the change is internal - loading and then saving the spreadsheet used in that change will appear the same after this change as it did before. Other differences are very likely to be bug fixes rather than breaks.
This is:
What is the current behavior?
Image and gray disappear after IOFactory::createWriter and save
What are the steps to reproduce?
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:
The text was updated successfully, but these errors were encountered: