HotXLS 文档

AddCondFormatColorScale3 方法

Adds an Excel 2007+ 3-stop Color Scale conditional formatting rule over a cell range, returning the new TCondFormatRule。单元格会得到一个在三个颜色停靠点之间插值的渐变填充:最小值、中间值(默认位于第 50 百分位)和最大值。(v2.34.0 起可用)

语法

function AddCondFormatColorScale3(const ARange: WideString;
  AMinColor, AMidColor, AMaxColor: LongWord;
  AMinKind: TXLSCfValueKind = cfvMinOfRange; const AMinValue: WideString = '';
  AMidKind: TXLSCfValueKind = cfvPercentile; const AMidValue: WideString = '50';
  AMaxKind: TXLSCfValueKind = cfvMaxOfRange; const AMaxValue: WideString = ''): TCondFormatRule;
ARange WideString. Sqref string, e.g. 'A1:A10'
AMinColor / AMidColor / AMaxColor LongWord. Three gradient anchor colors in Delphi BGR format
AMinKind / AMidKind / AMaxKind TXLSCfValueKind。阈值类型。中间值默认为 cfvPercentile / '50' — 即经典的 "红–黄–绿" Excel 预设
AMinValue / AMidValue / AMaxValue WideString. Threshold literal text. AMidValue defaults to '50' to pair with cfvPercentile

示例

This example colors A1:A10 with the classic Red-Yellow-Green scale

Sheet.AddCondFormatColorScale3('A1:A10',
  $000000FF, $0000FFFF, $0000FF00);

请参阅