Browse Source

Fix broken XML output.

Geoffrey J. Teale 11 years ago
parent
commit
49cd88c769
1 changed files with 4 additions and 1 deletions
  1. 4 1
      xmlStyle.go

+ 4 - 1
xmlStyle.go

@@ -401,18 +401,21 @@ type xlsxPatternFill struct {
 func (patternFill *xlsxPatternFill) Marshal() (result string, err error) {
 	result = fmt.Sprintf(`<patternFill patternType="%s"`, patternFill.PatternType)
 	ending := `/>`
+	terminator := ""
 	subparts := ""
 	if patternFill.FgColor.RGB != "" {
 		ending = `>`
+		terminator = "</patternFill>"
 		subparts += fmt.Sprintf(`<fgColor rgb="%s"/>`, patternFill.FgColor.RGB)
 	}
 	if patternFill.BgColor.RGB != "" {
 		ending = `>`
+		terminator = "</patternFill>"
 		subparts += fmt.Sprintf(`<bgColor rgb="%s"/>`, patternFill.BgColor.RGB)
 	}
 	result += ending
 	result += subparts
-	result += `</patternFill>`
+	result += terminator
 	return
 }