@@ -135,23 +135,22 @@ func (f *File) SetCellInt(sheet, axis string, value int) {
135
135
completeRow (xlsx , rows , cell )
136
136
completeCol (xlsx , rows , cell )
137
137
138
- xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell )
138
+ xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell , xlsx . SheetData . Row [ xAxis ]. C [ yAxis ]. S )
139
139
xlsx .SheetData .Row [xAxis ].C [yAxis ].T = ""
140
140
xlsx .SheetData .Row [xAxis ].C [yAxis ].V = strconv .Itoa (value )
141
141
}
142
142
143
143
// prepareCellStyle provides function to prepare style index of cell in
144
144
// worksheet by given column index.
145
- func (f * File ) prepareCellStyle (xlsx * xlsxWorksheet , col int ) int {
146
- s := 0
147
- if xlsx .Cols != nil {
145
+ func (f * File ) prepareCellStyle (xlsx * xlsxWorksheet , col , style int ) int {
146
+ if xlsx .Cols != nil && style == 0 {
148
147
for _ , v := range xlsx .Cols .Col {
149
148
if v .Min <= col && col <= v .Max {
150
- s = v .Style
149
+ style = v .Style
151
150
}
152
151
}
153
152
}
154
- return s
153
+ return style
155
154
}
156
155
157
156
// SetCellStr provides function to set string type value of a cell. Total number
@@ -183,7 +182,7 @@ func (f *File) SetCellStr(sheet, axis, value string) {
183
182
}
184
183
}
185
184
}
186
- xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell )
185
+ xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell , xlsx . SheetData . Row [ xAxis ]. C [ yAxis ]. S )
187
186
xlsx .SheetData .Row [xAxis ].C [yAxis ].T = "str"
188
187
xlsx .SheetData .Row [xAxis ].C [yAxis ].V = value
189
188
}
@@ -205,7 +204,7 @@ func (f *File) SetCellDefault(sheet, axis, value string) {
205
204
completeRow (xlsx , rows , cell )
206
205
completeCol (xlsx , rows , cell )
207
206
208
- xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell )
207
+ xlsx .SheetData .Row [xAxis ].C [yAxis ].S = f .prepareCellStyle (xlsx , cell , xlsx . SheetData . Row [ xAxis ]. C [ yAxis ]. S )
209
208
xlsx .SheetData .Row [xAxis ].C [yAxis ].T = ""
210
209
xlsx .SheetData .Row [xAxis ].C [yAxis ].V = value
211
210
}
0 commit comments