Skip to content

Commit 219add2

Browse files
authored
value fields xlsxPatternFill.FgColor & xlsxPatternFill.BgColor cause … (qax-os#770)
* value fields xlsxPatternFill.FgColor & xlsxPatternFill.BgColor cause ineffective omitempty tags * remove useless omitempty tag on xlsxPatternFill.FgColor and xlsxPatternFill.BgColor
1 parent b84bd1a commit 219add2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

styles.go

+6
Original file line numberDiff line numberDiff line change
@@ -2432,8 +2432,14 @@ func newFills(style *Style, fg bool) *xlsxFill {
24322432
var pattern xlsxPatternFill
24332433
pattern.PatternType = patterns[style.Fill.Pattern]
24342434
if fg {
2435+
if pattern.FgColor == nil {
2436+
pattern.FgColor = new(xlsxColor)
2437+
}
24352438
pattern.FgColor.RGB = getPaletteColor(style.Fill.Color[0])
24362439
} else {
2440+
if pattern.BgColor == nil {
2441+
pattern.BgColor = new(xlsxColor)
2442+
}
24372443
pattern.BgColor.RGB = getPaletteColor(style.Fill.Color[0])
24382444
}
24392445
fill.PatternFill = &pattern

xmlStyles.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ type xlsxFill struct {
120120
// For cell fills with patterns specified, then the cell fill color is
121121
// specified by the bgColor element.
122122
type xlsxPatternFill struct {
123-
PatternType string `xml:"patternType,attr,omitempty"`
124-
FgColor xlsxColor `xml:"fgColor,omitempty"`
125-
BgColor xlsxColor `xml:"bgColor,omitempty"`
123+
PatternType string `xml:"patternType,attr,omitempty"`
124+
FgColor *xlsxColor `xml:"fgColor"`
125+
BgColor *xlsxColor `xml:"bgColor"`
126126
}
127127

128128
// xlsxGradientFill defines a gradient-style cell fill. Gradient cell fills can

0 commit comments

Comments
 (0)