HotXLS Docs

TXLSXStructuralEditRegistry class

TXLSXWorksheet.StructuralEditRegistry coordinates reference-sensitive updates after row or column insertion and deletion

Built-in participants always update HotXLS formulas, names, validations, conditional formats, comments, hyperlinks, drawings, tables, query bindings, scenarios, data tables, print metadata, protected ranges, sparklines, typed pivots, and recognisable preserved extension references

Applications can register ordered participants for their own sheet metadata without replacing the built-in transaction

Declarations

type
  TXLSXStructuralEdit = record
    RowFrom: Integer;
    RowDelta: Integer;
    ColFrom: Integer;
    ColDelta: Integer;
  end;

  IXLSXStructuralEditParticipant = interface
    procedure ApplyStructuralEdit(Worksheet: TXLSXWorksheet;
      const Edit: TXLSXStructuralEdit);
  end;

  TXLSXStructuralEditRegistry = class
    procedure RegisterParticipant(
      const Participant: IXLSXStructuralEditParticipant);
    procedure UnregisterParticipant(
      const Participant: IXLSXStructuralEditParticipant);
    procedure Clear;
    property Count: Integer;
  end;

Edit fields

RowFromFirst one-based row affected, or zero when rows are unchanged
RowDeltaPositive inserted row count or negative deleted row count
ColFromFirst one-based column affected, or zero when columns are unchanged
ColDeltaPositive inserted column count or negative deleted column count

Participant rules

Example

type
  TMetadataUpdater = class(TInterfacedObject,
    IXLSXStructuralEditParticipant)
  public
    procedure ApplyStructuralEdit(Worksheet: TXLSXWorksheet;
      const Edit: TXLSXStructuralEdit);
  end;

Updater := TMetadataUpdater.Create;
Sheet.StructuralEditRegistry.RegisterParticipant(Updater);
Sheet.InsertRows(4, 2);

See also