Spread.Sheets 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.
Specifies the cell padding.
Specifies the cell label options.
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,
                                         locked,
                                         textIndent,
                                         wordWrap,
                                         shrinkToFit,
                                         backgroundImage,
                                         cellType,
                                         backgroundImageLayout,
                                         tabStop,
                                         textDecoration,
                                         imeMode,
                                         name,
                                         parentName,
                                         watermark,
                                         cellPadding,
                                         labelOptions);
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 : Base,
   backgroundImageLayout : ImageLayout,
   tabStop : boolean,
   textDecoration : TextDecorationType,
   imeMode : ImeMode,
   name : string,
   parentName : string,
   watermark : string,
   cellPadding : string,
   labelOptions : Object
) : 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.
cellPadding
Specifies the cell padding.
labelOptions
Specifies the cell label options.
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)]);
Remarks

The cell label options are as follows:

Name Type Attributes Description
alignment GC.Spread.Sheets.LabelAlignment <optional>
The cell label position.
visibility GC.Spread.Sheets.LabelVisibility <optional>
The cell label visibility.
font string <optional>
The cell label font.
foreColor string <optional>
The cell label forecolor.
margin string <optional>
The cell label margin.
See Also

Reference

Style class

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.