SpreadJS 14
GC.Spread.Sheets Namespace / Style class
In This Topic
    Style class
    In This Topic
    Represents the style for a cell, row, and column.
    Syntax
    var instance = new GC.Spread.Sheets.Style(backColor,
                                             foreColor,
                                             hAlign,
                                             vAlign,
                                             font,
                                             themeFont,
                                             formatter,
                                             borderLeft,
                                             borderTop,
                                             borderRight,
                                             borderBottom,
                                             diagonalDown,
                                             diagonalUp,
                                             locked,
                                             textIndent,
                                             wordWrap,
                                             shrinkToFit,
                                             backgroundImage,
                                             cellType,
                                             backgroundImageLayout,
                                             tabStop,
                                             textDecoration,
                                             imeMode,
                                             name,
                                             parentName,
                                             watermark,
                                             cellPadding,
                                             labelOptions,
                                             labelOptions.alignment,
                                             labelOptions.visibility,
                                             labelOptions.font,
                                             labelOptions.foreColor,
                                             labelOptions.margin,
                                             isVerticalText,
                                             textOrientation);
    function Style;
    Example
    //This example uses a style with rules.
    activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    style.foreColor = "black";
    var cell = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
    cell.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
    cell.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan);
    cell.value1(5);
    cell.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
    cell.style(style);
    activeSheet.conditionalFormats.addRule(cell);
    var style1 = new GC.Spread.Sheets.Style();
    style1.foreColor = "red";
    var top = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
    top.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.top10Rule);
    top.type(GC.Spread.Sheets.ConditionalFormatting.Top10ConditionType.top);
    top.rank(3);
    top.style(style1);
    top.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
    top.stopIfTrue(true);
    activeSheet.conditionalFormats.addRule(top);
    //This example creates and sets parameters for the style.
    sheet.setValue(0,0, 1,3);
    sheet.setValue(1,0, 50,3);
    sheet.setValue(2,0, 100,3);
    sheet.setValue(3,0, 2,3);
    sheet.setValue(4,0, 60,3);
    sheet.setValue(5,0, 90,3);
    sheet.setValue(6,0, 3,3);
    sheet.setValue(7,0, 40,3);
    sheet.setValue(8,0, 70,3);
    sheet.setValue(9,0, 5,3);
    sheet.setValue(10,0, 35,3);
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    style.borderLeft =new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
    style.borderTop = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
    style.borderRight = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
    style.borderBottom =  new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
    sheet.conditionalFormats.addAverageRule(GC.Spread.Sheets.ConditionalFormatting.AverageConditionType.above, style, [new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
    Inheritance Hierarchy

    Object
       GC.Spread.Sheets.Style

    Constructors
     NameDescription
    public ConstructorRepresents the style for a cell, row, and column.  
    Top
    Fields
     NameDescription
    public FieldIndicates the background color.  
    public FieldIndicates the background image.  
    public FieldIndicates the background image layout.  
    public FieldIndicates the bottom border line.  
    public FieldIndicates the left border line.  
    public FieldIndicates the right border line.  
    public FieldIndicates the top border line.  
    public FieldIndicates the cellButtons of cell.  
    public FieldIndicates the cell padding.  
    public FieldIndicates the cell type.  
    public FieldIndicates the diagonalDown border line.  
    public FieldIndicates the diagonalUp border line.  
    public FieldIndicates the dropdown type of cell.  
    public FieldIndicates the font.  
    public FieldIndicates the foreground color.  
    public FieldIndicates the formatter.  
    public FieldIndicates the horizontal alignment.  
    public FieldIndicates the Input Method Editor (IME) mode.  
    public FieldIndicates whether to set the text vertical.  
    public FieldIndicates the cell label options.  
    public FieldIndicates whether a cell is marked as locked from editing.  
    public FieldIndicates the name.  
    public FieldIndicates the name of the parent style.  
    public FieldControls whether the Text out of bounds shows ellipsis.  
    public FieldIndicates whether to shrink to fit.  
    public FieldIndicates whether the user can set focus to the cell using the Tab key.  
    public FieldIndicates the decoration added to text.  
    public FieldIndicates the number of units of indentation for text in a cell, an integer value, where an increment of 1 represents 8 pixels.  
    public FieldIndicates the text rotation angle of cell.  
    public FieldIndicates the font theme.  
    public FieldIndicates the vertical alignment.  
    public FieldIndicates the watermark content.  
    public FieldIndicates whether to wrap text.  
    Top
    Methods
     NameDescription
    public MethodClones the current style.  
    Top
    See Also