|Top Previous Next|
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: String; StyleNo, ParaNo: Integer;
AsSingleParagraph: Boolean; CodePage: Cardinal=CP_ACP):Boolean;
function LoadTextW(const FileName: String; StyleNo, ParaNo: Integer;
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).
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. It is used only if StyleNo points to a Unicode style; otherwise it is ignored.
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.
LoadText (text in the file must be ANSI):
▪If the StyleNo-th style is ANSI style, text from the file is loaded as it is.
▪If the StyleNo-th style is Unicode style, text from the file is converted to Unicode (conversion is performed using the CodePage parameter, or, of it's equal to CP_ACP, basing on the Charset of this style).
LoadTextW (text in the file must be Unicode):
▪If the StyleNo-th style is Unicode style, text from the file is added as it is..
▪If the StyleNo-th style is ANSI style, text from the file is converted to ANSI (conversion is performed basing on the Charset of this style).
If style templates are used, the component may automatically change text style indices of text items, to provide a consistency of text and paragraph style templates.
Return value:"Was loading successful?"
See also methods:
See also methods of TRichViewEdit:
See also properties of TRVStyle:
TRichView © trichview.com