Skip to main content

TdxCustomSpreadSheet.Sheets Property

Provides zero-based indexed access to individual sheets within the currently active spreadsheet document.

Declaration

property Sheets[Index: Integer]: TdxSpreadSheetCustomView read;

Property Value

Type
TdxSpreadSheetCustomView

Remarks

Use this property to access a generic worksheet object by its index passed as the Index parameter. Unlike VisibleSheets, the Sheets property provides access to all sheets within the current spreadsheet document. To identify the number of worksheets, use the SheetCount property.

To access the currently active generic worksheet object, you can either pass the ActiveSheetIndex property value as the Index parameter of the Sheets property or use the ActiveSheet property instead.

The following code example changes captions of all worksheets.

var
  I: Integer;
begin
  for I := 0 to dxSpreadSheet1.SheetCount - 1 do
    dxSpreadSheet1.Sheets[I].Caption := 'Page ' + IntToStr(I);
end;

Note

Since the Sheets property provides access only to generic worksheet objects, you may need to cast them to the actual worksheet types (TdxSpreadSheetTableView class, for instance) in order to use their type-specific settings. Refer to the Understanding Views topic for additional information.

See Also