diff options
author | xuri <xuri.me@gmail.com> | 2022-09-01 00:41:52 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-09-01 00:41:52 +0800 |
commit | 75ce2317286181e2c250c10206df892278d5b981 (patch) | |
tree | 5e040d90cbb170a0cbdc0c6a57e0b86c7bc82845 /styles.go | |
parent | 18cd63a548afa1abcddc86a998fdefa3b4cc60c1 (diff) |
This closes #1323, an error will be returned when set the not exist style ID
Diffstat (limited to 'styles.go')
-rw-r--r-- | styles.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2629,6 +2629,14 @@ func (f *File) SetCellStyle(sheet, hCell, vCell string, styleID int) error { makeContiguousColumns(ws, hRow, vRow, vCol) ws.Lock() defer ws.Unlock() + + s := f.stylesReader() + s.Lock() + defer s.Unlock() + if styleID < 0 || s.CellXfs == nil || len(s.CellXfs.Xf) <= styleID { + return newInvalidStyleID(styleID) + } + for r := hRowIdx; r <= vRowIdx; r++ { for k := hColIdx; k <= vColIdx; k++ { ws.SheetData.Row[r].C[k].S = styleID |