You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, the last <fill></fill> is invalid and causing errors when using strict parsers like openpyxl.
Steps to reproduce the issue
It's bit hard to create a minimal reproduction. The code is part of our internal application. Though the fix is similar to #332
diff --git a/styles.go b/styles.go
index 5992cc3..36c90d0 100644
--- a/styles.go+++ b/styles.go@@ -1470,7 +1470,7 @@ func (f *File) extractBorders(bdr *xlsxBorder, s *xlsxStyleSheet, style *Style)
// extractFills provides a function to extract fill styles settings by
// given fill styles definition.
func (f *File) extractFills(fl *xlsxFill, s *xlsxStyleSheet, style *Style) {
- if fl != nil {+ if fl != nil && (fl.GradientFill != nil || fl.PatternFill != nil) {
var fill Fill
if fl.GradientFill != nil {
fill.Type = "gradient"
This is the only place where style.Fill = fill was being assigned without any checks on whether the fill has a gradientfill/patternfill child.
Describe the results you received
<fill></fill> is being generated and fillId="2" is referencing it.
Describe the results you expected
No empty fill should be generated. fillId="0" should be used instead.
Thanks for your issue. Could you show us a complete, standalone example program or reproducible demo? If you open an existing workbook, please provide the file attachment without confidential info. I'm not sure if this relates to #2014. Please also try using master branch code, upgrade to the master branch code by go get -u github.com/xuri/excelize/v2@master.
Uh oh!
There was an error while loading. Please reload this page.
Description
In certain cases this is being generated in styles.xml:
Here, the last
<fill></fill>
is invalid and causing errors when using strict parsers like openpyxl.Steps to reproduce the issue
It's bit hard to create a minimal reproduction. The code is part of our internal application. Though the fix is similar to #332
This is the only place where
style.Fill = fill
was being assigned without any checks on whether the fill has a gradientfill/patternfill child.Describe the results you received
<fill></fill>
is being generated andfillId="2"
is referencing it.Describe the results you expected
No empty fill should be generated.
fillId="0"
should be used instead.Go version
1.24.2
Excelize version or commit ID
2.9.0
Environment
Validations
The text was updated successfully, but these errors were encountered: