WklFormatRule
WklFormatRule class
Signature
Dim myWklFormatRule As WklFormatRule
Summary
A conditional formatting rule of a tree list.
Parameters
None
Remarks
Not created directly; returned by other members of the library.
| Member | Kind | Summary |
|---|---|---|
| `Column` | Property | Gets or sets the column whose value is checked and which is formatted. |
| `Kind` | Property | Gets or sets the kind of rule. |
| `Operator` | Property | Gets or sets the comparison of a value rule. |
| `Value1` | Property | Gets or sets the value to compare with. |
| `Value2` | Property | Gets or sets the upper limit of wroBetween and wroNotBetween. |
| `Expression` | Property | Gets or sets the expression of an expression rule. |
| `ApplyToRow` | Property | Gets or sets whether the whole record is formatted when the rule matches. |
| `ForeColor` | Property | Gets or sets the text color. |
| `BackColor` | Property | Gets or sets the background color. |
| `Bold` | Property | Gets or sets bold text. |
| `Italic` | Property | Gets or sets italic text. |
| `Strikeout` | Property | Gets or sets struck-out text. |
| `StopIfTrue` | Property | Gets or sets whether later rules are skipped when this rule matches. |
| `BarColor` | Property | Gets or sets the color of a data bar. |
| `IconSet` | Property | Gets or sets the symbols of an icon set rule. |
| `Enabled` | Property | Gets or sets whether the rule is active. |
| `StatusKind` | Property | Gets or sets the kind whose colors the rule uses instead of fixed colors. |
| `MinValue` | Property | Gets or sets the fixed start of the scale of a data bar, icon set or color scale. |
| `MaxValue` | Property | Gets or sets the fixed end of the scale of a data bar, icon set or color scale. |
| `MinColor` | Property | Gets or sets the background color of a color scale at the start of the scale. |
| `MidColor` | Property | Gets or sets the background color of a color scale at MidValue. |
| `MaxColor` | Property | Gets or sets the background color of a color scale at the end of the scale. |
| `MidValue` | Property | Gets or sets the value that gets MidColor in a color scale of three colors. |
Code example
None
Inheritance
None
Column property
Signature
Property Get Column() As String Property Let Column(RHS As String)
Summary
Gets or sets the column whose value is checked and which is formatted.
Parameters
None
Property value: String – The column name; empty for an expression rule that formats the whole record.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Kind property
Signature
Property Get Kind() As WklRuleKind Property Let Kind(RHS As WklRuleKind)
Summary
Gets or sets the kind of rule.
Parameters
None
Property value: `WklRuleKind` – A `WklRuleKind` constant.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Operator property
Signature
Property Get Operator() As WklRuleOperator Property Let Operator(RHS As WklRuleOperator)
Summary
Gets or sets the comparison of a value rule.
Parameters
None
Property value: `WklRuleOperator` – A `WklRuleOperator` constant.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Value1 property
Signature
Property Get Value1() As Variant Property Let Value1(RHS As Variant)
Summary
Gets or sets the value to compare with.
Parameters
None
Property value: Variant – The comparison value.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Value2 property
Signature
Property Get Value2() As Variant Property Let Value2(RHS As Variant)
Summary
Gets or sets the upper limit of wroBetween and wroNotBetween.
Parameters
None
Property value: Variant – The upper limit.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Expression property
Signature
Property Get Expression() As String Property Let Expression(RHS As String)
Summary
Gets or sets the expression of an expression rule.
Parameters
None
Property value: String – An expression in Access syntax; field names in square brackets.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
ApplyToRow property
Signature
Property Get ApplyToRow() As Boolean Property Let ApplyToRow(RHS As Boolean)
Summary
Gets or sets whether the whole record is formatted when the rule matches.
Parameters
None
Property value: Boolean – True to format every cell of the record; False to format only the rule's column.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
ForeColor property
Signature
Property Get ForeColor() As Long Property Let ForeColor(RHS As Long)
Summary
Gets or sets the text color.
Parameters
None
Property value: Long – A color number; -1 leaves the color unchanged.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
BackColor property
Signature
Property Get BackColor() As Long Property Let BackColor(RHS As Long)
Summary
Gets or sets the background color.
Parameters
None
Property value: Long – A color number; -1 leaves the color unchanged.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Bold property
Signature
Property Get Bold() As Boolean Property Let Bold(RHS As Boolean)
Summary
Gets or sets bold text.
Parameters
None
Property value: Boolean – True for bold text.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Italic property
Signature
Property Get Italic() As Boolean Property Let Italic(RHS As Boolean)
Summary
Gets or sets italic text.
Parameters
None
Property value: Boolean – True for italic text.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Strikeout property
Signature
Property Get Strikeout() As Boolean Property Let Strikeout(RHS As Boolean)
Summary
Gets or sets struck-out text.
Parameters
None
Property value: Boolean – True for struck-out text.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
StopIfTrue property
Signature
Property Get StopIfTrue() As Boolean Property Let StopIfTrue(RHS As Boolean)
Summary
Gets or sets whether later rules are skipped when this rule matches.
Parameters
None
Property value: Boolean – True to stop at this rule.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
BarColor property
Signature
Property Get BarColor() As Long Property Let BarColor(RHS As Long)
Summary
Gets or sets the color of a data bar.
Parameters
None
Property value: Long – A color number.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
IconSet property
Signature
Property Get IconSet() As WklIconSet Property Let IconSet(RHS As WklIconSet)
Summary
Gets or sets the symbols of an icon set rule.
Parameters
None
Property value: `WklIconSet` – A `WklIconSet` constant.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
Enabled property
Signature
Property Get Enabled() As Boolean Property Let Enabled(RHS As Boolean)
Summary
Gets or sets whether the rule is active.
Parameters
None
Property value: Boolean – True to apply the rule.
Remarks
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
StatusKind property
Signature
Property Get StatusKind() As Long Property Let StatusKind(RHS As Long)
Summary
Gets or sets the kind whose colors the rule uses instead of fixed colors.
Parameters
None
Property value: Long – A `WklStatusKind` constant, or -1 (default) for none.
Remarks
A rule with a kind says what a value means (“bad”, “muted”) and takes its colors from the status palette that status labels, badges and buttons share, so all components show a meaning in the same colors. A value or expression rule takes the kind's text and background color (wskMuted only grays the text); a data bar takes the kind's strong color. A ForeColor, BackColor or changed BarColor set on the same rule wins over the kind.
In Windows high contrast mode a kind uses the system colors of the contrast theme: wskNeutral the window text, wskOk, wskWarn, wskBad and wskInfo the highlight, wskMuted gray text. The judging kinds then look alike, so the cell text must carry the meaning. Explicit colors stay as they are. Exports and printing keep the palette colors.
Other values than -1 and the kinds raise wkeInvalidValue.
Read/write.
Code example
Dim r As WklFormatRule Set r = Me!Grid1.Object.FormatRules.Add("Status", wrkValue, wroEqual, "gesperrt") r.StatusKind = wskBad
Inheritance
Declared by WklFormatRule.
MinValue property
Signature
Property Get MinValue() As Variant Property Let MinValue(RHS As Variant)
Summary
Gets or sets the fixed start of the scale of a data bar, icon set or color scale.
Parameters
None
Property value: Variant – A number, or Null (default) to take the smallest loaded value of the column.
Remarks
Without fixed ends, the scale runs from the smallest to the largest value among the loaded records. In server mode (DataMode) records load page by page, so the same value can draw a different bar on another page; fixed ends keep the bars comparable. Values outside the scale draw an empty or a full bar. Each end can be fixed on its own, for example a fixed 0 with the loaded maximum. Text, dates and other values raise wkeInvalidValue.
Read/write.
Code example
Dim r As WklFormatRule Set r = Me!Grid1.Object.FormatRules.Add("Auslastung", wrkDataBar) r.MinValue = 0 r.MaxValue = 100
Inheritance
Declared by WklFormatRule.
MaxValue property
Signature
Property Get MaxValue() As Variant Property Let MaxValue(RHS As Variant)
Summary
Gets or sets the fixed end of the scale of a data bar, icon set or color scale.
Parameters
None
Property value: Variant – A number, or Null (default) to take the largest loaded value of the column.
Remarks
See `MinValue`.
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
MinColor property
Signature
Property Get MinColor() As Long Property Let MinColor(RHS As Long)
Summary
Gets or sets the background color of a color scale at the start of the scale.
Parameters
None
Property value: Long – A color number. Default: white (RGB(255, 255, 255)).
Remarks
A color scale (wrkColorScale) colors the background of each cell of its column by the position of the value between MinValue and MaxValue: MinColor at the start, MaxColor at the end and a blend of both in between, computed per red, green and blue channel. With MidColor the scale has three colors. Values outside a fixed scale take the color of the nearer end. Null and values that are not numbers keep their background.
On a dark background the cell text turns white, so it stays readable; a ForeColor set on the rule wins. A rule earlier in the list that sets a background wins over the color scale, as the order of the rules is their priority. In Windows high contrast mode the color scale draws nothing, like a data bar. An export as shown (ExportToXlsx with wemWysiwyg) writes the colors as cell fills; the default export (wemDataAware) writes the values only.
Read/write.
Code example
Dim r As WklFormatRule Set r = Me!Grid1.Object.FormatRules.Add("Anmeldungen", wrkColorScale) r.MinColor = RGB(255, 255, 255) r.MaxColor = RGB(31, 78, 121)
Inheritance
Declared by WklFormatRule.
MidColor property
Signature
Property Get MidColor() As Long Property Let MidColor(RHS As Long)
Summary
Gets or sets the background color of a color scale at MidValue.
Parameters
None
Property value: Long – A color number, or -1 (default) for a scale of two colors from MinColor straight to MaxColor.
Remarks
With a middle color, each half of the scale is blended on its own: from MinColor to MidColor up to MidValue, and from MidColor to MaxColor above it. A typical three-color scale is red, yellow and green.
Read/write.
Code example
Dim r As WklFormatRule Set r = Me!Grid1.Object.FormatRules.Add("Erfuellung", wrkColorScale) r.MinColor = RGB(248, 105, 107) r.MidColor = RGB(255, 235, 132) r.MaxColor = RGB(99, 190, 123) r.MidValue = 100
Inheritance
Declared by WklFormatRule.
MaxColor property
Signature
Property Get MaxColor() As Long Property Let MaxColor(RHS As Long)
Summary
Gets or sets the background color of a color scale at the end of the scale.
Parameters
None
Property value: Long – A color number. Default: the blue of data bars (RGB(99, 156, 216)).
Remarks
See `MinColor`.
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.
MidValue property
Signature
Property Get MidValue() As Variant Property Let MidValue(RHS As Variant)
Summary
Gets or sets the value that gets MidColor in a color scale of three colors.
Parameters
None
Property value: Variant – A number, or Null (default) for the middle between the two ends of the scale.
Remarks
A fixed middle keeps one meaning at one color, for example a target value of 100 % in yellow, wherever the loaded values lie. A middle outside the scale is clamped to the nearer end. Text, dates and other values raise wkeInvalidValue.
Read/write.
Code example
None
Inheritance
Declared by WklFormatRule.