Skip to content

Removing Columns/Rows Containing Merged Cells #4465

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

Merged
merged 4 commits into from
May 15, 2025

Conversation

oleibman
Copy link
Collaborator

Fix #282, which went stale over 7 years ago, and is now reopened. This is certainly related to issue #4379. If merged cells are in the midst of deleted rows/columns, the merge may continue to exist after the deletion, leading to various problems including spreadsheet corruption. The problem is not with either Reader or Writer.

This PR will automatically unmerge all merged cells whose first cell is in the delete range before performing the deletion. This will address the corruption problem. Something more sophisticated may be required, so I won't merge this PR for a while to give me a chance to think about it some more.

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

oleibman added 4 commits May 9, 2025 20:58
Fix PHPOffice#282, which went stale over 7 years ago, and is now reopened. This is certainly related to issue PHPOffice#4379. If merged cells are in the midst of deleted rows/columns, the merge may continue to exist after the deletion, leading to various problems including spreadsheet corruption. The problem is not with either Reader or Writer.

This PR will automatically unmerge all merged cells whose first cell is in the delete range before performing the deletion. This will address the corruption problem. Something more sophisticated may be required, so I won't merge this PR for a while to give me a chance to think about it some more.
When the merged cells start outside the deleted range but end inside it, the merge is truncated to that portion which is outside the range.
@oleibman oleibman enabled auto-merge May 15, 2025 01:15
@oleibman oleibman added this pull request to the merge queue May 15, 2025
Merged via the queue into PHPOffice:master with commit 2d1f4e8 May 15, 2025
13 of 14 checks passed
@oleibman oleibman deleted the issue282 branch May 15, 2025 01:24
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request May 16, 2025
oleibman added a commit that referenced this pull request May 16, 2025
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request May 16, 2025
oleibman added a commit that referenced this pull request May 16, 2025
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request May 16, 2025
oleibman added a commit that referenced this pull request May 16, 2025
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request May 16, 2025
oleibman added a commit that referenced this pull request May 16, 2025
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.

Removing columns containing merged columns
1 participant