Skip to main content

TdxCustomSpreadSheet.AddSheet(string,TdxSpreadSheetCustomViewClass) Method

Inserts a new sheet into a workbook.

Declaration

function AddSheet(const ACaption: string = ''; AViewClass: TdxSpreadSheetCustomViewClass = nil): TdxSpreadSheetCustomView;

Parameters

Name Type
ACaption string
AViewClass TdxSpreadSheetCustomViewClass

Returns

Type
TdxSpreadSheetCustomView

Remarks

Call this function to create a new worksheet within the workbook currently opened by the Spreadsheet control. The newly created worksheet immediately becomes active and available via the Sheets and VisibleSheets properties.

The optional ACaption parameter specifies the new worksheet’s name displayed by the respective tab. If this parameter is left unspecified, the Spreadsheet control automatically generates a name for the created sheet. By default, the automatically generated name consists of the 'Sheet' string followed by a number.

The optional AViewClass parameter allows you to specify the actual type of the worksheet created by the AddSheet function (a TdxSpreadSheetCustomView descendant). If this parameter is left unspecified, the Spreadsheet control creates a Table View worksheet.

An end-user can create a blank worksheet by clicking the new worksheet button on the caption bar or press the Shift+F11 key combination. The newly created worksheet has an automatically generated name.

The Active Worksheet Tab

As an additional option, you can provide the InsertSheet command to end-users by linking a custom UI element to a TdxSpreadSheetInsertSheet action object or using the Spreadsheet control’s automatic Toolbar or Ribbon UI generation functionality.

Note

The worksheet’s name stored in the TdxSpreadSheetCustomView.Caption property cannot exceed the number of characters specified by the dxSpreadSheetMaxCaptionLength global constant value.

See Also