ExportToXLSX

Class: TEgFireGrid

procedure ExportToXLSX(const AFileName: string; AMemoCharLimit: Integer = 0;
  ASelectedRowsOnly: Boolean = False);

Writes the grid’s data to an Excel workbook (.xlsx) named AFileName, with no third-party library, on Windows and Android.

What is written:

AMemoCharLimit: 0 (the default) writes a memo’s whole text (Excel’s own limit of 32767 characters per cell still applies), a positive value cuts it to that many characters, -1 leaves the memo columns out. More than 1,000,000 rows are split over several sheets, each with its title row.

An edit still open is ended and its value written first. The dataset is walked with its controls disabled, and its current record is restored afterwards. OnExportProgress reports the progress.

It raises an exception when there is no open dataset, when the row source does not support export, when no column can be exported, or when the file cannot be written. On Android the file must be in a folder the application can write to, for example TPath.GetDocumentsPath.

Grid1.ExportToXLSX(TPath.Combine(TPath.GetDocumentsPath, 'Products.xlsx'));

See Example 8.

See Also

(C) 2026 Easygate, Lda