Skip to main content

cxExportPivotGridDataToExcel(string,TcxCustomPivotGrid,TObject,Boolean,Boolean,Boolean,Boolean) Method

Exports unformatted data from a pivot grid to a file in XLS or XLSX format.

Declaration

procedure cxExportPivotGridDataToExcel(const AFileName: string; APivotGrid: TcxCustomPivotGrid; AHandler: TObject = nil; AAutoBestFit: Boolean = True; AHighlightTotals: Boolean = True; ACellBorders: Boolean = True; AFieldHeaders: Boolean = False);

Parameters

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.

Remarks

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.

Code Example

VCL Pivot Grid: A Source Pivot Grid Example

The following code example exports pivot grid data to a file in XLSX format:

uses cxExportPivotGridLink;
// ...
  cxExportPivotGridDataToExcel('Payments.xlsx', UnboundPivotGrid);

VCL Pivot Grid: Exported Pivot Grid Data in XLSX Format

See Also