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

AddBefore method

Creates a new Worksheet before specified Worksheet. The new Worksheet becomes the active sheet.

Syntax

function AddBefore(Index: Integer): IXLSWorksheet;
function AddBefore(Name: WideString): IXLSWorksheet;
function AddBefore(Worksheet: IXLSWorksheet): IXLSWorksheet;
Index Integer. An index of Worksheet that specifies the sheet before which the new sheet is added.
Name WideString. A name of Worksheet that specifies the sheet before which the new sheet is added.
Worksheet IXLSWorksheet. An object that specifies the sheet before which the new sheet is added.

Example

This example creates new Worksheet before the sheet with name 'Sheet1'.

Var Worksheet: IXLSWorksheet;
begin
  Worksheet := Workbook.Sheets.AddBefore('Sheet1');
  Worksheet.Name := 'Before Sheet1';
end;
This example creates new Worksheet before second Worksheet.

Workbook.Sheets.AddBefore(2);
Copyright©2007-2019 loslab.com