TCustomRichView.LoadFromStream

<< Click to display table of contents >>

TCustomRichView.LoadFromStream

Loads document from Stream, autodetecting its format (RVF/RTF/DocX/Markdown/text)

type

  TRVYesNoAuto = ( rvynaNo, rvynaYes, rvynaAuto );

function LoadFromStream(Stream: TStream; IsTextUnicode: TRVYesNoAuto;

  AllowMarkdown: Boolean = False): Boolean;

(introduced in version 10)

This method can detect both normal RTF, and RTF converted to Unicode string.

Text or Markdown is loaded if the stream does not contain RVF, RTF or DocX. If AllowMarkdown = True, a Markdown is loaded; otherwise, a plain text is loaded.

The method does not load a text or a Markdown if it contains characters having codes less than ord(' ').

IsTextUnicode specifies whether the text is Unicode (UTF-16):

rvynaNo not Unicode;

rvynaYes Unicode;

rvynaAuto autodetecting ANSI/Unicode (a wrong detection is very possible).

If Unicode is specified or detected, a text or a Markdown is loaded using UTF-16 encoding.

If Unicode is not specified or detected, a text is loaded using the system ANSI code page, a Markdown is loaded using UTF-8 encoding.

Method type: viewerstyle viewer-style.

Return value:

"Was reading successful?"

 

See also methods of TRichView:

LoadRVFFromStream;

LoadRTFFromStream;

LoadDocXFromStream;

LoadMarkdownFromStream;

LoadTextFromStream, LoadTextFromStreamW.