diff options
author | xuri <xuri.me@gmail.com> | 2018-05-27 11:25:55 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2018-05-27 11:25:55 +0800 |
commit | 9e463b4614348b3ddc04b1fedd5d662845ce0fb9 (patch) | |
tree | 4ca438f66dcf3baa7d36727a3dd77400bc70aa57 /styles.go | |
parent | aaced358f135ea871428bba87bb945cc170eee0f (diff) |
- Add error return value for functions: `AddChart()`, `AddComment()`, `AddPicture()`, `AddShape()`, `AddTable()` and `SetConditionalFormat()`
- go test has been updated
Diffstat (limited to 'styles.go')
-rw-r--r-- | styles.go | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -988,7 +988,7 @@ func is12HourTime(format string) bool { func (f *File) stylesReader() *xlsxStyleSheet { if f.Styles == nil { var styleSheet xlsxStyleSheet - xml.Unmarshal([]byte(f.readXML("xl/styles.xml")), &styleSheet) + _ = xml.Unmarshal([]byte(f.readXML("xl/styles.xml")), &styleSheet) f.Styles = &styleSheet } return f.Styles @@ -2562,10 +2562,12 @@ func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) { // // bar_color - Used for data_bar. Same as min_color, see above. // -func (f *File) SetConditionalFormat(sheet, area, formatSet string) { +func (f *File) SetConditionalFormat(sheet, area, formatSet string) error { var format []*formatConditional - json.Unmarshal([]byte(formatSet), &format) - + err := json.Unmarshal([]byte(formatSet), &format) + if err != nil { + return err + } drawContFmtFunc := map[string]func(p int, ct string, fmtCond *formatConditional) *xlsxCfRule{ "cellIs": drawCondFmtCellIs, "top10": drawCondFmtTop10, @@ -2601,6 +2603,7 @@ func (f *File) SetConditionalFormat(sheet, area, formatSet string) { SQRef: area, CfRule: cfRule, }) + return err } // drawCondFmtCellIs provides function to create conditional formatting rule for |