TCustomRichViewEdit.InsertTextFromFile, InsertTextFromFileW

<< Click to display table of contents >>

TCustomRichViewEdit.InsertTextFromFile, InsertTextFromFileW

The methods load text file FileName and insert its content at the position of caret. InsertTextFromFile  inserts text from ANSI text files, InsertTextFromFileW inserts text from Unicode (UTF-16) text files.

function InsertTextFromFile(const FileName: TRVUnicodeString;

  CodePage: Cardinal=CP_ACP): Boolean;

function InsertTextFromFileW(const FileName: TRVUnicodeString):

  Boolean;

Inserted text has current text and current paragraph style.

A file may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

InsertTextFromFileW supports the Unicode byte order marks characters (if they are present, they must be the first character in file).

Methods type: editstyle editing-style method for insertion.

unicode Unicode note:

Internally, text is stored as Unicode. InsertTextFromFile converts ANSI to Unicode using CodePage.

 

Return value: "Was reading from from the file successful?"

 

See also methods:

InsertOEMTextFromFile;

InsertText, -A, -W.

See also methods of TRichView:

LoadText, LoadTextW.

See also properties:

CurParaStyleNo;

CurTextStyleNo.

See also properties of TRVStyle:

TextStyles;

ParaStyles;

SpacesInTab.

See also:

Saving and loading;

Inserting items at position of caret.