<< Click to display table of contents >> TCustomRichView.LoadText, LoadTextW |
Append the content of the text file FileName to the document. LoadText loads text from ANSI text files, LoadTextW loads text from Unicode (UTF-16) text files.
function LoadText(const FileName: TRVUnicodeString;
StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean;
CodePage: Cardinal=CP_ACP):Boolean;
function LoadTextW(const FileName: TRVUnicodeString;
StyleNo, ParaNo: Integer;
DefAsSingleParagraph: Boolean):Boolean;
(changed in version 18)
Despite their names, these methods do not clear the existing document before loading. To replace the current document with the content of this file, call Clear method before loading (and may be DeleteUnusedStyles after Clear).
Parameters
StyleNo – an index of text style which will be used for new text. It defines font attributes for the added text.
ParaNo – an index of paragraph style which will be used for new text. It defines paragraph attributes for the added text.
AsSingleParagraph (and DefAsSingleParagraph):
▪False – the methods use the current add-paragraph-mode (see SetAddParagraphMode);
▪True – the methods add all text as a single paragraph (add the first new item in the current add-paragraph-mode, set add-paragraph-mode to False, add the rest of text, restore the add-paragraph-mode). DefAsSingleParagraph only affects processing CR and LF characters. WideChar($2029) ("paragraph separator") always initiates a new paragraph. WideChar($2028) ("line separator") always initiates a new line.
CodePage – a code page for converting from ANSI to Unicode.
LoadTextW supports the Unicode byte order marks characters (if they are present, they must be the first characters in the file).
Methods type: viewer-style.
If style templates are used, the component may automatically change text style indexes of text items, to provide a consistency of text and paragraph style templates.
Return value:"Was loading successful?"
See also methods:
▪LoadTextFromStream, LoadTextFromStreamW;
▪Format;
See also methods of TRichViewEdit:
▪InsertTextFromFile, InsertTextFromFileW.
See also properties of TRVStyle:
See also: