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

allow to remove MergeCell #528

Merged
merged 1 commit into from
Dec 13, 2019
Merged

allow to remove MergeCell #528

merged 1 commit into from
Dec 13, 2019

Conversation

zxdvd
Copy link
Contributor

@zxdvd zxdvd commented Dec 6, 2019

PR Details

This PR exposes a method to remove a MergeCell.

Description

I needs to flat all mergecells in excel. I've tried to get the area of a mergecell and use SetCellValue to set each cell in this area but it didn't work.

I think a RemoveMergeCell is needed.

Related Issue

#527

Motivation and Context

How Has This Been Tested

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-io
Copy link

codecov-io commented Dec 6, 2019

Codecov Report

Merging #528 into master will decrease coverage by 0.01%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #528      +/-   ##
==========================================
- Coverage   96.49%   96.47%   -0.02%     
==========================================
  Files          28       28              
  Lines        5699     5729      +30     
==========================================
+ Hits         5499     5527      +28     
- Misses        109      110       +1     
- Partials       91       92       +1
Impacted Files Coverage Δ
cellmerged.go 96.07% <93.33%> (-3.93%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d8365c...6e016e6. Read the comment docs.

Copy link
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @zxdvd, thanks for your PR. I've left some comments.

cellmerged.go Outdated Show resolved Hide resolved
cellmerged.go Show resolved Hide resolved
cellmerged.go Outdated
@@ -33,6 +33,24 @@ func (f *File) GetMergeCells(sheet string) ([]MergeCell, error) {
return mergeCells, err
}

// UnmergeCell unmerge a MergeCell.
func (f *File) UnmergeCell(sheet string, m MergeCell) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After further thinking, I propose that the UnmergeCell and MergeCell functions use the same formal parameters to maintain semantics. The MergeCell structure just used to get merged cells.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I didn't find the MergeCell function in cell.go. Maybe the MergeCell will be moved into cellmerged.go in the future or move UnmergeCell to cell.go?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah right, the MergeCell should be moved into cellmerged.go.

@xuri xuri merged commit 4c433c5 into qax-os:master Dec 13, 2019
@xuri xuri added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 21, 2020
nullfy pushed a commit to nullfy/excelize that referenced this pull request Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants