Browse Source

Fix #482, font strike style support

tags/v2.0.2
xuri 2 months ago
parent
commit
75d66a03f3
No known key found for this signature in database GPG Key ID: BA5E5BB1C948EDF7
3 changed files with 6 additions and 1 deletions
  1. +1
    -1
      excelize_test.go
  2. +4
    -0
      styles.go
  3. +1
    -0
      xmlStyles.go

+ 1
- 1
excelize_test.go 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()
}


+ 4
- 0
styles.go 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}


+ 1
- 0
xmlStyles.go 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"`
}



Loading…
Cancel
Save