Better Handling of Chart DisplayBlanksAs #4414
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #4411. User copied some code from a PHPExcel program which set DisplayAsBlanks to
0
. This resulted in what Excel deemed a corrupt spreadsheet using PhpSpreadsheet. The only values allowed for that field aregap
,zero
(not0
), andspan
. PHPExcel used0
as a default, and got away with it because it ignored the value entirely when writing out the spreadsheet, usinggap
all the time.I had to choose between throwing an exception and just using the default when an attempt is made to set that property to an invalid value. An exception just seems more punitive than helpful to me, especially if we want people to migrate from PHPExcel, which still seems to have a large user base. So I've gone with using
gap
in place of an invalid value. Note that, according to https://learn.microsoft.com/ru-ru/openspecs/office_standards/ms-oe376/b5c5c694-21d9-437c-9a4a-21e0e843eed8,gap
is used as the default whenever it is permitted for the chart in question; and, when it isn't permitted, the chart will use its default method (which will always bezero
).There were no tests nor samples for this property. All the tests and samples which use it use only
gap
. I have added a small test, and a new sample to illustrate the difference between the 3 options.This is:
Checklist: