loadTextFromFile

loadTextFromFile(fileName: String): Integer;

The loadTextFromFile method of the JadeTextEdit class dynamically loads the specified file into the text editor (for example, into a JADE workspace).

Use the fileName parameter to specify the fully qualified name of the text file that you want loaded into the text editor. This file name includes the full path of the JADE application if the file is not located in the default directory.

If the file cannot be located or it cannot be read, the loadTextFromFile method returns the appropriate exception code rather than raising exceptions to report errors (for example, 5003 - Requested file not found). If the file read operation was successful, this method returns zero (0).

The maximum size of a file that you can load into the control by using this method is the smaller of 50M bytes or a tenth of the physical memory.

An ANSI JADE system is limited to loading a File object of kind type Kind_ANSI.

A Unicode JADE system loads most kinds of text files. Non-ANSI files are filtered during UTF8 conversion and if an invalid Unicode sequence is detected, the load returns error 15645.

End-of-line conversion is performed, to force all end-of-line sequences to match the current value of the endOfLineMode property.

If the text files contains null characters, only the text preceding the first null character are loaded.

The code fragment in the following example shows the use of the loadTextFromFile method.

str := "c:\Temp\utf8.txt";
int := jteSource.loadTextFromFile(str);
if int > 0 then
    app.msgBox("Load failed", "Load Editor text", 0);
endif;