HotXLS Docs

AddBefore method

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

Syntax

function AddBefore(Index: Integer): TXLSWorksheet;
function AddBefore(Name: WideString): TXLSWorksheet;
function AddBefore(Worksheet: TXLSWorksheet): TXLSWorksheet;
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 TXLSWorksheet. 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: TXLSWorksheet;
begin
  Worksheet := Workbook.Sheets.AddBefore('Sheet1');
  Worksheet.Name := 'Before Sheet1';
end;
This example creates new Worksheet before second Worksheet

Workbook.Sheets.AddBefore(2);