HotXLS-dokumentasjon Innhold Hjem Oversikt IXLSInterior XLS color model Hjem Innhold Oversikt

SetPatternThemeColor method (Interior)

Sets the cell pattern (background) color to one of the 12 Office theme color slots with an optional tint adjustment. This is the pattern-color companion of Interior.SetThemeColor — use it together with a non-solid Pattern to render hatch / dotted fills that re-tint when Excel re-applies the workbook theme. Available since v2.61.0 (chart backlog wave D phase 4)

Syntaks

procedure SetPatternThemeColor(ThemeIdx: Word; Tint: Double);

Parametere

ThemeIdx — 0-based theme slot (0=lt1, 1=dk1, 2=lt2, 3=dk2, 4..9=accent1..6, 10=hlink, 11=foHlink) Tint — spec-style lighter/darker adjustment in the range -1.0 .. +1.0 Encoded into FullColorExt.nTintShade as a Q15 signed integer on the XFExt record

Merknader

Two wires are emitted for every call so the cell renders correctly in both Excel 2007+ and Excel 2003:
  • The XF record gets a best-match indexed icv for the pattern color (legacy reader path)
  • The XFExt $087D record gets a FullColorExt slot for the fillBg extType ($0005) with xclrType=3 (theme), xclrValue=ThemeIdx, and nTintShade derived from Tint
Reading back via Interior.PatternColor returns the resolved RGB (theme + tint applied), so callers always see a concrete LongWord

Eksempel

Renders a striped warning band using the accent1 / accent2 theme slots so the colors track the workbook theme
var Stripes: IXLSRange; begin Stripes := Workbook.Sheets[1].Range['B2', 'B10']; Stripes.Interior.Pattern := xlPatternGray25; Stripes.Interior.SetThemeColor(4, 0.4); // fill foreground (accent1, lighter) Stripes.Interior.SetPatternThemeColor(5, - 0.25); // pattern color (accent2, darker) Workbook.SaveAs('PatternThemeFills.xls', xlExcel97); end;

Se også

grensesnitt IXLSInterior
IXLSInterior.SetThemeColormetode
IXLSInterior.Patternegenskap
IXLSInterior.PatternColoregenskap Copyright © 2010-2026 losLab Software