Unit: lxHandle
A reusable snapshot of a cell range's full formatting, captured by
IXLSRange.CaptureFormat and applied with
IXLSRange.ApplyFormat
Description
TXLSFormatSnapshot holds the complete cell format (fonts,
fills, borders, number formats, alignment, protection, and rich-text
colour slots) captured at a point in time. The snapshot is independent
of the workbook it came from, so it can be applied to ranges in the
same or a different workbook. Instances are created by
IXLSRange.CaptureFormat; the caller owns the returned
object and must free it.
Each theme- and palette-aware colour attribute is stored as an
TXLSXfRichSlot record — the resolved colour plus which
richer source it came from — and the slot positions are identified by
TXLSXfRichSlotID (rsFillFg, rsFillBg,
rsFont, rsTop, rsBottom,
rsLeft, rsRight, rsDiag); the
snapshot groups them in an TXLSXfRichColors aggregate, and
TXLSXfRichSlotSet selects several slots in one call so a
single setter can restyle fill, font, and border colours together.
Methods
procedure ApplyTo(const ARange: IXLSRange) — applies
this snapshot to the given range
Example
var
Snapshot: TXLSFormatSnapshot;
begin
Snapshot:= Workbook.Sheets[1].Range['A1', 'D1'].CaptureFormat;
Snapshot.ApplyTo(Workbook.Sheets[2].Range['A1', 'D1']);
Snapshot.Free;
end;
See also