Table of Contents

TTMSFNCDataGridExcelIO Class

Non-visual component that imports and exports DataGrid content to and from XLS/XLSX/CSV files using the FlexCel adapter library.

API unit family: TMSFNCDataGridExcelIO Inherits from: TTMSFNCCustomComponent

Syntax

TTMSFNCDataGridExcelIO = class(TTMSFNCCustomComponent)

Properties

Name Description
AutoResizeDataGrid When True, automatically resizes DataGrid columns and rows to match the imported XLS cell sizes.
DataGrid The DataGrid whose content is imported from or exported to the XLS file.
DataGridStartCol Zero-based column offset in the DataGrid at which import or export begins (default 1).
DataGridStartRow Zero-based row offset in the DataGrid at which import or export begins (default 1).
DateFormat FlexCel format string used to parse and write date values during import/export (e.g. ''dd/MM/yyyy'').
Options Import and export options such as cell formats, sizes, formulas, images, and overwrite behaviour.
Renderer Renderer instance used to measure and render DataGrid cells during export. Assigned automatically when DataGrid is set.
SheetNames Returns the worksheet name at the given zero-based index after a call to LoadSheetNames.
SheetNamesCount Returns the number of worksheet names populated by the last call to LoadSheetNames.
TimeFormat FlexCel format string used to parse and write time values during import/export (e.g. ''hh:mm:ss'').
UseUnicode When True, string values are written to the XLS file as Unicode strings.
Version Returns the FlexCel library version string; setting this property has no effect.
XlsStartCol 1-based column in the XLS worksheet at which reading or writing begins (default 1).
XlsStartRow 1-based row in the XLS worksheet at which reading or writing begins (default 1).
Zoom Zoom percentage (10–400) applied to the exported worksheet (default 100).
ZoomSaved When True, the current Zoom value is saved to and restored from the XLS worksheet.

Methods

Name Description
LoadSheetNames Populates SheetNames and SheetNamesCount by opening the file and reading all worksheet names without importing data.
XLSExport Exports the DataGrid content to the specified XLS/XLSX file, optionally targeting a named sheet at a given position.
XLSImport Imports the first sheet of the specified XLS/XLSX/CSV file into the DataGrid.

Events

Name Description
OnCellFormat Fired for each cell during import/export to allow the application to override the FlexCel cell format.
OnDateTimeFormat Fired for each cell during import to allow the application to override the date/time format string.
OnExportColumnFormat Fired for each column during export to allow the application to supply a custom column width or format.
OnGetCellFormula Fired for each cell during export to allow the application to supply a formula string instead of a literal value.
OnProgress Fired periodically during import or export to report progress (current row, total rows).

Used by