fix:When merging cells, the data of the cells that are not displayed is not cleared#612
Open
tmlx1990 wants to merge 6 commits intoapache:mainfrom
Open
fix:When merging cells, the data of the cells that are not displayed is not cleared#612tmlx1990 wants to merge 6 commits intoapache:mainfrom
tmlx1990 wants to merge 6 commits intoapache:mainfrom
Conversation
# Conflicts: # fastexcel-test/src/test/java/cn/idev/excel/test/demo/read/ReadTest.java
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where merged cells in Excel retained their original data instead of being cleared, leading to incorrect total counts and visual display problems. The fix ensures that when cells are merged, only the primary cell retains data while other cells in the merged range are properly cleared.
- Added logic to clear content of non-primary cells in merged ranges
- Ensures proper data handling during cell merge operations
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Iterate through the columns to clear the content of merged cells | ||
| for (int i = 0; i < columnExtend; i++) { | ||
| // Access the cell at the specified column index in the current row and set it to blank | ||
| context.getRow().getCell(columnIndex + i).setBlank(); |
There was a problem hiding this comment.
Potential NullPointerException if getCell(columnIndex + i) returns null. The cell should be created if it doesn't exist before calling setBlank().
Member
|
It would be best to also submit the unit test code. |
Contributor
Author
Member
|
Please make sure all test passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Purpose of the pull request
Fixed the issue where when merging cells, the actual data was not merged and the total count was displayed incorrectly
#522
What's changed?
Effect before problem repair:

Effect after problem repair:


Checklist