rvico TRichView Reference | Overview

RichViewEdit: Inserting items in the position of caret

Top  Previous  Next

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(const text: String; CaretBefore: Boolean=False);

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

function InsertTextFromFile(const FileName: String):Boolean;

function InsertTextFromFileW(const FileName: String):Boolean;

function InsertOEMTextFromFile(const FileName: String):Boolean;

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

function InsertStringTag(const s: String; Tag: TRVTag): 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(const Name: TRVAnsiString

  ctrl: TControl; VAlign: TRVVAlign): Boolean;

function InsertPicture(const Name: TRVAnsiString;

  gr: TGraphic; VAlign: TRVVAlign): Boolean;

function InsertHotPicture(const Name: TRVAnsiString;

  gr: TGraphic; VAlign: TRVVAlign): Boolean;

function InsertBreak(Width: Byte; 

  Style: TRVBreakStyle; Color: TColor): Boolean;

function InsertBullet(ImageIndex: Integer; 

  ImageList: TCustomImageList): Boolean;

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

Inserting Files and Streams

These methods insert RVF file or stream

function InsertRVFFromStreamEd(Stream: TStream):Boolean;

function InsertRVFFromFileEd(const FileName: String):Boolean;

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

function InsertRTFFromStreamEd(Stream: TStream):Boolean;

function InsertRTFFromFileEd(const FileName: String):Boolean;

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

function InsertTextFromFile(const FileName: String):Boolean;

function InsertTextFromFileW(const FileName: String):Boolean;

function InsertOEMTextFromFile(const FileName: String):Boolean;

Inserting Tables and Other Items

The most general method for inserting items is

function InsertItem(const Name: String; Item: TCustomRVItemInfo): Boolean;

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

See also...

Methods for pasting from the Clipboard.

TRichView © trichview.com