@ -1145,9 +1145,9 @@ func parseFormatStyleSet(style *Style) (*Style, error) {
//
//
// Index | Style | Index | Style
// Index | Style | Index | Style
// -------+-----------------+-------+-----------------
// -------+-----------------+-------+-----------------
// 0 | Horizontal | 3 | Diagonal down
// 0 -2 | Horizontal | 9-11 | Diagonal down
// 1 | Vertical | 4 | From corner
// 3-5 | Vertical | 12-15 | From corner
// 2 | Diagonal Up | 5 | From center
// 6-8 | Diagonal Up | 16 | From center
//
//
// The following table shows the pattern styles used in 'Fill.Pattern' supported
// The following table shows the pattern styles used in 'Fill.Pattern' supported
// by excelize index number:
// by excelize index number:
@ -2459,41 +2459,38 @@ func newFills(style *Style, fg bool) *xlsxFill {
"gray125" ,
"gray125" ,
"gray0625" ,
"gray0625" ,
}
}
variants := [ ] xlsxGradientFill {
variants := [ ] float64 {
{ Degree : 90 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
90 ,
{ Degree : 270 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
0 ,
{ Degree : 90 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 0.5 } , { Position : 1 } } } ,
45 ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
135 ,
{ Degree : 180 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 0.5 } , { Position : 1 } } } ,
{ Degree : 45 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
{ Degree : 255 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
{ Degree : 45 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 0.5 } , { Position : 1 } } } ,
{ Degree : 135 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
{ Degree : 315 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } } ,
{ Degree : 135 , Stop : [ ] * xlsxGradientFillStop { { } , { Position : 0.5 } , { Position : 1 } } } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } , Type : "path" } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } , Type : "path" , Left : 1 , Right : 1 } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } , Type : "path" , Bottom : 1 , Top : 1 } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } , Type : "path" , Bottom : 1 , Left : 1 , Right : 1 , Top : 1 } ,
{ Stop : [ ] * xlsxGradientFillStop { { } , { Position : 1 } } , Type : "path" , Bottom : 0.5 , Left : 0.5 , Right : 0.5 , Top : 0.5 } ,
}
}
var fill xlsxFill
var fill xlsxFill
switch style . Fill . Type {
switch style . Fill . Type {
case "gradient" :
case "gradient" :
if len ( style . Fill . Color ) != 2 {
if len ( style . Fill . Color ) != 2 || style . Fill . Shading < 0 || style . Fill . Shading > 16 {
break
break
}
}
var gradient xlsxGradientFill
gradient := variants [ style . Fill . Shading ]
switch style . Fill . Shading {
gradient . Stop [ 0 ] . Color . RGB = getPaletteColor ( style . Fill . Color [ 0 ] )
case 0 , 1 , 2 , 3 :
gradient . Stop [ 1 ] . Color . RGB = getPaletteColor ( style . Fill . Color [ 1 ] )
gradient . Degree = variants [ style . Fill . Shading ]
if len ( gradient . Stop ) == 3 {
case 4 :
gradient . Stop [ 2 ] . Color . RGB = getPaletteColor ( style . Fill . Color [ 0 ] )
gradient . Type = "path"
case 5 :
gradient . Type = "path"
gradient . Bottom = 0.5
gradient . Left = 0.5
gradient . Right = 0.5
gradient . Top = 0.5
}
var stops [ ] * xlsxGradientFillStop
for index , color := range style . Fill . Color {
var stop xlsxGradientFillStop
stop . Position = float64 ( index )
stop . Color . RGB = getPaletteColor ( color )
stops = append ( stops , & stop )
}
}
gradient . Stop = stops
fill . GradientFill = & gradient
fill . GradientFill = & gradient
case "pattern" :
case "pattern" :
if style . Fill . Pattern > 18 || style . Fill . Pattern < 0 {
if style . Fill . Pattern > 18 || style . Fill . Pattern < 0 {