-
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
Fix For #1509 #1518
Fix For #1509 #1518
Conversation
Resync with base project
Sync with Base
Sync Up With Base
Allowing the user to specify no enclosure when writing a CSV can lead to a situation where PhpSpreadsheet (likewise Excel) will not read the resulting file as intended, e.g. if any cell contains a delimiter character. This is demonstrated in new test TestBadReread. No existing setting will rectify this situation. A better choice would be to add an option to write the enclosure only when it is needed, which is what Excel does. The RFC4180 spec at https://tools.ietf.org/html/rfc4180 states when it is needed - when the cell contains the delimiter, or the enclosure, or a newline. New test TestGoodReread demonstrates that the file is read as intended. The documentation has been updated to describe the new function, and to change the write example where the enclosure is set to null.
3 minor changes, all in tests.
Are there any plans to merge it any time soon? |
Thank you for the quick resolution to the issue with setting empty CSV enclosures |
@MarkBaker could you be so kind and make this a new release so we don't need workarounds to make CSV Enclosure working as expected again in |
I really want to get the changes that I'm doing rewriting named ranges/formulae completed before doing a new release (perhaps another week or two of work), because the next steps that I'm planning after that could lead to some bc breaks, which would require a new 2.0.0 release. |
You can just use "phpoffice/phpspreadsheet": "1.12.0", in composer and everything works 😉 |
Even though @MarkBaker just tagged a new release, the requirements changed for Guzzle 6 -> 7 and that is a no go (it's like domino, now with Google API) ... so no solution to update to latest tagged releases and that indeed leaves the option as stated by @SudoGetBeer open as final solution for now. I do understand the choice @MarkBaker to aim for a bigger release... and will keep an eye out on package updates so this will integrate nicely again. |
This is:
Checklist:
Why this change is needed?
User expected no CSV enclosures after $writer->setEnclosure(''),
which had been changed to be consistent with $reader->setEnclosure('').
Writer will now omit enclosures after code above; no change to Reader.
Tests have been added for this condition.