TXlsWorkbookEh class

AdminLess than 1 minute

TXlsWorkbookEh class

Workbook. TXlsMemFileEh contains one copy of a workbook of type TXlsWorkbookEh. The workbook contains a set of tables (TXlsWorksheetEh) and TXlsFileStylesEh styles. Styles describe the format of the data cells in the Worksheet. Each cell must reference one of the styles from the Styles list. When filling in data in the program code, you do not need to use the TXlsWorkbookEh.Styles property. The inner code of the TXlsMemFileEh class automatically creates styles and style references when the format changes in table cells. You can use TXlsMemFileEh.Workbook property to access TXlsWorkbookEh properties and methods.

The following TXlsWorkbookEh properties and methods are used to work with work pages (Worksheet):

function AddWorksheet(WorksheetName: string): TXlsWorksheetEh;

Add a new table (Worksheet) with the specified name.

function FindWorksheet(WorksheetName: string): TXlsWorksheetEh;

Find a table (Worksheet) by name.

procedure MoveWorksheet(FromIndex, ToIndex: Integer);

Move the Worksheet from the FromIndex position to the ToIndex position.

procedure RemoveWorksheet(WorksheetEh: TXlsWorksheetEh);

Delete Worksheet.

property Worksheets[WorksheetId: Variant]: TXlsWorksheetEh;

Get a ref to a table by name or by index. To get a value by name, pass the table name as a string to the WorksheetId parameter.

property WorksheetCount: Integer;

Get the number of tables in the Worksheets collection.

Here is an example of using the Workbook property.

xlsFile := TXlsMemFileEh.Create;
xlsFile.Workbook.Worksheets[0].Name := 'DBGrid';
xlsFile.Workbook.AddWorksheet('VertGrid');
Last update:
Contributors: dmitrybv