loadFromFile

loadFromFile(fileName: String;
             replace:  Integer;
             format:   Integer): Integer;

The loadFromFile method of the JadeRichText class loads the contents of a file at the current position of the receiver (that is, at the insertion point in the control).

The loadFromFile method parameters are listed in the following table.

Parameter Description
fileName Existing file containing the file whose contents are to be read. If you do not specify a path, JADE looks in the current directory and raises an exception if the specified file is not in the directory or if it does not exist.
replace A JadeRichText class constant value that indicates where the text is loaded, as follows.
 
  • LoadFromFile_ReplaceAll, which replaces the entire contents of the receiver.

 
  • LoadFromFile_ReplaceSelection, which replaces only the selected text of the receiver.

format A JadeRichText class constant value that indicates the format of the loaded text, as follows.
 
  • LoadFromFile_PlainText, which is read as plain text.

 
  • LoadFromFile_UnicodeText, which is read as plain Unicode text.

 
  • LoadFromFile_RTF, which is read as rich text format text if the text starts with a valid RTF sequence (for example, "{\rtf ").

If the read operation of the file raised an exception, the loadFromFile method returns the appropriate JADE file handling error number (for example, 5030 - File is in use by another process). If the file read operation was successful, this method returns zero (0).