From 19a0cf3cec71fc49851d29fb420674b027f50d93 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 15 May 2022 15:38:40 +0800 Subject: This closed #1163, fix set cell value with column and row style inherit issue --- cell.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cell.go') diff --git a/cell.go b/cell.go index 80c03ef..1e130dc 100644 --- a/cell.go +++ b/cell.go @@ -1145,6 +1145,11 @@ func (f *File) prepareCellStyle(ws *xlsxWorksheet, col, row, style int) int { if style != 0 { return style } + if row <= len(ws.SheetData.Row) { + if styleID := ws.SheetData.Row[row-1].S; styleID != 0 { + return styleID + } + } if ws.Cols != nil { for _, c := range ws.Cols.Col { if c.Min <= col && col <= c.Max && c.Style != 0 { @@ -1152,11 +1157,6 @@ func (f *File) prepareCellStyle(ws *xlsxWorksheet, col, row, style int) int { } } } - if row <= len(ws.SheetData.Row) { - if styleID := ws.SheetData.Row[row-1].S; styleID != 0 { - return styleID - } - } return style } -- cgit v1.2.1