TRichViewEdit: Inserting items in the position of caret

<< Click to display table of contents >>

TRichViewEdit: Inserting items in the position of caret

These methods are useful for implementing "Insert" menu in your application. All these methods:

1.check ReadOnly property (and do nothing in read-only mode);

2.delete the selected items;

3.insert item(s);

4.quickly reformat the changed part of the document;

5.repaint the editor;

6.generate OnChange event, set Modified to True.

The methods do nothing (and return True), if the selected text is modify/delete protected (or several cells of table are selected).

Inserting Text

These methods can insert several text items of the current text style (see CurTextStyleNo property):

procedure InsertText(text, CaretBefore);

ANSI (InsertTextA) and Unicode (InsertTextW) versions of InsertText are available.

function InsertTextFromFile(FileName, CodePage):Boolean;

function InsertTextFromFileW(FileName):Boolean;

function InsertOEMTextFromFile(FileName):Boolean;

These methods insert one text item (string must not contain line break, page break and tab characters) with the specified tag:

function InsertStringTag(s, Tag): Boolean;

ANSI (InsertStringATag) and Unicode (InsertStringWTag) versions of InsertStringTag are available.

Inserting Non-Text Items

These methods insert one item of the specified type (parameters are similar to parameters of Add*** methods):

function InsertControl(Name, ctrl, VAlign): Boolean;

function InsertPicture(Name, gr, VAlign): Boolean;

function InsertHotPicture(Name, gr, VAlign): Boolean;

function InsertBreak(Width, Style, Color): Boolean;

function InsertBullet(ImageIndex, ImageList): Boolean;

function InsertHotspot(ImageIndex, HotImageIndex, ImageList): Boolean;

Inserting Files and Streams

These methods insert RVF file or stream

function InsertRVFFromStreamEd(Stream):Boolean;

function InsertRVFFromFileEd(FileName):Boolean;

These methods insert RTF (Rich Text Format) file or stream

function InsertRTFFromStreamEd(Stream):Boolean;

function InsertRTFFromFileEd(FileName):Boolean;

These methods insert text of the current text style (see CurTextStyleNo property):

function InsertTextFromFile(FileName):Boolean;

function InsertTextFromFileW(FileName):Boolean;

function InsertOEMTextFromFile(FileName):Boolean;

Inserting Tables and Other Items

The most general method for inserting items is

function InsertItem(Name, Item): Boolean;

It's recommended to use this method only for tables, labels, numbered sequences, endnotes, footnotes, references to parent footnotes and endnotes, page numbers, page counts, equations, and custom item types.

See also...

Methods for pasting from the Clipboard.