TCustomRichView.SetItemText, SetItemTextA, SetItemTextW

<< Click to display table of contents >>

TCustomRichView.SetItemText, SetItemTextA, SetItemTextW

Assign text of text item or name of non-text item.

procedure SetItemText(ItemNo: Integer; const s: String);

procedure SetItemTextA(ItemNo: Integer; const s: TRVAnsiString);

procedure SetItemTextW(ItemNo: Integer; const s: TRVUnicodeString);

(Introduced in version 1.3, 1.7)


ItemNo – index of the item. Items are indexed from 0 to ItemCount-1, GetItemStyle returns type of item. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemText*.

s – text assigned to the item. For text items, this is a visible text. For non-text item, this is a string value associated with the item (not displayed). S must not contain line break (CR and LF) characters. For text items, it must not contain CR, LF, TAB, FF characters (#13, #10, #9, #12).

unicode Unicode notes:

Internally, text is stored as Unicode. SetItemTextA converts ANSI to Unicode. For a text item, a code page for conversion is calculated basing on the its Charset. If it is equal to DEFAULT_CHARSET, and for non-text items, Style.DefCodePage is used.

SetItemText works:

like SetItemTextA, in Delphi 2007 and older

like SetItemTextW, in Delphi 2009 and newer

with UTF-8 string, in Lazarus


Methods type: viewerstyle viewer-style. Reformatting and repainting are required only for text items.


See also methods:

GetItemText -W -A;


See also methods of TCustomRichViewEdit:

SetItemTextEd -A -W;

SetCurrentItemText -A -W.

See also:

Modifying RichView Items;

Unicode in RichView.