HotXLS Delphi Excel Read Write Library / Component Developers Guide loslab Inc.

AfterNewSheet event

Occurs after the new Worksheet is added into the Workbook.

Description

You can use this event to set any additional options for created Worksheet.

Syntax

TOnDBGridCreateWorksheet = procedure(Sender: TObject; Worksheet: IXLSWorksheet) of object;
Sender TObject. Specifies the TGridToXLS component that triggered the event.
Worksheet IXLSWorksheet which represents a new Worksheet

Example

This example sets the PageSetup options for created Worksheet

procedure TForm1.GridToXLS1AfterNewSheet(Sender: TObject;
  Worksheet: IXLSWorksheet);
begin
  Worksheet.PageSetup.CenterHeader := 'Monthly report';
end;
Copyright©2007-2019 loslab.com