Wiki Markup |
---|
{description} {excerpt}Applies the specified [Style|Condition.Style] to the [Condition|Condition]'s current [Style|Condition.Style]. {excerpt} {signature:C#} public void ApplyStyle(Style style) {signature}{signature:vb.net} Public Sub ApplyStyle(ByVal style As Style) {signature} {parameters} {param:style}The {{Style}} object to apply to the {{Condition}}'s current {{Style}}.{param} {remarks} A {{Condition}}'s {{Style}} is the formatting that will be set on a conditionally formatted cell if the condition is met. When a {{Style}} is *applied* \(rather than *set* using the {{Style}} property\), only the differences between the new {{Style}} and existing {{Style}} properties will take effect. To completely replace a {{Condition}}'s {{Style}} with a new one, set [Condition.Style|Condition.Style]. {remarks} {example}{code:csharp|title=C#} ExcelApplication xla = new ExcelApplication(); Workbook wb = xla.Create(); ConditionalFormat condFmt = wb.CreateConditionalFormat(); Condition cond = condFmt.CreateCondition( Condition.Comparison.CellValueGreaterThan, "=100"); cond.Style.BackgroundColor = Palette.SystemColor.Green; Style styleBold = wb.CreateStyle(); styleBold.Font.Bold = true; cond.ApplyStyle(styleBold); Range rng = wb.Worksheets[0].CreateRange("$B$2:$F$10"); rng.SetConditionalFormat(condFmt); {code} {code:vb.net|title=vb.net} Dim xla As New ExcelApplication() Dim wb As Workbook = xla.Create() Dim condFmt As ConditionalFormat = wb.CreateConditionalFormat() Dim cond As Condition = _ condFmt.CreateCondition( _ Condition.Comparison.CellValueGreaterThan, _ "=100") cond.Style.BackgroundColor = Palette.SystemColor.Green Dim styleBold As Style = wb.CreateStyle() styleBold.Font.Bold = True cond.ApplyStyle(styleBold) Dim rng As Range = wb.Worksheets[0].CreateRange("$B$2:$F$10") rng.SetConditionalFormat(condFmt) {code} {example} |
Page History
Overview
Content Tools