The ExportGrid4ToExcel method exports records from the AGrid control in MS Excel format. Note: ExportGrid4ToExcel is restricted to grids with a single level, i.e. it does not support exporting detail views. Detail views are ignored.
The AFileName parameter defines the name and the path of the output XLS file. Any extension specified in this parameter is replaced with ?xls?
The AExpand parameter indicates whether to export all records displayed in the grid including those hidden within collapsed groups. If this parameter value is False, only visible records are written to the file.
The ASaveAll parameter indicates whether to export selected or all records.
If the AUseNativeFormat parameter is True, when exporting currency, date and time fields, the format of corresponding Excel cells is set to Currency, Date and Time respectively. Otherwise, these fields are exported as simple text. Setting AUseNativeFormat to True prevents errors when you access these cells via MS Excel formulas and create charts.
ExpressQuantumGrid4 allows you to export data to a number of formats. Currently HTML, XML, MS Excel and text formats are supported.
The HTML and XML formats are more complex since they can reflect most of grid features, such as styles, grouping and master-detail relationships. The MS Excel format does not support master-details because of the rigid column arrangement. When exporting to text format, only the data and its arrangement is exported. As for the MS Excel format, text format does not support exporting detail views.
Four methods allow you to export data to these formats:
In addition to the cxExportGrid4Link unit, where these methods are declared, you should include the cxExport module into the uses statement.