From 156bf6d16ecbd5257d81e781138eaaaf357ffbec Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 27 Jan 2022 22:37:32 +0800 Subject: This closes #1129, make cell support inheritance columns/rows style Correct cells style in merge range Fix incorrect style ID returned on getting cell style in some cases Unit test updated and simplified code --- merge.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'merge.go') diff --git a/merge.go b/merge.go index 7119d28..3ba7d6a 100644 --- a/merge.go +++ b/merge.go @@ -11,7 +11,9 @@ package excelize -import "strings" +import ( + "strings" +) // Rect gets merged cell rectangle coordinates sequence. func (mc *xlsxMergeCell) Rect() ([]int, error) { @@ -68,7 +70,8 @@ func (f *File) MergeCell(sheet, hCell, vCell string) error { ws.MergeCells = &xlsxMergeCells{Cells: []*xlsxMergeCell{{Ref: ref, rect: rect}}} } ws.MergeCells.Count = len(ws.MergeCells.Cells) - return err + styleID, _ := f.GetCellStyle(sheet, hCell) + return f.SetCellStyle(sheet, hCell, vCell, styleID) } // UnmergeCell provides a function to unmerge a given coordinate area. -- cgit v1.2.1