rvico TRichView Reference | TRichView

TCustomRichView.AddFmt

Top  Previous  Next

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 methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

 

Method type: viewerstyle viewer-style.

unicode Unicode note: the parameter of this method is Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for older versions of Delphi/C++Builder.

Example:

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

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.


TRichView © trichview.com