Fixed doc corruption when deleting all merged cells

formula
xuri 6 years ago
parent 9279c86d85
commit 1092009541
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7

@ -54,6 +54,11 @@ func (f *File) adjustHelper(sheet string, dir adjustDirection, num, offset int)
} }
checkSheet(xlsx) checkSheet(xlsx)
checkRow(xlsx) checkRow(xlsx)
if xlsx.MergeCells != nil && len(xlsx.MergeCells.Cells) == 0 {
xlsx.MergeCells = nil
}
return nil return nil
} }
@ -283,8 +288,6 @@ func (f *File) deleteMergeCell(sheet *xlsxWorksheet, idx int) {
if len(sheet.MergeCells.Cells) > idx { if len(sheet.MergeCells.Cells) > idx {
sheet.MergeCells.Cells = append(sheet.MergeCells.Cells[:idx], sheet.MergeCells.Cells[idx+1:]...) sheet.MergeCells.Cells = append(sheet.MergeCells.Cells[:idx], sheet.MergeCells.Cells[idx+1:]...)
sheet.MergeCells.Count = len(sheet.MergeCells.Cells) sheet.MergeCells.Count = len(sheet.MergeCells.Cells)
} else {
sheet.MergeCells = nil
} }
} }

Loading…
Cancel
Save