Skip to content

Namespace-Aware Code for SheetViewOptions, SheetProtection (minor break)#3230

Merged
oleibman merged 3 commits intoPHPOffice:masterfrom
oleibman:namespace6
Dec 12, 2022
Merged

Namespace-Aware Code for SheetViewOptions, SheetProtection (minor break)#3230
oleibman merged 3 commits intoPHPOffice:masterfrom
oleibman:namespace6

Conversation

@oleibman
Copy link
Collaborator

@oleibman oleibman commented Dec 5, 2022

This is fairly straightforward for SheetViewOptions.

SheetProtection is a bit less straightforward. All the attributes should allow for null as well as boolean; this is especially important because Excel defaults to true for some of them and false for others (existing code always treated attributes missing from the XML as false). DocBlocks are updated to indicate the defaults. The test for isProtectionEnabled is changed to reflect this reality. Also, PhpSpreadsheet has been using true/false when writing these, but Excel uses 1/0. Xls Reader and Writer also incorrectly treated them all the same and needs to change. Because of these differences, this is a breaking change, but the consequences of the breaks should be minor. Two unit test results needed to change; so does the code in one sample. Documentation is updated.

Remaining areas in Reader/Xlsx which still use the namespace-unaware code include conditional formatting (internal or external), auto filters, unparsed loaded data, data validation (internal or external), alternate content, and header/footer images.

This is:

- [x] a bugfix
- [ ] a new feature
- [ ] refactoring
- [ ] additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change
  • Documentation is updated as necessary

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

This is fairly straightforward for SheetViewOptions.

SheetProtection is a bit less straightforward. All the attributes should allow for null as well as boolean; this is especially important because Excel defaults to true for some of them and false for others (existing code always treated attributes missing from the XML as false). DocBlocks are updated to indicate the defaults. The test for isProtectionEnabled is changed to reflect this reality. Also, PhpSpreadsheet has been using true/false when writing these, but Excel uses 1/0. Because of these differences, this is a breaking change, but the consequences of the breaks should be minor. Two unit test results needed to change.

Remaining areas in Reader/Xlsx which still use the namespace-unaware code include conditional formatting (internal or external), auto filters, unparsed loaded data, data validation (internal or external), alternate content, and header/footer images.
@oleibman oleibman mentioned this pull request Dec 5, 2022
7 tasks
New test and changed sample to go with code changes. Also doc change.
@oleibman oleibman merged commit 29b07a7 into PHPOffice:master Dec 12, 2022
@oleibman oleibman deleted the namespace6 branch January 6, 2023 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant