BOOL32 __stdcall tblSetColor(ITBL Table, int32_t Row, int32_t Col, TTableColor ClrType, TPDFColorSpace CS, uint32_t Color);
BOOL32 __stdcall tblSetColorEx(ITBL Table, int32_t Row, int32_t Col, TTableColor ClrType, float* Color, uint32_t NumComps, TExtColorSpace CS, int32_t Handle);
function tblSetColor(const Table: ITBL; Row, Col: Integer; ClrType: TTableColor; CS: TPDFColorSpace; Color: Cardinal): LongBool; stdcall;
function tblSetColorEx(const Table: ITBL; Row, Col: Integer; ClrType: TTableColor; Color: PSingle; NumComps: Cardinal; CS: TExtColorSpace; Handle: Integer): LongBool; stdcall;
Purpose. Set a cell's background or text color, as a packed 0xRRGGBB value (plain form) or as floating-point color-space components (extended form).
Description. MAJOR VERIFIED FINDING, both functions: CS (the declared color space) is accepted by the ABI but never consulted by either function — colors are always interpreted as plain RGB (or, for tblSetColorEx with fewer than 3 components, grayscale replicated across R/G/B) regardless of what CS claims. tblSetColorEx additionally accepts a Handle (an extended/ICC-ish color-space handle) that is also never read. Verified further: tblSetColor (the plain form) ignores ClrType entirely as well — it always calls SetCellBg (background), regardless of what ClrType is set to; there is no way to set a cell's *text* color via tblSetColor at all, despite TTableColor's presence implying a selectable target. tblSetColorEx does distinguish ClrType, but only two of its ordinals actually do anything: Ord(ClrType) = 0 sets background, Ord(ClrType) = 5 sets text color — any other TTableColor ordinal (e.g. border-related values, if the enum has more members between 0 and 5) is a silent no-op that still returns True (a false-positive success). Practical implication of the dropped CS/NumComps handling: if a caller passes 4 components intending CMYK, tblSetColorEx still only reads the *first 3* as if they were RGB — a genuine, verified color-space misinterpretation, not merely an unused parameter.
Parameters.
| Parameter | Description |
|---|---|
Table | Target table handle. |
Row, Col | Target cell coordinates. |
ClrType | *(SetColor)* Accepted but completely ignored — always sets background. *(SetColorEx)* Only ordinals 0 (background) and 5 (text) have any effect; all others are silent no-ops. |
CS | Accepted but never consulted by either function — colors are always treated as RGB/grayscale regardless of the declared space. |
Color | *(SetColor)* Packed 0xRRGGBB. |
Color, NumComps | *(SetColorEx)* Float components, 0.0..1.0; ≥3 = RGB (only the first 3 used, even if more are supplied), <3 = grayscale (first value replicated to R/G/B). |
Handle | *(SetColorEx only)* Accepted but never used. |
Return value. True if Table/coordinates resolve (tblSetColorEx additionally requires Color <> nil and NumComps ≥ 1) — True does not imply the color was actually applied, for an unrecognized ClrType in the Ex form.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Misc
tblSetColorEx
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.