TCustomRichView.AddNL, AddNLA, AddNLW, Add

<< Click to display table of contents >>

TCustomRichView.AddNL, AddNLA, AddNLW, Add

These methods add one text item with the StyleNo-th text style and the ParaNo-th paragraph style, with the specified Tag to the end of document.

procedure AddNL(const s: String; StyleNo: Integer; ParaNo: Integer = -1;

  const Tag: TRVTag = RVEMPTYTAG);
procedure AddNLW(const s: TRVUnicodeString; StyleNo, ParaNo: Integer;

  const Tag: TRVTag = RVEMPTYTAG);
procedure AddNLA(const s: TRVAnsiString; StyleNo, ParaNo: Integer;
  const Tag: TRVTag = RVEMPTYTAG);

procedure Add(const s: String; StyleNo:Integer);

(introduced in version 1.3 and 1.4; changed in version 18)


s is a text string to add.  It must not contain CR, LF, TAB, FF characters (#13, #10, #9, #12). To add several lines of text use AddTextNL.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

If ParaNo=-1, the methods add an item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph using attributes defined in Style.ParaStyles[ParaNo].

Tag tag of this text item.


Add provides subsets of functionality of AddNL: Add(...) is equivalent to AddNL..., -1, '').

Note: TRichView allows empty text strings only in empty paragraphs (may be with list makers). See Valid documents.

unicode Unicode notes:

Internally, text is stored as Unicode. AddNLA converts ANSI to Unicode. A code page for conversion is calculated basing on Style.TextStyles[StyleNo]. Charset. If it is equal to DEFAULT_CHARSET, and for non-text items, Style.DefCodePage is used.

AddNL works:

like AddNLA, in Delphi 2007 and older

like AddNLW, in Delphi 2009 and newer

with UTF-8 string, in Lazarus

Methods type: viewerstyle viewer-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.

See also methods:





See also methods of TRichViewEdit:

InsertStringTag, InsertStringATag, InsertStringWTag.

See also properties of TRVStyle:



See also:

Other methods for appending items;

Unicode in RichView.

Related deprecated methods:

procedure AddNLTag(const s: String; StyleNo, ParaNo: Integer; const Tag: TRVTag);
procedure AddTag(const s: String; StyleNo: Integer; const Tag: TRVTag);
procedure AddNLATag(const s: TRVAnsiString; StyleNo, ParaNo: Integer; const Tag: TRVTag);
procedure AddNLWTag(const s: TRVUnicodeString; StyleNo, ParaNo: Integer; const Tag: TRVTag)