HotXLS Docs

TXLSXFill / TXLSXFills classes

Workbook-level fill palette for the XLSX facade. The collection lives on TXLSXWorkbook.Fills; individual cells pick a fill through TXLSXCell.FillIndex (1-based). SaveAs emits a real <fills> list inside xl/styles.xml (with the OOXML-reserved none/gray125 pair preserved at indices 0/1) and pairs each user fill with a dedicated cellXf; Open reads them back. Declared in lxHandleX.

TXLSXFillPattern declaration

type
  TXLSXFillPattern = (
    xlsxFillNone,
    xlsxFillSolid,
    xlsxFillGray125,
    xlsxFillMediumGray,
    xlsxFillDarkGray,
    xlsxFillLightGray,
    xlsxFillDarkHorizontal,
    xlsxFillDarkVertical,
    xlsxFillDarkDown,
    xlsxFillDarkUp,
    xlsxFillDarkGrid,
    xlsxFillDarkTrellis,
    xlsxFillLightHorizontal,
    xlsxFillLightVertical,
    xlsxFillLightDown,
    xlsxFillLightUp,
    xlsxFillLightGrid,
    xlsxFillLightTrellis,
    xlsxFillGray0625);
      
Mirrors the OOXML patternType token set. The most common pattern is xlsxFillSolid, which paints the cell with the foreground color.

TXLSXFill declaration

type
  TXLSXFill = class
    constructor Create;
    procedure Assign(Source: TXLSXFill);
    property Pattern: TXLSXFillPattern;
    property ForegroundColor: LongWord;
    property ForegroundIsAuto: Boolean;
    property ForegroundColorTheme: Integer;
    property ForegroundColorIndex: Integer;
    property ForegroundTintAndShade: Double;
    property BackgroundColor: LongWord;
    property BackgroundIsAuto: Boolean;
    property BackgroundColorTheme: Integer;
    property BackgroundColorIndex: Integer;
    property BackgroundTintAndShade: Double;
  end;
      

TXLSXFill members

Pattern OOXML patternType. Defaults to xlsxFillSolid.
ForegroundColor / ForegroundIsAuto 8-digit ARGB foreground. For solid fills this is the visible cell color. ForegroundIsAuto = True suppresses the <fgColor/> child so Excel uses the automatic theme color.
ForegroundColorTheme / ForegroundColorIndex / ForegroundTintAndShade Theme / indexed color path for the foreground. Priority: ForegroundColorTheme ≥ 0 (theme slot, emits theme="N" tint="...") > ForegroundColorIndex ≥ 0 (indexed slot, emits indexed="N") > ForegroundColor (RGB). Default values are -1 / -1 / 0.0 (RGB path active).
BackgroundColor / BackgroundIsAuto 8-digit ARGB background. Only relevant for non-solid patterns (lines, trellis, etc.) and conventionally mirrors ForegroundColor for solid fills.
BackgroundColorTheme / BackgroundColorIndex / BackgroundTintAndShade Same theme / indexed priority as the foreground properties, applied to the background color element.

TXLSXFills declaration

type
  TXLSXFills = class
    function Add: TXLSXFill; overload;
    function Add(Source: TXLSXFill): Integer; overload;
    function AddSolid(AColor: LongWord): Integer;
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXFill; default;
  end;
      

TXLSXFills members

Add Creates an empty solid fill and appends it. Returns the new instance for further tweaking.
Add(Source) Copies every property from Source into a new entry and appends it. Returns the new index.
AddSolid(Color) Convenience shortcut: appends a solid fill with both foreground and background set to Color (ARGB). Returns the new index.
Count / Items[i] Standard collection accessors.

Example

var
  yellow: Integer;
begin
  yellow := Workbook.Fills.AddSolid($FFFFFF00);
  Worksheet.Cells.Item[1, 1].Value := 'Highlighted';
  Worksheet.Cells.Item[1, 1].FillIndex := yellow + 1;
end;
    

See also