4D v14.3TEXT TO DOCUMENT |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
TEXT TO DOCUMENT
TEXT TO DOCUMENT
The TEXT TO DOCUMENT command lets you write the text directly to a disk file. In fileName, pass the name or pathname of the file to be written. If this file does not exist, it is created. When this file already exists on the disk, its prior contents are erased, except if it is already open, in which case, its contents are locked and an error is generated. In fileName, you can pass:
If you want the user to be able to indicate the name or location of the document, use the Open document or Create document commands, as well as the Document system variable. Note: By default, documents generated by this command do not have an extension. You must pass an extension in fileName. You can also use the SET DOCUMENT TYPE command. In text, pass the text to write to the disk. It can be a literal constant ("my text"), or a 4D text field or variable. In charSet, you pass the character set to be used to write the document. You can pass a string containing the standard set name (for example “ISO-8859-1” or “UTF-8”) or its MIBEnum ID (longint). For more information about the list of character sets supported by 4D, refer to the description of the CONVERT FROM TEXT command. If a Byte Order Mark (BOM) exists for the character set, 4D inserts it into the document. If you do not specify a character set, by default 4D uses the "UTF_8" character set and a BOM. In breakMode, you can pass a longint indicating the processing to apply to end-of-line characters before saving them in the file. You can pass one of the following constants, found in the "System Documents" theme:
By default, when you omit the breakMode parameter, line breaks are processed in native mode (1). Note: This command does not modify the OK variable. In case of failure, an error is generated that you can intercept using a method installed by the ON ERR CALL command. Here are some typical examples of using this command: TEXT TO DOCUMENT("myTest.txt";"This is a test") Example allowing the user to indicate the location of the file to create: $MyTextVar:="This is a test" |
PROPERTIES
Product: 4D
HISTORY
SEE ALSO
Document to text ARTICLE USAGE
4D Language Reference ( 4D v14 R3) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||