Documentação HotXLS

Classes TXLSXConditionalFormat e TXLSXConditionalFormats

TXLSXConditionalFormats é a coleção de regras exposta por TXLSXWorksheet.ConditionalFormats e oferece regras de célula, visuais, de texto, classificação e média

Métodos da coleção

function Add(const ARange: WideString; AOp: TXLSXCfOperator; const AFormula1: WideString): Integer;
function AddDataBar(const ARange: WideString; AColor: LongWord; AMinKind: TXLSCfValueKind; const AMinValue: WideString; AMaxKind: TXLSCfValueKind; const AMaxValue: WideString): Integer;
function AddColorScale2(...): Integer;
function AddColorScale3(...): Integer;
function AddIconSet(const ARange: WideString; ASetType: TXLSIconSetType): Integer;
function AddExpression(const ARange, AFormula: WideString): Integer;
function AddTextRule(const ARange: WideString; AKind: TXLSCfKind; const AText: WideString): Integer;
function AddTop10(const ARange: WideString; ARank: Integer; ABottom, APercent: Boolean): Integer;
function AddAboveAverage(const ARange: WideString; AAbove: Boolean): Integer;
function AddSimpleRule(const ARange: WideString; AKind: TXLSCfKind): Integer;

Membros da regra

Range, Op, Formula1 and Formula2Define uma regra padrão de comparação de células
StyleFormato diferencial tardio usado por regras de célula e expressão
DataBar, ColorScale and IconSetDados visuais para seus respectivos tipos de regra
Priority and StopIfTrueControlam a ordem das regras da folha de cálculo e o comportamento de curto-circuito
Text, Rank, Percent, Bottom and AboveAverageParâmetros para regras de texto, superior ou inferior e média
TimePeriodFaixa de datas relativas para regras de período

Exemplo

var Index: Integer;
begin
  Index := Sheet.ConditionalFormats.AddExpression('B2:B100', 'B2<0');
  Sheet.ConditionalFormats[Index].Style.SetFillBgColor($0000FF);
  Sheet.ConditionalFormats.AddColorScale3('C2:C100', $0000FF, $00FFFF, $00FF00, cfvMinOfRange, '', cfvPercentile, '50', cfvMaxOfRange, '');
end;

Veja também