summaryrefslogtreecommitdiff
path: root/styles.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2018-05-27 11:25:55 +0800
committerxuri <xuri.me@gmail.com>2018-05-27 11:25:55 +0800
commit9e463b4614348b3ddc04b1fedd5d662845ce0fb9 (patch)
tree4ca438f66dcf3baa7d36727a3dd77400bc70aa57 /styles.go
parentaaced358f135ea871428bba87bb945cc170eee0f (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.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/styles.go b/styles.go
index daa3447..b919475 100644
--- a/styles.go
+++ b/styles.go
@@ -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