Fix #425, handle empty font style format

This commit is contained in:
xuri 2019-06-13 08:25:35 +08:00
parent 821632cf89
commit e124f6000a
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
1 changed files with 6 additions and 2 deletions

View File

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