HotXLS Docs

TXLSXSheets class

TXLSXSheets class for HotXLS components

Syntax

TXLSXSheets = class;
    

Key members

Count, ItemsNumber of sheets, and 1-based indexed access to each TXLSXWorksheet (default array property)
ActiveIndex0-based index of the sheet Excel activates on open; -1 when none is set yet. Note this is 0-based whilst IndexByName/Items/Duplicate are 1-based — subtract 1 when combining them
AddAppends a new sheet, optionally with a name; overloads take no name or a WideString name
IndexByName, SheetByName, TryGetSheetByNameLook up a sheet by name; SheetByName returns nil and TryGetSheetByName returns False when not found
DeleteByNameRemoves a sheet by name; returns False when no sheet had that name
DuplicateCopies a sheet (cells, merges, sizing, freeze panes, view, protection, page setup, tab colour) within the same workbook; charts/images/tables/validations are not copied — see TXLSXWorksheet.CopyFrom
ClearRemoves every sheet from the collection

Example

This example adds a sheet, then finds and activates it by name (IndexByName is 1-based, ActiveIndex is 0-based)

Workbook.Sheets.Add('Summary');
Workbook.Sheets.ActiveIndex := Workbook.Sheets.IndexByName('Summary') - 1;

See also

TXLSXWorkbook class