Skip to content

Commit

Permalink
This closes qax-os#1119, style parsing issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Oct 9, 2022
1 parent a1ab453 commit f676891
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
2 changes: 2 additions & 0 deletions lib.go
Expand Up @@ -473,6 +473,8 @@ func (avb *attrValBool) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err
return nil
}
}
defaultVal := true
avb.Val = &defaultVal
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion xmlDecodeDrawing.go
Expand Up @@ -78,7 +78,7 @@ type decodeWsDr struct {
type decodeTwoCellAnchor struct {
From *decodeFrom `xml:"from"`
To *decodeTo `xml:"to"`
Pic *decodePic `xml:"pic,omitempty"`
Pic *decodePic `xml:"pic"`
ClientData *decodeClientData `xml:"clientData"`
}

Expand Down
62 changes: 31 additions & 31 deletions xmlStyles.go
Expand Up @@ -20,16 +20,16 @@ import (
type xlsxStyleSheet struct {
sync.Mutex
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main styleSheet"`
NumFmts *xlsxNumFmts `xml:"numFmts,omitempty"`
Fonts *xlsxFonts `xml:"fonts,omitempty"`
Fills *xlsxFills `xml:"fills,omitempty"`
Borders *xlsxBorders `xml:"borders,omitempty"`
CellStyleXfs *xlsxCellStyleXfs `xml:"cellStyleXfs,omitempty"`
CellXfs *xlsxCellXfs `xml:"cellXfs,omitempty"`
CellStyles *xlsxCellStyles `xml:"cellStyles,omitempty"`
Dxfs *xlsxDxfs `xml:"dxfs,omitempty"`
TableStyles *xlsxTableStyles `xml:"tableStyles,omitempty"`
Colors *xlsxStyleColors `xml:"colors,omitempty"`
NumFmts *xlsxNumFmts `xml:"numFmts"`
Fonts *xlsxFonts `xml:"fonts"`
Fills *xlsxFills `xml:"fills"`
Borders *xlsxBorders `xml:"borders"`
CellStyleXfs *xlsxCellStyleXfs `xml:"cellStyleXfs"`
CellXfs *xlsxCellXfs `xml:"cellXfs"`
CellStyles *xlsxCellStyles `xml:"cellStyles"`
Dxfs *xlsxDxfs `xml:"dxfs"`
TableStyles *xlsxTableStyles `xml:"tableStyles"`
Colors *xlsxStyleColors `xml:"colors"`
ExtLst *xlsxExtLst `xml:"extLst"`
}

Expand Down Expand Up @@ -60,7 +60,7 @@ type xlsxProtection struct {
// xlsxLine expresses a single set of cell border.
type xlsxLine struct {
Style string `xml:"style,attr,omitempty"`
Color *xlsxColor `xml:"color,omitempty"`
Color *xlsxColor `xml:"color"`
}

// xlsxColor is a common mapping used for both the fgColor and bgColor elements.
Expand All @@ -87,13 +87,13 @@ type xlsxFonts struct {
// xlsxFont directly maps the font element. This element defines the
// properties for one of the fonts used in this workbook.
type xlsxFont struct {
B *attrValBool `xml:"b,omitempty"`
I *attrValBool `xml:"i,omitempty"`
Strike *attrValBool `xml:"strike,omitempty"`
Outline *attrValBool `xml:"outline,omitempty"`
Shadow *attrValBool `xml:"shadow,omitempty"`
Condense *attrValBool `xml:"condense,omitempty"`
Extend *attrValBool `xml:"extend,omitempty"`
B *attrValBool `xml:"b"`
I *attrValBool `xml:"i"`
Strike *attrValBool `xml:"strike"`
Outline *attrValBool `xml:"outline"`
Shadow *attrValBool `xml:"shadow"`
Condense *attrValBool `xml:"condense"`
Extend *attrValBool `xml:"extend"`
U *attrValString `xml:"u"`
Sz *attrValFloat `xml:"sz"`
Color *xlsxColor `xml:"color"`
Expand All @@ -109,14 +109,14 @@ type xlsxFont struct {
// applied across the cell.
type xlsxFills struct {
Count int `xml:"count,attr"`
Fill []*xlsxFill `xml:"fill,omitempty"`
Fill []*xlsxFill `xml:"fill"`
}

// xlsxFill directly maps the fill element. This element specifies fill
// formatting.
type xlsxFill struct {
PatternFill *xlsxPatternFill `xml:"patternFill,omitempty"`
GradientFill *xlsxGradientFill `xml:"gradientFill,omitempty"`
PatternFill *xlsxPatternFill `xml:"patternFill"`
GradientFill *xlsxGradientFill `xml:"gradientFill"`
}

// xlsxPatternFill is used to specify cell fill information for pattern and
Expand All @@ -138,7 +138,7 @@ type xlsxGradientFill struct {
Right float64 `xml:"right,attr,omitempty"`
Top float64 `xml:"top,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
Stop []*xlsxGradientFillStop `xml:"stop,omitempty"`
Stop []*xlsxGradientFillStop `xml:"stop"`
}

// xlsxGradientFillStop directly maps the stop element.
Expand All @@ -152,7 +152,7 @@ type xlsxGradientFillStop struct {
// the workbook.
type xlsxBorders struct {
Count int `xml:"count,attr"`
Border []*xlsxBorder `xml:"border,omitempty"`
Border []*xlsxBorder `xml:"border"`
}

// xlsxBorder directly maps the border element. Expresses a single set of cell
Expand All @@ -177,7 +177,7 @@ type xlsxBorder struct {
type xlsxCellStyles struct {
XMLName xml.Name `xml:"cellStyles"`
Count int `xml:"count,attr"`
CellStyle []*xlsxCellStyle `xml:"cellStyle,omitempty"`
CellStyle []*xlsxCellStyle `xml:"cellStyle"`
}

// xlsxCellStyle directly maps the cellStyle element. This element represents
Expand All @@ -187,10 +187,10 @@ type xlsxCellStyle struct {
XMLName xml.Name `xml:"cellStyle"`
Name string `xml:"name,attr"`
XfID int `xml:"xfId,attr"`
BuiltInID *int `xml:"builtinId,attr,omitempty"`
ILevel *int `xml:"iLevel,attr,omitempty"`
Hidden *bool `xml:"hidden,attr,omitempty"`
CustomBuiltIn *bool `xml:"customBuiltin,attr,omitempty"`
BuiltInID *int `xml:"builtinId,attr"`
ILevel *int `xml:"iLevel,attr"`
Hidden *bool `xml:"hidden,attr"`
CustomBuiltIn *bool `xml:"customBuiltin,attr"`
}

// xlsxCellStyleXfs directly maps the cellStyleXfs element. This element
Expand Down Expand Up @@ -245,7 +245,7 @@ type xlsxCellXfs struct {
// to any formatting already present on the object using the dxf record.
type xlsxDxfs struct {
Count int `xml:"count,attr"`
Dxfs []*xlsxDxf `xml:"dxf,omitempty"`
Dxfs []*xlsxDxf `xml:"dxf"`
}

// xlsxDxf directly maps the dxf element. A single dxf record, expressing
Expand Down Expand Up @@ -273,7 +273,7 @@ type xlsxTableStyles struct {
Count int `xml:"count,attr"`
DefaultPivotStyle string `xml:"defaultPivotStyle,attr"`
DefaultTableStyle string `xml:"defaultTableStyle,attr"`
TableStyles []*xlsxTableStyle `xml:"tableStyle,omitempty"`
TableStyles []*xlsxTableStyle `xml:"tableStyle"`
}

// xlsxTableStyle directly maps the tableStyle element. This element represents
Expand All @@ -293,7 +293,7 @@ type xlsxTableStyle struct {
// to format and render the numeric value of a cell.
type xlsxNumFmts struct {
Count int `xml:"count,attr"`
NumFmt []*xlsxNumFmt `xml:"numFmt,omitempty"`
NumFmt []*xlsxNumFmt `xml:"numFmt"`
}

// xlsxNumFmt directly maps the numFmt element. This element specifies number
Expand Down
12 changes: 6 additions & 6 deletions xmlWorksheet.go
Expand Up @@ -113,15 +113,15 @@ type xlsxPageSetUp struct {
Errors string `xml:"errors,attr,omitempty"`
FirstPageNumber string `xml:"firstPageNumber,attr,omitempty"`
FitToHeight *int `xml:"fitToHeight,attr"`
FitToWidth *int `xml:"fitToWidth,attr,omitempty"`
FitToWidth *int `xml:"fitToWidth,attr"`
HorizontalDPI int `xml:"horizontalDpi,attr,omitempty"`
RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
Orientation string `xml:"orientation,attr,omitempty"`
PageOrder string `xml:"pageOrder,attr,omitempty"`
PaperHeight string `xml:"paperHeight,attr,omitempty"`
PaperSize *int `xml:"paperSize,attr,omitempty"`
PaperSize *int `xml:"paperSize,attr"`
PaperWidth string `xml:"paperWidth,attr,omitempty"`
Scale int `xml:"scale,attr"`
Scale int `xml:"scale,attr,omitempty"`
UseFirstPageNumber bool `xml:"useFirstPageNumber,attr,omitempty"`
UsePrinterDefaults bool `xml:"usePrinterDefaults,attr,omitempty"`
VerticalDPI int `xml:"verticalDpi,attr,omitempty"`
Expand Down Expand Up @@ -239,9 +239,9 @@ type xlsxSheetPr struct {
CodeName string `xml:"codeName,attr,omitempty"`
FilterMode bool `xml:"filterMode,attr,omitempty"`
EnableFormatConditionsCalculation *bool `xml:"enableFormatConditionsCalculation,attr"`
TabColor *xlsxTabColor `xml:"tabColor,omitempty"`
OutlinePr *xlsxOutlinePr `xml:"outlinePr,omitempty"`
PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr,omitempty"`
TabColor *xlsxTabColor `xml:"tabColor"`
OutlinePr *xlsxOutlinePr `xml:"outlinePr"`
PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr"`
}

// xlsxOutlinePr maps to the outlinePr element. SummaryBelow allows you to
Expand Down

0 comments on commit f676891

Please sign in to comment.