TCustomRichView.AddFmt

<< Click to display table of contents >>

TCustomRichView.AddFmt

Adds a formatted string assembled from a Pascal format string and an array arguments, using the StyleNo-th text style and the ParaNo-th paragraph style, to the end of document.

procedure AddFmt(const FormatStr: String; 

  const Args: array of const; StyleNo, ParaNo: Integer);

AddFmt(FormatStr, Args, StyleNo, ParaNo) is equivalent to AddNL(Format(FormatStr,Args), StyleNo, ParaNo).
(where Format is not a method of TRichView, but SysUtils.Format)

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

Parameters:

FormatStr – format string. See "Format function" in the Delphi help file for syntax. FormatStr must not contain CR, LF and TAB characters. To add several lines of text use AddTextNL.

Args – arguments for format string.

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 method adds 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].

 

Method type: viewerstyle viewer-style.

unicode Unicode note: the parameter of this method is:

▪Unicode string (UTF-16) for Delphi/C++Builder 2009 or newer,

▪ANSI string for older versions of Delphi/C++Builder.

▪Unicode string (UTF-8) in Lazarus

 

Example:

MyRichView.AddFmt('X=%d and Y=%d', [X,Y], 0, 0);

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:

▪AddNL;

▪AddTextNL;

▪Format;

▪FormatTail;

▪SetAddParagraphMode.

See also properties of TRVStyle:

▪TextStyles;

▪ParaStyles;

▪SpacesInTab.

See also:

▪Other methods for appending items.