summaryrefslogtreecommitdiff
path: root/styles.go
diff options
context:
space:
mode:
Diffstat (limited to 'styles.go')
-rw-r--r--styles.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/styles.go b/styles.go
index 55ee175..87c4863 100644
--- a/styles.go
+++ b/styles.go
@@ -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