creates a new style
styleProps | object | an object with the new style properties |
baseStyle | object | optional, an object of the base style |
page | string | optional, the name of the sheet |
// adding a style
var styleProps = $$("ssheet").addStyle({
"background":"#6E6EFF",
"color": "#FFFFFF",
}, null, "Sheet1");
// setting the created style for a cell
$$("ssheet").setStyle(3,2,styleProps);
// redrawing SpreadSheet
$$("ssheet").refresh();
You can use a previously created style as a base and complete it with some new style properties to make a new style:
// creating a new style on the base of the previous one
var newStyle = $$("ssheet").addStyle({
"font-style": "italic"
}, baseStyle);
// applying the new style to a cell
$$("ssheet").setStyle(3,2, newStyle);
// redrawing SpreadSheet
$$("ssheet").refresh();
Note that the style options are limited:
"background", "borders", "border-bottom", "border-left", "border-right", "border-top", "color", "font-family", "font-size", "font-style", "font-weight", "format", "indent", "strike", "text-align", "underline", "vertical-align", "wrap".
Pay attention that for cell borders you can specify only the border-color property, while the border-width and border-style properties have predefined values: 1px and solid, correspondingly.