diff options
author | xuri <xuri.me@gmail.com> | 2019-09-23 21:50:03 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2019-09-23 21:50:03 +0800 |
commit | 75d66a03f33f25c29167c5f75ee8a4cc58598420 (patch) | |
tree | b6377075fe0bcbf98f285272a443e66e07596d64 | |
parent | 3280e1b68664e12143cbd2b3a408f9f494a72897 (diff) |
Fix #482, font strike style support
-rw-r--r-- | excelize_test.go | 2 | ||||
-rw-r--r-- | styles.go | 4 | ||||
-rw-r--r-- | xmlStyles.go | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/excelize_test.go b/excelize_test.go index daf9e7d..7b6b674 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -775,7 +775,7 @@ func TestSetCellStyleFont(t *testing.T) { assert.NoError(t, f.SetCellStyle("Sheet2", "A4", "A4", style)) - style, err = f.NewStyle(`{"font":{"color":"#777777"}}`) + style, err = f.NewStyle(`{"font":{"color":"#777777","strike":true}}`) if !assert.NoError(t, err) { t.FailNow() } @@ -1993,6 +1993,10 @@ func (f *File) setFont(formatStyle *formatStyle) *xlsxFont { if fnt.Name.Val == "" { fnt.Name.Val = f.GetDefaultFont() } + if formatStyle.Font.Strike { + strike := true + fnt.Strike = &strike + } val, ok := fontUnderlineType[formatStyle.Font.Underline] if ok { fnt.U = &attrValString{Val: val} diff --git a/xmlStyles.go b/xmlStyles.go index 5823bc9..7e02d6e 100644 --- a/xmlStyles.go +++ b/xmlStyles.go @@ -320,6 +320,7 @@ type formatFont struct { Underline string `json:"underline"` Family string `json:"family"` Size float64 `json:"size"` + Strike bool `json:"strike"` Color string `json:"color"` } |