Back to Devexpress

TdxSpreadSheetConditionalFormattingRuleDataBar.Style Property

vcl-dxspreadsheetconditionalformattingrules-dot-tdxspreadsheetconditionalformattingruledatabar.md

latest3.5 KB
Original Source

TdxSpreadSheetConditionalFormattingRuleDataBar.Style Property

Provides access to data bar appearance settings.

Declaration

delphi
property Style: TdxSpreadSheetConditionalFormattingRuleDataBarStyle read; write;

Property Value

TypeDescription
TdxSpreadSheetConditionalFormattingRuleDataBarStyle

Stores data bar appearance settings.

|

Remarks

Use the Style property to configure the appearance of data bars and their axes in all affected cells.

You can use Style.Direction and Style.FillMode to change bar direction and background fill mode. Refer to the TdxSpreadSheetConditionalFormattingRuleDataBarStyle class description for detailed information on all available options.

Code Example: Apply a Data Bar Conditional Formatting Rule to a Data Grid Column

The following code example creates a data bar conditional formatting rule and applies it to a column in a TcxGrid control’s data-aware Table View:

delphi
var
  ARule: TdxSpreadSheetConditionalFormattingRuleDataBar;
begin
  cxGrid1DBTableView1.ConditionalFormatting.Add(cxGrid1DBTableView1Column1.Caption,
              TdxSpreadSheetConditionalFormattingRuleDataBar, ARule);
  ARule.BeginUpdate; // Initiates the following batch change
  try  
    ARule.Style.NegativeBarColor := clRed;  
    ARule.Style.NegativeBarBorderColor := clRed;  

    ARule.Style.PositiveBarColor := clGreen;  
    ARule.Style.PositiveBarBorderColor := clGreen;  
    ARule.Style.FillMode := dbfmSolid;
  finally  
    ARule.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
  end;
end;
cpp
TdxSpreadSheetConditionalFormattingRuleDataBar *ARule;
// ...
  cxGrid1DBTableView1->ConditionalFormatting->Add(cxGrid1DBTableView1Column1->Caption,
           __classid(TdxSpreadSheetConditionalFormattingRuleDataBar), &ARule);
  ARule->BeginUpdate(); // Initiates the following batch change
  try
  {
    ARule->Style->NegativeBarColor = clRed;
    ARule->Style->NegativeBarBorderColor = clRed;

    ARule->Style->PositiveBarColor = clGreen;
    ARule->Style->PositiveBarBorderColor = clGreen;
    ARule->Style->FillMode = dbfmSolid;
  }
  __finally
  {
    ARule->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
  }

See Also

TdxSpreadSheetConditionalFormattingRuleDataBar.ShowValue Property

TdxSpreadSheetConditionalFormattingRuleDataBar Class

TdxSpreadSheetConditionalFormattingRuleDataBar Members

dxSpreadSheetConditionalFormattingRules Unit