rvico TRichView Reference | TRichView

TCustomRichView.SetItemText, SetItemTextA, SetItemTextW

Top  Previous  Next

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)

Parameters:

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:

SetItemTextA sets text from ANSI string:

If the item is a non-text item or a text item of ANSI style, the text is assigned as it is.

If the item is a Unicode text item, the function converts s to Unicode (conversion is based on Charset of the item style).

SetItemTextW sets text from Unicode string:

If the item is a Unicode text item, the text is assigned as it is.

If the item is a non-text item or a text item of ANSI style, the function converts s to ANSI (conversion is based on Charset of the item style, or on RVStyle.DefCodePage for non-text items).

SetItemText works like SetItemTextW in Delphi/C++Builder 2009 or newer, and like SetItemTextA in the older versions of Delphi/C++Builder.

(There is one more version of this method, SetItemTextR, working with TRVRawByteString. In this method, the text is assigned as it is, without conversion. Be careful, incorrect text assignment may damage document).

 

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

 

See also methods:

GetItemText -W -A;

Format.

See also methods of TCustomRichViewEdit:

SetItemTextEd -A -W;

SetCurrentItemText -A -W.

See also:

Modifying RichView Items;

Unicode in RichView.


TRichView © trichview.com