Previous Topic

Next Topic

SaveToFile - Memory Table Method

method SaveToFile(Filename: String, Delimiter: Variant, HasHeader: Boolean, Quoted: Boolean[, RecordTerminator: Variant])

SaveToFile method saves a Memory Table to a delimited file. If a number is used as the Delimiter, it specifies the file format. If a character is used as the Delimiter, it defines the delimiter character.

For example:

   MemTable.SaveToFile(FileName: String, Delimiter: Number of String(1), HasHeader: Boolean, Quoted: Boolean[, RecordTerminator: Variant, FileType: Integer])

SaveToFile method syntax has these named arguments:

Parameter

Description

File Name

Required. Name of the delimited file to save to.

Delimiter

Required. The delimiter character or format number.

If a number is used, the format is defined. The valid number values are:

0 = CSV, no headers
1 = CSV, with headers
2 = Tab delimited, no headers
3 = Tab delimited, with headers

If a character is used, the character will be the delimiter character in the file, and the following fields are regarded.

Has Header

Required when the Delimiter is a character, ignored when the Delimiter is a number.

When True, a header line will be included. Defaults to False.

Quoted

Required when the Delimiter is a character, ignored when the Delimiter is a number.

When True, writes string values in quotes. Defaults to False.

RecordTerminator

Optional. The character to signify the end of the record.

File Type

Optional. Integer.
0 - ANSI
1 - UTF16_LE
2 - UTF16_BE
3 - UTF8
4 - UTF8BOM

If this parameter is not specified, the default type is ANSI.


For Example:

  MemTable.SaveToFile("c:\tmp\Test1.csv", 1)

  MemTable.SaveToFile("c:\tmp\Test1.csv", "|", True, True)

  MemTable.SaveToFile("c:\tmp\Test1.csv", chr(124), True, True)

See also the StringList Object SaveToFile method.

See Also

Memory Tables

Book Contents

Book Index