Search code examples
delphidevexpresstcxgrid

cxgrid color numbers in the grid using styles


I would like to apply a style to a column (on get content style) so all numbers in that column color to the selected style. Just the numbers, nothing else.That means that if a number is found within a text phrase it will get colored. Is this possible ?


Solution

  • Sure. Use something like

    procedure TForm1.Column1StylesGetContentStyle(
      Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
      AItem: TcxCustomGridTableItem; var AStyle: TcxStyle);
    var
      i: Integer;
    begin
      if TryStrToInt(ARecord.Values[Column1.Index], i) then
        AStyle := cxStyle1;
    end;