Closed kboumedal closed 1 month ago
Thank you for the sample file. Problem confirmed. It also happens with PhpSpreadsheet 2.2.0, so probably is not caused by recent changes.
No indeed, I tried to update to the last version to see if the problem was solved but no.
It might take some time to figure this out. One thing that I see in your spreadsheet that I don't see in most others is the use of SVG images, for which we have no formal support. I'm not saying this is causing the problem, but it would be useful to see what happens without them. Is it possible for you to create a copy of your spreadsheet that uses PNG images in place of SVG, and see if the same problem occurs?
Having nothing to do with SVG, there appears to be a duplicate entry for PNG in ContentTypes. I think that is the reason Xlsx thinks the file is corrupt. Researching ...
Yes, that's it. Your sheet has a background image, and the code is not properly accounting for the image's extension already being defined in ContentTypes. Background images are fairly unusual, which is probably why this problem hasn't arisen before. The SVG images will be dropped from the copy, but are otherwise not the source of any problems. Expect a fix in a few days.
If you can test against PR 4180, please do so.
Perfect, it works !
Thank you for your quick fix !
This is:
What is the current behavior?
File is corrupted after IOFactory::createWriter and save