EXAMPLE 59
TAdvStringGrid
example 59 : using TAdvGridWorkbook with TAdvGridExcelIO to load/save multi sheet XLS files
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.
The project and source files have been written with Delphi 6,7. To use these files in other versions of Delphi, ignore any remarks when opening the form files and save the files. After this, compilation can be done. The error messages are due to properties included in the Delphi 6 form file, but not available in lower versions of Delphi.


ONLINE ORDERS
Subscribe to RSS Feed