Declaration: TDataTable.ExportAsASCFile (FName: string; Precision: integer): integer;
The method ExportAsASCFile writes the contents of the data table along with all additional information (headers, etc.) to a readable ASCII text file FName. The format of the text is the same as used by the method ImportASCFile. The parameter Precision specifies the number of decimal places to be used in the text file. Note that the numeric values of a table will be altered if the precision for exporting is too low.

The method returns the following error codes:

 0 ... everything is OK
-1 ... a problem occurred during opening the file (e.g. 'file access denied' for read-only files)

Example: The following code snippet creates a small data table, fills it with a constant value of 8.762813. The first column is renamed to 'FC', the second row is renamed to 'SR', all other columns and rows keep their default names. The exported ASC file is shown below.
  MATNCOL = 3;
  MATNROW = 6;
  row      : integer;
  DT       : TDataTable;
DT := TDataTable.Create(nil);
DT.Fill (0,0,0,0,8.762813);
DT.ColName[1] := 'FC';
DT.RowName[2] := 'SR';
DT.Comment := 'my special comment';
DT.ExportAsASCFile('c:\temp\testexpo.asc', PRECISION);
The generated ASC file looks like this (see the ASC format specification for details):
my special comment
3  ;nr. of columns
6  ;nr. of rows
TRUE TRUE TRUE FALSE  ;row attributes, column names, row names, nominal variables
FC  C-2  C-3
0  R-1    8.763    8.763    8.763
0  SR     8.763    8.763    8.763
0  R-3    8.763    8.763    8.763
0  R-4    8.763    8.763    8.763
0  R-5    8.763    8.763    8.763
0  R-6    8.763    8.763    8.763