vcl-cxexportpivotgridlink-dot-cxexportpivotgriddatatoexcel-x28-a84f3394-x29.md
Exports unformatted data from a pivot grid to a file in XLS or XLSX format.
procedure cxExportPivotGridDataToExcel(const AFileName: string; APivotGrid: TcxCustomPivotGrid; AHandler: TObject = nil; AAutoBestFit: Boolean = True; AHighlightTotals: Boolean = True; ACellBorders: Boolean = True; AFieldHeaders: Boolean = False);
| Name | Type | Description |
|---|---|---|
| AFileName | string |
The full path to the resulting XLSX or XLS file. The specified file name extension determines the target data export format – Office Open XML (XLSX) or Microsoft Excel® binary format (XLS).
| | APivotGrid | TcxCustomPivotGrid |
The source pivot grid control.
| | AHandler | TObject |
Optional. Specifies a handler object that should implement the IcxExportBeforeSave and/or IcxExportProgress interfaces to allow you to perform specific actions before the beginning of an export operation and track its progress.
Tip
Refer to the following topic for detailed information on how to create and use handler objects:
How to: Track Data Export Progress
| | AAutoBestFit | Boolean |
Optional. If True, the export procedure automatically expands cells in the resulting spreadsheet document to fit the original values. If False, spreadsheet cells have a default width.
| | AHighlightTotals | Boolean |
Optional. If True, the export procedure highlights total and subtotal values in the resulting spreadsheet document. If False, totals and subtotals have the same appearance as data cells.
| | ACellBorders | Boolean |
Optional. If True, all cell borders in the resulting spreadsheet document are visible. If False, only frozen pane borders are visible.
| | AFieldHeaders | Boolean |
Optional. If True, the procedure exports field headers in addition to exported data. If False, field headers are ignored.
|
Call the cxExportPivotGridDataToExcel procedure to export pivot grid data in XLS or XLSX format. Unlike the cxExportPivotGridToExcel and cxExportPivotGridToXLSX procedures, cxExportPivotGridDataToExcel exports only data in a simplified layout, without style information. The resulting file includes outlined groups and frozen panes to simplify data browsing and analysis in the Spreadsheet control or a third-party spreadsheet application.
The following code example exports pivot grid data to a file in XLSX format:
uses cxExportPivotGridLink;
// ...
cxExportPivotGridDataToExcel('Payments.xlsx', UnboundPivotGrid);
#include "cxExportPivotGridLink.hpp"
// ...
cxExportPivotGridDataToExcel("Payments.xlsx", UnboundPivotGrid);
See Also