GC.Spread.Sheets Namespace > Style class : Style Constructor |
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;
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);
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)]);
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. |