TAdvStringGrid

Example 59 : using TAdvGridWorkbook with TAdvGridExcelIO to load/save multi sheet XLS files

vcl grid

The new TAdvGridExcelIO component is TAdvGridWorkbook aware, making an almost codeless solution possible to load and save multisheet XLS files.

TAdvGridExcelIO has now 2 properties: AdvGridWorkbook : assign a TAdvGridWorkbook to this property if you want to use it with a workbook. AdvStringGrid : assign a TAdvStringGrid to this property if you want to use it with just one grid.

To load the default sheet from an XLS file in a workbook or grid, use:

AdvGridExcelIO.XLSImport(filename,1);

To load all sheets from an XLS file in a workbook, use:

AdvGridExcelIO.XLSImport(filename);

Similary, to export one sheet from TAdvStringGrid or TAdvGridWorkbook (the active sheet in this case) use:

AdvGridExcelIO.XLSExport(filename, sheetname);

To export all sheets of a TAdvGridWorkbook to an XLS file use:

AdvGridExcelIO.XLSExport(filename);


Delphi project & source files for downloading included in the main demos distribution for Delphi.