vcl-171151-expressquantumgrid-concepts-vcl-data-grid-data-export.md
The TcxGrid control ships with a series of global data export methods declared in the cxGridExportLink unit. You can call these methods to export grid content to a file or stream in CSV, HTML, TXT, XLS, XLSX, and XML formats. To track the export progress and perform additional actions before an export operation, you can pass a handler object as the optional AHandler parameter available for every data export method. The handler object should implement the IcxExportProgress and IcxExportBeforeSave interfaces declared in the cxExport unit. Refer to the following topic for detailed information on handler objects and a code example: How to: Track Data Export Progress.
Plain text-based formats include CSV and TXT. Use these lean formats if you need to keep the exported data size to a minimum. Remember that plain text-based formats cannot preserve data layouts and appearance settings as customized by you or your users.
In comma-separated values format, every plain text line of values separated by commas corresponds to a data record. You can pass another character as the optional ASeparator parameter to use it instead of a comma.
ExportGridToCSVExports content of a data grid control to a file in CSV (comma-separated values) format.ExportGridToCSVStreamExports content of a data grid control to a stream in CSV (comma-separated values) format.ExportGridDataToCSVExports cell content of a data grid to a CSV (comma-separated values) file.ExportGridDataToCSVStreamExports cell content of a data grid to a stream in CSV (comma-separated values) format.
Like CSV, the plain text format stores exported data as plain text without formatting, style, or print layout information. Compared to CSV, exported TXT files are more human-readable. You can use the ASeparator, ABeginString, and AEndString parameters of the export methods to delimit cell values in the resulting file or stream.
ExportGridToTextExports content of a data grid control to a file in plain text format.ExportGridToTextStreamExports content of a data grid control to a stream in plain text format.ExportGridDataToTextExports cell content of a data grid to a file in plain text format.ExportGridDataToTextStreamExports cell content of a data grid to a stream in plain text format.
Markup language formats include HTML and XML. Unlike plain text, these formats allow you to export the original data layout as is and take style and look & feel settings into account. Export methods in this category create image files to display cell images as inline images in the output file or stream. Use the cxExportGraphicClass global constant to change the image container class for export image generation.
Export grid content in HyperText Markup Language format if you need to display data in a web browser.
ExportGridToHTMLExports content of a data grid control to a file in HTML format.ExportGridToHTMLStreamExports content of a data grid control to a stream in HTML format.ExportGridDataToHTMLExports cell content of a data grid to a file in HTML format.ExportGridDataToHTMLStreamExports cell content of a data grid to a stream in HTML format.
ExportGridToXMLExports content of a data grid control to a file in XML format.ExportGridToXMLStreamExports content of a data grid control to a stream in XML format.ExportGridDataToXMLExports cell content of a data grid to a file in XML format.ExportGridToXMLStreamExports content of a data grid control to a stream in XML format.
Spreadsheet document formats include Office Open XML (XLSX) and Microsoft Excel® binary spreadsheet (XLS) formats. Like markup language formats, they allow you to export grid content as is, including the data layout, style, and look & feel settings.
A compressed XML-based spreadsheet document format used by Microsoft Excel® 2007 and later versions.
ExportGridToXLSXExports the currently active root level’s content to a file in Office Open XML spreadsheet format (XLSX).ExportGridToXLSXStreamExports content of a data grid control to a stream in Office Open XML spreadsheet format (XLSX).ExportGridDataToXLSXExports cell content of a data grid to a file in Office Open XML spreadsheet format (XLSX).ExportGridDataToXLSXStreamExports cell content of a data grid to a stream in Office Open XML spreadsheet format (XLSX).
The spreadsheet document binary format used by Microsoft Excel® 97-2003.
ExportGridToExcelExports content of a data grid control to a file in Microsoft Excel® binary format (XLS).ExportGridToExcelStreamExports content of a data grid control to a stream in Microsoft Excel® binary Format (XLS).ExportGridDataToExcelExports cell content of a data grid to a file in Microsoft Excel® binary format (XLS).ExportGridDataToExcelStreamExports cell content of a data grid to a stream in Microsoft Excel® binary format (XLS).
Note
Make sure you added the cxGridExportLink and cxExport units to your project’s uses clause to be able to call these data export methods.
See Also