Portable Dataset export
The existing adapter on a headless target
TDataToXLS uses its existing Dataset, Workbook and XLSX bridge APIs under the qualified Delphi macOS ARM64 command-line profile
Use the recorded Classic Workbook compiler and native-linker profile with LX_PORTABLE_CORE; this adapter installs no database driver and creates no desktop control
- Create TDataToXLS, assign an active Dataset and keep ReadDetailTables false within the qualified ordinary profile
- Configure the worksheet, header/detail fonts and explicit colours before calling ExportDataset
- Use SaveAs with an .xlsx or .xls file name, check its existing result code and free the exporter when finished
Font descriptions and colour aliases
| Type | Windows | Non-Windows |
|---|---|---|
| TXLSDataExportFont | An alias of the real Graphics.TFont, retaining published property class identity and normal Assign behaviour | A TPersistent description with Name, an integer point Size, Style, Color, CharSet and same-class Assign |
| TXLSDataExportColor | An alias of Graphics.TColor, retaining the existing system-colour resolver | A signed 32-bit Integer accepting explicit COLORREF RGB values for output |
The non-Windows description has no Handle, Canvas, font loading or native text measurement; assigning a description records the font metadata for the workbook
Use xlsDataExportBold, xlsDataExportItalic, xlsDataExportUnderline and xlsDataExportStrikeOut in Style sets for code shared between platforms; Windows maps these constants onto its existing font styles. On non-Windows targets the set type is TXLSDataExportFontStyles, a set of TXLSDataExportFontStyle (xlsdefsBold, xlsdefsItalic, xlsdefsUnderline, xlsdefsStrikeOut); Windows code sees the ordinary Graphics.TFontStyles type instead
Explicit COLORREF values use 0..$FFFFFF with red in the low byte, so $000000FF represents red; xlsDataExportNoColor retains the existing omit-colour sentinel where the property supports it
Non-Windows export refuses system colours and other non-RGB values instead of guessing a desktop theme; existing examples using clRed, clNone or Graphics.TFont remain Windows examples
Column widths and Dataset state
SetColumnsWidth copies numeric Field.DisplayWidth metadata into the stored column width; it does not run AutoFit or measure text, and needs no substitute for portable font metrics
The qualified source is an active, bidirectional, bookmark-capable Dataset in browse state; the exporter restores its source position and balances its DisableControls/EnableControls pair after success, after an owned BeforeValue error and after Abort
An export callback can leave a partially filled Workbook when it stops the operation; source-state restoration provides neither whole-Workbook rollback nor a rollback of external callback effects
Qualified values and platform boundaries
Actual final-source Windows and macOS controls cover Unicode strings, bounded Int32 values, finite floating-point values, a null integer and existing Boolean display text, using an owned Dataset without any database client library
Boolean fields keep the existing Field.Text behaviour rather than becoming typed Boolean cells; the existing Delphi ftLargeInt path still uses AsInteger, so arbitrary Int64 fidelity is outside this qualification
The outputs include real XLSX and BIFF files; XLSX is reopened through the public workbook API, whilst independent XML and BIFF decoding checks values, font colours, fill colours and numeric column widths
Actual final-source acceptance passes 35 Windows and 36 macOS checks, with 142 independent XML checks and 40 BIFF cell comparisons spanning both platforms
Grouping, nested detail datasets, edit-state or unidirectional datasets, arbitrary custom fields, BCD/decimal precision, date/time variants and blobs demand separate qualification
The font description also removes the Graphics dependency from non-Windows FPC source branches, but this result delivers no executed FPC or Linux Dataset profile, DBGrid adapter, desktop-service implementation or general SDK guarantee