TCustomRichView.LoadFromStream, LoadFromStreamEx

<< Click to display table of contents >>

TCustomRichView.LoadFromStream, LoadFromStreamEx

The methods load a document from Stream, autodetecting its format (RVF/RTF/HTML/DocX/Markdown/text)

function LoadFromStream(Stream: TStream; IsTextUnicode: TRVYesNoAuto

  AllowMarkdown: Boolean = False; 

  const Path: TRVUnicodeString = ''): Boolean;

function LoadFromStreamEx(Stream: TStream

  IsTextUnicode: TRVYesNoAuto; AllowedFormats: TRVLoadFormats;
  out Unicode: Boolean; out LoadedFormat: TRVLoadFormat;
  const Path: TRVUnicodeString = ''): Boolean;

(introduced in version 10, modified in version 21)

These methods can detect both normal RTF, and RTF converted to Unicode (UTF-16) string.

HTML is detected by the presence of '<html' or '<head' within the leading 1024 characters.

Text or Markdown is loaded if the stream does not contain RVF, RTF, HTML or DocX.  The methods do not load text or Markdown if Stream contains characters having codes less than ord(' ').

Path is the base path for images that may be referred from a document.

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

rvynaNo not Unicode (i.e, not UTF-16);

rvynaYes Unicode (UTF-16);

rvynaAuto autodetecting ANSI/Unicode (a wrong detection is 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.

LoadFromStream: if AllowMarkdown = True, a Markdown is loaded; otherwise, a plain text is loaded.

LoadFromStreamEx: allowed formats are listed in AllowedFormats. If it contains both rvlfText and rvlfMarkdown, Markdown is loaded. The loaded format is returned in LoadedFormat. If the loaded text/markdown/HTML/RTF is stored as UTF-16, Unicode = True on exit.

Methods type: viewerstyle viewer-style.

Return value:

"Was reading successful?"


See also methods of TRichView:

LoadFromFile, LoadFromFileEx






LoadTextFromStream, LoadTextFromStreamW.