From f91f548614a7182ce66d55d10ed311e9b7e08a2a Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 17 May 2019 22:58:12 +0800 Subject: Resolve #404, get sheet map by target rels. --- styles.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'styles.go') diff --git a/styles.go b/styles.go index d6d267d..fc8a290 100644 --- a/styles.go +++ b/styles.go @@ -1895,11 +1895,8 @@ func (f *File) NewStyle(style string) (int, error) { numFmtID := setNumFmt(s, fs) if fs.Font != nil { - font, _ := xml.Marshal(setFont(fs)) s.Fonts.Count++ - s.Fonts.Font = append(s.Fonts.Font, &xlsxFont{ - Font: string(font[6 : len(font)-7]), - }) + s.Fonts.Font = append(s.Fonts.Font, setFont(fs)) fontID = s.Fonts.Count - 1 } @@ -1950,7 +1947,7 @@ func (f *File) NewConditionalStyle(style string) (int, error) { // setFont provides a function to add font style by given cell format // settings. -func setFont(formatStyle *formatStyle) *font { +func setFont(formatStyle *formatStyle) *xlsxFont { fontUnderlineType := map[string]string{"single": "single", "double": "double"} if formatStyle.Font.Size < 1 { formatStyle.Font.Size = 11 @@ -1958,7 +1955,7 @@ func setFont(formatStyle *formatStyle) *font { if formatStyle.Font.Color == "" { formatStyle.Font.Color = "#000000" } - f := font{ + f := xlsxFont{ B: formatStyle.Font.Bold, I: formatStyle.Font.Italic, Sz: &attrValInt{Val: formatStyle.Font.Size}, -- cgit v1.2.1