TdxSpreadSheetConditionalFormattingRuleTopBottomValues.ValueType Property
In This Article
Specifies if the rule applies custom formatting to an absolute or relative number of cells.
#Declaration
Delphi
property ValueType: TdxSpreadSheetConditionalFormattingRuleTopBottomValuesValueType read; write; default tbvvtRank;
#Property Value
Type | Default | Description |
---|---|---|
Tdx |
tbvvt |
The active target cell identification mode. |
#Remarks
The Value property specifies the absolute or relative number of target cells. You can set the ValueType
property to tbvvtPercent or tbvvtRank to switch between percentage and absolute cell count modes.
To switch between top and bottom cell value formatting modes, use the Direction property.
#Code Example: Apply Custom Formatting to Top and Bottom Values
The following code example creates two Top/Bottom Values conditional formatting rules and applies them to the top and bottom 10%
of values in the selected cell range in the currently visible worksheet in a TdxSpreadSheet control:
var
ATableView: TdxSpreadSheetTableView;
ATopBottomRule: TdxSpreadSheetConditionalFormattingRuleTopBottomValues;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
if ATableView.Selection.Count = 0 then Exit;
ATableView.ConditionalFormatting.BeginUpdate; // Initiates the following batch change
try
ATableView.ConditionalFormatting.Add(ATableView.Selection.Area,
TdxSpreadSheetConditionalFormattingRuleTopBottomValues, ATopBottomRule);
ATopBottomRule.Style.Brush.BackgroundColor := clBlue;
ATopBottomRule.Style.Brush.ForegroundColor := clPurple;
ATopBottomRule.Style.Brush.Style := sscfsDiagonalStrip;
ATopBottomRule.Style.Font.Style := [fsBold];
ATopBottomRule.Style.Font.Color := clWhite;
ATopBottomRule.Direction := tbvdTop;
ATopBottomRule.ValueType := tbvvtPercent;
ATableView.ConditionalFormatting.Add(ATableView.Selection.Area,
TdxSpreadSheetConditionalFormattingRuleTopBottomValues, ATopBottomRule);
ATopBottomRule.Style.Brush.BackgroundColor := clGreen;
ATopBottomRule.Style.Brush.ForegroundColor := clLime;
ATopBottomRule.Style.Brush.Style := sscfsRevDiagonalStrip;
ATopBottomRule.Style.Font.Color := clWhite;
ATopBottomRule.Style.Font.Style := [fsBold];
ATopBottomRule.Direction := tbvdBottom;
ATopBottomRule.ValueType := tbvvtPercent;
finally
ATableView.ConditionalFormatting.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
#Default Value
The ValueType
property’s default value is tbvvtRank.
See Also