Skip to content

Commit

Permalink
Clear slave cells value when merging cells (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirgong committed Feb 27, 2024
1 parent 688808b commit bb603b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ func (f *File) MergeCell(sheet, topLeftCell, bottomRightCell string) error {
}
ws.mu.Lock()
defer ws.mu.Unlock()
for col := rect[0]; col <= rect[2]; col++ {
for row := rect[1]; row <= rect[3]; row++ {
if col == rect[0] && row == rect[1] {
continue
}
ws.prepareSheetXML(col, row)
c := &ws.SheetData.Row[row-1].C[col-1]
c.setCellDefault("")
_ = f.removeFormula(c, ws, sheet)
}
}
ref := topLeftCell + ":" + bottomRightCell
if ws.MergeCells != nil {
ws.MergeCells.Cells = append(ws.MergeCells.Cells, &xlsxMergeCell{Ref: ref, rect: rect})
Expand Down

0 comments on commit bb603b3

Please sign in to comment.