Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxCustomSpreadSheet.Sheets Property

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

#Declaration

Delphi
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