SpreadJS Documentation
Style Constructor
The background color.
The foreground color.
The horizontal alignment.
The vertical alignment.
The font.
The font theme.
The formatting object.
The left border.
The top border.
The right border.
The bottom border.
Whether the cell, row, or column is locked.
The text indent amount.
Whether words wrap within the cell or cells.
Whether content shrinks to fit the cell or cells.
The background image to display.
The cell type.
The layout for the background image.
Whether the user can set focus to the cell using the Tab key.
Specifies the decoration added to text.
Specifies the input method editor mode.
Specifies the name.
Specifies the name of the parent style.
Specifies the watermark content.
Represents the style for a cell, row, and column.
Syntax
var instance = new GcSpread.Sheets.Style(backColor,
                                        foreColor,
                                        hAlign,
                                        vAlign,
                                        font,
                                        themeFont,
                                        formatter,
                                        borderLeft,
                                        borderTop,
                                        borderRight,
                                        borderBottom,
                                        locked,
                                        textIndent,
                                        wordWrap,
                                        shrinkToFit,
                                        backgroundImage,
                                        cellType,
                                        backgroundImageLayout,
                                        tabStop,
                                        textDecoration,
                                        imeMode,
                                        name,
                                        parentName,
                                        watermark);
function Style( 
   backColor : string,
   foreColor : string,
   hAlign : HorizontalAlign,
   vAlign : VerticalAlign,
   font : string,
   themeFont : string,
   formatter : undefined,
   borderLeft : LineBorder,
   borderTop : LineBorder,
   borderRight : LineBorder,
   borderBottom : LineBorder,
   locked : boolean,
   textIndent : number,
   wordWrap : boolean,
   shrinkToFit : boolean,
   backgroundImage : string,
   cellType : BaseCellType,
   backgroundImageLayout : ImageLayout,
   tabStop : boolean,
   textDecoration : TextDecorationType,
   imeMode : ImeMode,
   name : string,
   parentName : string,
   watermark : string
) : Style;

Parameters

backColor
The background color.
foreColor
The foreground color.
hAlign
The horizontal alignment.
vAlign
The vertical alignment.
font
The font.
themeFont
The font theme.
formatter
The formatting object.
borderLeft
The left border.
borderTop
The top border.
borderRight
The right border.
borderBottom
The bottom border.
locked
Whether the cell, row, or column is locked.
textIndent
The text indent amount.
wordWrap
Whether words wrap within the cell or cells.
shrinkToFit
Whether content shrinks to fit the cell or cells.
backgroundImage
The background image to display.
cellType
The cell type.
backgroundImageLayout
The layout for the background image.
tabStop
Whether the user can set focus to the cell using the Tab key.
textDecoration
Specifies the decoration added to text.
imeMode
Specifies the input method editor mode.
name
Specifies the name.
parentName
Specifies the name of the parent style.
watermark
Specifies the watermark content.
Example
This example uses a style with rules.
activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
var cell = new GcSpread.Sheets.CellValueRule();
cell.operator = 2;
cell.value1 = 5;
cell.ranges = [new GcSpread.Sheets.Range(0, 0, 10, 1)];
cell.style = new GcSpread.Sheets.Style();
cell.style.backColor = "red";
cell.style.foreColor = "black";
activeSheet.getConditionalFormats().addRule(cell);

var top = new GcSpread.Sheets.Top10Rule();
top.type = 0;
top.rank = 3;
top.stopIfTrue(true);
top.ranges = [new GcSpread.Sheets.Range(0, 0, 10, 1)];
top.style = new GcSpread.Sheets.Style();
top.style.foreColor = "red";
activeSheet.getConditionalFormats().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 GcSpread.Sheets.Style();
style.backColor = "red";
style.borderLeft =new GcSpread.Sheets.LineBorder("blue");
style.borderTop = new GcSpread.Sheets.LineBorder("blue");
style.borderRight = new GcSpread.Sheets.LineBorder("blue");
style.borderBottom =  new GcSpread.Sheets.LineBorder("blue");
sheet.getConditionalFormats().addAverageRule( GcSpread.Sheets.AverageConditionType.Above,style,[new GcSpread.Sheets.Range(0, 0, 10, 3)]);
See Also

Reference

Style class

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.