Skip to main content

cxExportPivotGridToFile(string,TcxCustomPivotGrid,Integer,Boolean,Boolean,string[],string,TObject,TEncoding) Method

Exports content of a pivot grid to a file in a specified format.

Declaration

procedure cxExportPivotGridToFile(AFileName: string; APivotGrid: TcxCustomPivotGrid; AExportType: Integer; AExpand: Boolean; AUseNativeFormat: Boolean; const ASeparators: array of string; const AFileExt: string; AHandler: TObject = nil; AEncoding: TEncoding = nil);

Parameters

Name Type Description
AFileName string

The full path to the resulting file. You can omit the file name extension because it is automatically updated from the AFileExt parameter value. The AExportType parameter value defines the target export format.

APivotGrid TcxCustomPivotGrid

The source pivot grid control.

AExportType Integer

Specifies the target export format. You can pass one of the following public constants as this parameter: cxExportToBinary, cxExportToCSV, cxExportToHtml, cxExportToXml, cxExportToText, cxExportToXlsx. These public constants are declared in the cxExport unit.

AExpand Boolean

If True, the procedure exports all rows, including the collapsed nested rows. If False, the procedure exports only visible rows.

AUseNativeFormat Boolean

If True, the procedure attempts to convert display text of cells into their underlying data format (that is, Currency, Date, Time, Numeric, etc.). The table below lists supported in-place editors and the corresponding data formats. If False, the procedure exports display text as string values. The AUseNativeFormat parameter is in effect only if you pass cxExportToExcel or cxExportToXlsx as the AExportType parameter.

ASeparators string

Specifies the value separator character as well as the prefix and postfix strings. The ASeparators parameter is in effect only if you pass cxExportToCSV or cxExportToText as the AExportType parameter.

AFileExt string

Specifies the file name extension of the resulting file. This parameter value always replaces the file name extension passed as a part of the AFileName parameter value.

AHandler TObject

Optional. Specifies a handler object that should implement the IcxExportBeforeSave and/or IcxExportProgress interfaces to allow you to perform specific actions before an export operation and track its progress. Refer to the following topic for detailed information on how to create and use handler objects: How to: Track Data Export Progress.

AEncoding TEncoding

Optional. Specifies the character encoding format of the resulting file. If nil (in Delphi) or nullptr (in C++Builder) is passed as the AEncoding parameter, the procedure uses the TEncoding.Default encoding. The AEncoding parameter is in effect only if you pass cxExportToText or cxExportToCSV as the AExportType parameter.

Remarks

Call the cxExportPivotGridToFile procedure to export content of a pivot grid control to a file in any supported format.

Example

Source Pivot Grid Example

The following code example exports content of an unbound pivot grid control to a file in XLSX format:

  cxExportPivotGridToFile('Payments.xlsx', UnboundPivotGrid, cxExportToXLSX, True, True, [], 'xlsx');

Exported Pivot Grid Data in XLSX Format

See Also