-
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
Error when saving an Xlsx file (with images) with the same name! #1911
Comments
I also stepped into this issue. My workaround:
This is an hackish solution and it brings some overhead, leading to performance issues in mass operations. Hope this can be fixed soon. |
This is specifically happening because of the way the xlsx file is opened before updating. It is opened in Although Ideally, the excel file shouldn't be modified unless all the data is read completely in memory. However, the current code overrides files in an incremental fashion rather than doing it once. The solution suggested by @luisfdgon would work for this since the file from where the data is read and written are different. I will try to file a good solution to this to fix but doesn't look file it'd be easy without a refactor. If any of the core contributors can confirm if that's okay, I'd be happy to file a PR. |
The solution/workaround suggested by @luisfdgon works fine for me! Thank you for that! @ccrims0n, thank you for your detailed feedback about the problem and good luck with the work to find the best solution. I don't know if it is relevant or useful, but in PHPExcel this does not happen. |
That's strange, given both PHPExcel and PHPSpreadsheet have almost common code for this. |
Perhaps he saves to xls with PHPExcel, which is a whole other file format (not a rar). Anyway, may I be so bold to bump issue #1153 ? I'd really appreciate if someone would check that one as I'm hoping for a fix for so long (starting June 2018). |
This is:
What is the expected behavior?
An xlsx file with images can be saved several times with the same name, without errors occurring.
What is the current behavior?
When we try to save a file with images, that already exists with the same name, an error occurs.
What are the steps to reproduce?
Note: I'm using the same code used by @PowerKiKi in this comment #544 (comment). The unique difference is that I'm saving the second Xlsx file with the same name as the first file.
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet: v1.17.1
PHP: v7.4.13;
The text was updated successfully, but these errors were encountered: