rvico TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertTextFromFile, InsertTextFromFileW

Top  Previous  Next

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

function InsertTextFromFile(const FileName: String; CodePage: Cardinal=CP_ACP): Boolean;

function InsertTextFromFileW(const FileName: String): 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:

InsertTextFromFile: if the current text style is Unicode, text will be converted to Unicode (conversion is performed using the CodePage parameter, or, of it's equal to CP_ACP, basing on the charset of the current text style). Note that if the current text style is not a Unicode style, CodePage is ignored.

InsertTextFromFileW: if the current text style is ANSI, text will be converted to ANSI (conversion is based on the charset of the current text style).

 

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 in position of caret.


TRichView © trichview.com