Skip to content

Commit bb603b3

Browse files
authored
Clear slave cells value when merging cells (#1824)
1 parent 688808b commit bb603b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

merge.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ func (f *File) MergeCell(sheet, topLeftCell, bottomRightCell string) error {
6666
}
6767
ws.mu.Lock()
6868
defer ws.mu.Unlock()
69+
for col := rect[0]; col <= rect[2]; col++ {
70+
for row := rect[1]; row <= rect[3]; row++ {
71+
if col == rect[0] && row == rect[1] {
72+
continue
73+
}
74+
ws.prepareSheetXML(col, row)
75+
c := &ws.SheetData.Row[row-1].C[col-1]
76+
c.setCellDefault("")
77+
_ = f.removeFormula(c, ws, sheet)
78+
}
79+
}
6980
ref := topLeftCell + ":" + bottomRightCell
7081
if ws.MergeCells != nil {
7182
ws.MergeCells.Cells = append(ws.MergeCells.Cells, &xlsxMergeCell{Ref: ref, rect: rect})

0 commit comments

Comments
 (0)