先生成一个样式,保存样式的id:style
样式设置参考:NewStyle
style, err := f.NewStyle(`{"font":{//字体样式"bold":true,"color":"0ff","size": 16},"fill":{"type":"pattern",//纯色填充"color": ["f0c"],"pattern": 1},"border": [//边框{"type": "left","color": "FF0000","style": 3},{"type": "top","color": "FF0000","style": 4},{"type": "bottom","color": "FF0000","style": 5},{"type": "right","color": "FF0000","style": 6}]}`)
应用样式
func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) error
其中的参数hcell,vcell,指的是左上角和右下角的单元格格地址,如果只设置一个单元格,就写成一样的
f.SetCellStyle("Sheet2", "A1", "D3", style)
