vcl-dxspreadsheetconditionalformattingrules-e0181242.md
An Icon Set conditional formatting rule.
TdxSpreadSheetConditionalFormattingRuleIconSet = class(
TdxSpreadSheetConditionalFormattingRuleCustomScale
)
An Icon Set rule allows you to mark cell values with icons according to threshold values associated with the icons.
The list below outlines key members of the TdxSpreadSheetConditionalFormattingRuleDataBar class. These members allow you to configure Data Bar rule settings.
AreasAllows you to manage the conditional formatting rule’s target areas.CloneCopies the rule between different sets of target areas.Index | StopIfTrueSpecify how the rule interacts with other conditional formatting rules applied to the same cells.
OrderAllows you to change icon order in the current icon preset.PresetNameAllows you to switch between available icon presets.StopCountSpecifies the number of threshold values.StopsProvides indexed access to individual threshold values and related settings.ShowValueSpecifies if cell values are visible.
AssignCopies compatible settings between conditional formatting rules.BeginUpdate | EndUpdateAllow you to avoid excessive redraw operations during batch rule setting changes.GetDetailsReturns the conditional formatting rule’s name displayed in the Conditional Formatting Rules Manager dialog.LoadFromStream | SaveToStreamAllow you to store conditional formatting rule settings in a stream.OwnerProvides access to the parent conditional formatting controller.
To create an Icon Set conditional formatting rule, you can call one of the overloaded Add procedures of the corresponding conditional formatting controller and pass a reference to the TdxSpreadSheetConditionalFormattingRuleIconSet class as the ARuleClass parameter:
TcxDataControllerConditionalFormatting.AddCreates a new conditional formatting rule for a Data Grid, Tree List, or Vertical Grid control.TdxSpreadSheetConditionalFormatting.AddCreates a new conditional formatting rule in a spreadsheet document.
Alternatively, you can call the constructor of the TdxSpreadSheetConditionalFormattingRuleIconSet class and pass the target conditional formatting controller as the AOwner parameter.
The following code example creates an Icon Set conditional formatting rule with three threshold values and applies the rule to the first column in a TcxGrid control’s data-aware Table View:
var
ARule: TdxSpreadSheetConditionalFormattingRuleIconSet;
begin
cxGrid1DBTableView1.ConditionalFormatting.Add(0, TdxSpreadSheetConditionalFormattingRuleIconSet, ARule);
ARule.BeginUpdate; // Initiates the following batch change
try
ARule.PresetName := ConditionalFormattingIconSet.Presets.Items[1].Name;
ARule.Stops[0].ValueType := cssvtValue;
ARule.Stops[0].Value := 0;
ARule.Stops[1].ValueType := cssvtValue;
ARule.Stops[1].Value := 25;
ARule.Stops[2].ValueType := cssvtValue;
ARule.Stops[2].Value := 50;
finally
ARule.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
TdxSpreadSheetConditionalFormattingRuleIconSet *ARule;
// ...
cxGrid1DBTableView1->ConditionalFormatting->Add(0,
__classid(TdxSpreadSheetConditionalFormattingRuleIconSet), &ARule);
ARule->BeginUpdate(); // Initiates the following batch change
try
{
ARule->PresetName = ConditionalFormattingIconSet()->Presets->Items[1]->Name;
ARule->Stops[0]->ValueType = cssvtValue;
ARule->Stops[0]->Value = 0;
ARule->Stops[1]->ValueType = cssvtValue;
ARule->Stops[1]->Value = 25;
ARule->Stops[2]->ValueType = cssvtValue;
ARule->Stops[2]->Value = 50;
}
__finally
{
ARule->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
}
To delete an individual Icon Set conditional formatting rule, do one of the following:
delete keyword in C++Builder).Alternatively, you can call the TdxSpreadSheetCustomConditionalFormatting.Clear procedure to delete all rules in a conditional formatting controller.
You can also use the following threshold-based rules:
TdxSpreadSheetConditionalFormattingRuleDataBarA Data Bar conditional formatting rule.TdxSpreadSheetConditionalFormattingRuleThreeColorScaleA Three Color Scale conditional formatting rule.TdxSpreadSheetConditionalFormattingRuleTwoColorScaleA Two Color Scale conditional formatting rule.
The TdxSpreadSheetCustomConditionalFormatting.Rules property references the TdxSpreadSheetConditionalFormattingRuleIconSet class as a TdxSpreadSheetCustomConditionalFormattingRule object.
To access all public API members, you need to cast the returned object to the TdxSpreadSheetConditionalFormattingRuleIconSet class. You can call the rule’s ClassType function to identify the actual rule type.
TObject TPersistent TInterfacedPersistent TcxInterfacedPersistent TdxSpreadSheetCustomConditionalFormattingRule TdxSpreadSheetConditionalFormattingCustomRule TdxSpreadSheetConditionalFormattingRuleCustomScale TdxSpreadSheetConditionalFormattingRuleIconSet
See Also
TdxSpreadSheetConditionalFormattingRuleCustomScale Class