Fix #482, font strike style support

This commit is contained in:
xuri 2019-09-23 21:50:03 +08:00
parent 3280e1b686
commit 75d66a03f3
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
3 changed files with 6 additions and 1 deletions

View File

@ -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()
}

View File

@ -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}

View File

@ -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"`
}