在 V14.0 中,单元格支持渐变及模板填充,效果如下图:
示例代码
- sheet = spread.getActiveSheet()
-
- var style = new GC.Spread.Sheets.Style();
- style.backColor = "red"; //the old solid fill
- sheet.setStyle(1,1,style);
-
- var gra = {degree: 315, stops: [{position:0, color:"red"},{position:0.5, color:"white"},{position:1, color:"blue"},]};
- style = new GC.Spread.Sheets.Style();
- style.backColor = gra;
- sheet.setStyle(2,1,style);
-
- var gra2 = {type:"path", left: 0.4, top: 0.4, right: 0.6, bottom: 0.6, stops: [{position:0, color:"black"},{position:0.5, color:"blue"},{position:1, color:"white"},]},
- style = new GC.Spread.Sheets.Style();
- style.backColor = gra2;
- sheet.setStyle(3,1,style)
-
- for(i=1; i<19; i++){
- var pat = {type: i, backgroundColor: "orange", patternColor: "red"};
- style = new GC.Spread.Sheets.Style();
- style.backColor = pat;
- sheet.setStyle(4+i,1,style)
- }
复制代码
|
|