The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: TDataTable
Declaration: [1] function ExportAsASC (FName: string; Precision: integer): string;
[2] function ExportAsASC (OutStream: TStream; Precision: integer): string;
[3] function ExportAsASC (const OutFile: TextFile; Precision: integer): string;
[4] function ExportAsASC (FName: string; Precision: integer; CustData: TStr2DArray): string;

The method ExportAsASC writes the contents of the data table along with all additional information (headers, etc.) to a readable ASCII text. The format of the text is the same as used by the method ImportASC.

Version [1] of ExportAsASC stores the data as a text file. The parameter FName specifies the filename (default extension ASC). Version [2] writes the data into the stream OutStream, and version [3] writes the data into the open text file OutFile. The method returns an error message string if any problem occurs during opening the file (e.g. 'file access denied' for read-only files). Version [4] additionally exports user-defined data which are stored in the parameter CustData. CustData has to be a two-column string array containing the name of a particular user item in the first column and its value in the second column. CustData can have any number of rows.

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.

Hint: For an example of how to process custom data (version [4]) please see the description of TMatrix.ExportAsASC.

Example: This method is used in the following example program (see for downloading the code): ntabedit

Last Update: 2020-Aug-12