Icon ExportTable Method

procedure ExportTable(const ExportToFile: String; Delimiter:
      Char; WriteHeaders: Boolean=False; FieldsToExport: TStrings=nil;
      const DateFormat: String=ANSI_DATE_FORMAT; const TimeFormat:
      String=ANSI_TIME_FORMAT; DecSeparator:
      Char=ANSI_DECIMAL_SEPARATOR)

Usage

Call the ExportTable method to export data from the dataset into a delimited text file. The dataset may be open or closed when executing this method. If the dataset is open, then this method will respect any active filters or ranges on the dataset when copying the data to the delimited text file.

The FileToExport parameter indicates the name (including path) of the delimited text file to create when exporting the dataset contents.

The Delimiter parameter indicates the char to be used as the delimiter in the text file being created during the export.

The WriteHeaders parameter indicates whether to write the field names being exported to the first line of the text file being created during the export.

The FieldsToExport parameter indicates the names of the fields that should be populated with data from the dataset when exporting. This is useful for situations where the structure of the outgoing data needs to be different from that of the source dataset.

The DateFormat parameter indicates the date formatting to be used for any date or timestamp (date and time) fields in the exported text file. The rules for the date format specification are the same as with Delphi, Kylix, and C++Builder date formats. The only restriction is that you must include a date separator between the year (y), month (m), and day (d) placeholders. When exporting timestamp fields the formatting is assumed to be DateFormat, space character, and then TimeFormat. All formatting is case-insensitive and the default date format is "yyyy-mm-dd".

The TimeFormat parameter indicates the time formatting to be used for any time or timestamp (date and time) fields in the exported text file. The rules for the time format specification are the same as with Delphi, Kylix, and C++Builder time formats. The only restriction is that you must include a time separator between the hours (h), minutes (m), and seconds (s) placeholders. Also, any milliseconds formatting must use a period "." as the separator between the seconds and the milliseconds placeholders. Finally, when specifying the "ampm" switch for 12-hour clock format, do not use a forward slash between the "am" and "pm" placeholders. When exporting timestamp fields the formatting is assumed to be DateFormat, space character, and then TimeFormat. All formatting is case-insensitive and the default time format is "hh:mm:ss.zzz ampm".

The DecSeparator parameter indicates the decimal separator to be used for any number fields (Float or BCD) in the exported text file. DBISAM does not support the use of thousands separators in exported number field text data, only decimal separators. The default decimal separator is ".".
Image