Skip to content
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

Worksheet applyStylesFromArray Retain Active Cell #4132

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

oleibman
Copy link
Collaborator

@oleibman oleibman commented Aug 7, 2024

Fix #4128. PR #4073 introduced applyStylesFromArray method, which allowed setting styles without affecting selectedCells or activeSheet. The first use of this method was in Cell setValueExplicit to set quotePrefix appropriately. The new method did not preserve activeCell. I'm not sure why that should matter, but this seems to have caused a problem for Excel 2016. This seems to be a bug in Excel, one which is fixed in newer releases. However, PhpSpreadsheet can avoid the problem by preserving activeCell as well as selectedCells and activeSheet. This PR makes that change.

This is:

  • 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 and a link to the pull request if applicable
  • 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.

Fix PHPOffice#4128. PR PHPOffice#4073 introduced applyStylesFromArray method, which allowed setting styles without affecting selectedCells or activeSheet. The first use of this method was in Cell setValueExplicit to set quotePrefix appropriately. The new method did not preserve activeCell. I'm not sure why that should matter, but this seems to have caused a problem for Excel 2016. This seems to be a bug in Excel, one which is fixed in newer releases. However, PhpSpreadsheet can avoid the problem by preserving activeCell as well as selectedCells and activeSheet. This PR makes that change.
@oleibman oleibman added this pull request to the merge queue Aug 8, 2024
Merged via the queue into PHPOffice:master with commit ffbcee6 Aug 8, 2024
12 of 13 checks passed
@oleibman oleibman deleted the issue4128 branch August 8, 2024 02:49
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request Aug 30, 2024
PR PHPOffice#4132 was needed for release 2.2.2 because of a problem with Excel 2016 introduced with 2.2.0. This is a minor tweak to that change - a little simpler, and possibly beneficial if the spreadsheet uses split screens.
@oleibman oleibman mentioned this pull request Aug 30, 2024
11 tasks
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.

Error open file Xlsx when modify value
1 participant