HotXLS Docs

CaptureFormat method

Captures the complete formatting of an IXLSRange into a reusable TXLSFormatSnapshot. The snapshot is independent of the source workbook, so it can be applied later to ranges in the same or a different workbook

Syntax

function CaptureFormat: TXLSFormatSnapshot;

Remarks

The returned snapshot holds the full cell format (fonts, fills, borders, number formats, alignment, protection, and rich-text colour slots) captured at the time of the call. The caller owns the returned object and must free it when it is no longer needed. Apply the snapshot with ApplyFormat or TXLSFormatSnapshot.ApplyTo.

Example

var
  Snapshot: TXLSFormatSnapshot;
begin
  Snapshot:= Workbook.Sheets[1].Range['A1', 'D1'].CaptureFormat;
  {...}
  Workbook.Sheets[2].Range['A1', 'D1'].ApplyFormat(Snapshot);
  Snapshot.Free;
end;

See also