From e124f6000a2ea731b96a07d6bf2901781e272d90 Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 13 Jun 2019 08:25:35 +0800 Subject: [PATCH] Fix #425, handle empty font style format --- styles.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/styles.go b/styles.go index 5c4f66e..1c01421 100644 --- a/styles.go +++ b/styles.go @@ -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() }