addStyle

creates a new style

void addStyle(object styleProps, [object baseStyle,string page] );
stylePropsobjectan object with the new style properties
baseStyleobjectoptional, an object of the base style
pagestringoptional, the name of the sheet

Example

// 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();

Details

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.

See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix mvc library and page of web spreadsheet product.