Fix #425, handle empty font style format

formula
xuri 6 years ago
parent 821632cf89
commit e124f6000a
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7

@ -1979,13 +1979,17 @@ func (f *File) setFont(formatStyle *formatStyle) *xlsxFont {
formatStyle.Font.Color = "#000000" formatStyle.Font.Color = "#000000"
} }
fnt := xlsxFont{ fnt := xlsxFont{
B: &formatStyle.Font.Bold,
I: &formatStyle.Font.Italic,
Sz: &attrValFloat{Val: formatStyle.Font.Size}, Sz: &attrValFloat{Val: formatStyle.Font.Size},
Color: &xlsxColor{RGB: getPaletteColor(formatStyle.Font.Color)}, Color: &xlsxColor{RGB: getPaletteColor(formatStyle.Font.Color)},
Name: &attrValString{Val: formatStyle.Font.Family}, Name: &attrValString{Val: formatStyle.Font.Family},
Family: &attrValInt{Val: 2}, Family: &attrValInt{Val: 2},
} }
if formatStyle.Font.Bold {
fnt.B = &formatStyle.Font.Bold
}
if formatStyle.Font.Italic {
fnt.I = &formatStyle.Font.Italic
}
if fnt.Name.Val == "" { if fnt.Name.Val == "" {
fnt.Name.Val = f.GetDefaultFont() fnt.Name.Val = f.GetDefaultFont()
} }

Loading…
Cancel
Save