Insert text at the beginning of a TRichView
-
- Posts: 4
- Joined: Sat Sep 21, 2019 1:35 pm
Insert text at the beginning of a TRichView
Please tell me how to insert text at the beginning of a TRichView
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Insert text at the beginning of a TRichView
While TRichViewEdit has methods for insertion at the caret position, TRichView has only methods for adding to the end. The only exception is InsertRVFFromStream.
However, you can use the function from RVInsertItems.pas:
To insert at the beginning, the parameter ItemNo must be 0, like:
Please be careful when using this method, it may create an incorrect document when used incorrectly, see https://www.trichview.com/help/valid_documents.html
PS: this unit also has a method for inserting a picture:
However, you can use the function from RVInsertItems.pas:
Code: Select all
procedure RVInsertString(RVData: TCustomRVData; ItemNo: Integer;
const s: String; StyleNo, ParaNo: Integer; const Tag: TRVTag = RVEMPTYTAG);
Code: Select all
RVInsertString(RichView1.RVData, 0, 'Hello world!', 0, 0);
RichView1.Format;
PS: this unit also has a method for inserting a picture:
Code: Select all
procedure RVInsertGraphic(RVData: TCustomRVData; ItemNo: Integer;
Graphic: TGraphic; Hyperlink: Boolean; ParaNo: Integer;
VAlign: TRVVAlign = rvvaBaseline; const Tag: TRVTag = RVEMPTYTAG);