Copyright: RichView © Sergey Tkachenko


 TRichView Reference

TRichView Reference

Copyright © Sergey Tkachenko (www.trichview.com)
(svt@trichview.com)

Version 12 (what's new?)

Components

TRVStyle	Component for defining visual appearance of RichView, RichViewEdit, DBRichView, DBRichViewEdit. It contains some properties which can be used by several RichViews.

TRichView	Component for displaying hypertext documents (containing pictures, controls, tables)

TRichViewEdit	Component for editing hypertext documents (containing pictures, controls, tables)

TDBRichView	Data-aware version of RichView

TDBRichViewEdit	Data-aware version of RichViewEdit

TRVPrint	Component for printing documents contained in the components abo	ve

TRVPrintPreview	Component allowing to show document as it will be printed by RVPrint

TRVReportHelper	Component for drawing documents on different canvas (screen, printer, image, etc.)

TRVOfficeConverter	Component allowing to use Microsoft Office text converters (import and export in different file formats)

Class Hierarchy

Diagram of Using

Related topics

•	version history and compatibility

•	overview of features

•	overview of item types (documents consist of items)

•	overview of tables

•	how to...


Overview
 TRichView Reference | Overview

TRichView Overview

Parts of Documents

•	RichView Item Types Overview

•	RichView Items' "Checkpoints" Overview

•	RichView Items' "Tags" Overview

•	RichView Hypertext Overview

•	RichView Paragraphs

•	Borders and Background of Paragraphs

Basic Operations

•	Building RichView Document

•	Scrolling in RichView

•	Selecting Part of RichView Document

•	RichView Clipboard Functions Overview

•	Searching and Replacing in RichView and RichViewEdit

•	Obtaining Items of RichView

•	Modifying RichView Items

Editing Operations

•	RichViewEdit: Inserting items in position of caret

•	Undo/redo in RichViewEdit

•	Drag&drop

Animation

•	Animated Images

Saving and Loading

•	RichView Methods for Saving and Loading

•	RichView Format (RVF) Overview

•	Export of RichView Contents to HTML

Internationalization

•	Unicode in RichView

•	Bi-directional text in RichView

Spelling Check

•	Live spelling check

Important Technical Information

•	Viewer vs Editor

•	Controls, Documents, Items

•	Valid Documents

•	Custom Drawing

•	TRichView Cursors

•	RichView Format (RVF) Specification


RichView Item Types
 TRichView Reference | Overview

RichView Item Types Overview

Document in TRichView can contain items of the following types:

•	Text can have different styles. Each text item has its index in the collection of text styles. The style defines a font of text item, some additional effects (such as background color, vertical offset (for subscripts/superscripts), overline), has some properties affecting editing. Text style can be hypertext; for hypertext you can define additional properties such as mouse cursor and hover color. The style also defines whether the text is in ANSI or Unicode encoding.

•	Tabulators are used instead of TAB (#9) characters.

•	Pictures: you can insert any Delphi graphic type in RichView. You can use TBitmap, TIcon, TMetafile, TJpegImage or third-party graphic classes.

•	"Hot Pictures": the same as pictures, but they are also hypertext links.

•	"Bullets" are pictures from ImageList. Bullets provide an easy and efficient way for adding many similar "standard" pictures in the document. You can use any number of ImageLists (these bullets have no relation to paragraph bullets and numbering; see list markers).

•	"Hotspots" are bullets-"hypertext links". They can have two pictures: normal and "hot" (for highlighting effect under the mouse pointer)

•	"Breaks" are horizontal lines.

•	Controls: You can use any Delphi/C++Builder control merged in text.

•	List Markers: represent paragraph bullets & numbering.

•	Tables arrange subitems in rows and columns.

•	Labels are non-text items looking like text.

•	Numbered sequences allow to insert numbered fields (like "Fig. 1", "Fig. 2", ...) in text.

•	Endnotes.

•	Footnotes.

•	References to parent footnote and endnote.

Non-text items have an associated string referred in this help as a "name of item". RichView does not use these names itself, use them for your own purposes.

Items are organized in paragraphs. You can define your paragraph styles with different left, right and first line indents, with left, right, center or left-right alignment.

All information above can be saved and loaded to stream, file, database field or clipboard in a special format (RVF). You can also export document as HTML, RTF file or print it (see export to html).

Internally, all item types are implemented as classes. Standard item types are implemented in unit RVItem.

Detailed description of item types is beyond the scope of this help file.

All item types are classes derived from one base class - TCustomRVItemInfo.

See also: detailed overview of item types


"Checkpoints"
 TRichView Reference | Overview

 RichView Items' Checkpoints Overview

Checkpoints are...

Each item can have associated checkpoint – an invisible label that you can use for jumping to the specified part of document. Other word-processing tools call similar objects as "bookmarks" or "anchors".

Checkpoint has:

•	name (any string; RichView does not use it itself);

•	tag (just like any RichView items tags)

•	RaiseEvent flag; if RaiseEvent=True then RichView generates OnCheckpointVisible  event when this checkpoint appears in the field of view (usually as a result of scrolling); this feature only works for RichView, and does not work for RichViewEdit (in this version).

Limitations: checkpoint names and tags must not contain #0, #1 and #2 characters. Failing to follow these rules will cause problems in saving documents in RichView Format.

Drawing checkpoints

You can set the option to make checkpoints visible: include rvoShowCheckpoints in RichView.Options. By default, checkpoints are shown as dotted vertical lines with a small circle in the top left corner of the associated item. Displaying checkpoints is useful in editing mode.

Checkpoints colors:

•	RichView.Style.CheckpointColor for "normal" checkpoints (clGreen by default)

•	RichView.Style.CheckpointEvColor for checkpoints with RaiseEvent=True (clLime by default)

You can create your own procedure for drawing checkpoints, see TRVStyle.OnDrawCheckpoint.

Using checkpoints

The usual using of checkpoint is obtaining its vertical coordinate (relative to the top of document area) and scrolling document so that the item associated with the checkpoint becomes visible. There are some more interesting applications for checkpoints.

Adding checkpoints in the document

You can add checkpoint at the end of the document using AddNamedCheckpointEx, AddNamedCheckpointExTag, AddNamedCheckpoint, AddCheckpoint, AddCheckpointTag. All these methods have a subset of functionality of the AddNamedCheckpointExTag method.

function TRichView.AddNamedCheckpointExTag(const CpName: String;

  RaiseEvent: Boolean; Tag: Integer): Integer;

The parameters of this function were described above. This function (and all these functions) returns the index of the added checkpoint in RichView (the first checkpoint has index=0).

These calls are equivalent:

AddNamedCheckpointEx(Name, RaiseEvent)

and

AddNamedCheckpointExTag(Name, RaiseEvent,0);

AddNamedCheckpoint(Name)

and

AddNamedCheckpointExTag(Name, False, 0);

AddCheckpointTag(Tag)

and

AddNamedCheckpointExTag('', False, Tag);

AddCheckpoint

and

AddNamedCheckpointExTag('', False, 0);

Recommended for using: AddCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag.

As it was told, the above described methods add a new checkpoint to the end of the document. When you add a new item to the end of the document, the last added checkpoint becomes associated with this item. (So, TRichView can contain any number of checkpoints associated with items and one checkpoint at the end of the document).

You can modify the checkpoint by SetCheckpointInfo method, and remove it by RemoveCheckpoint.

The rest of methods can be separated into two groups:

1.	Methods returning information about some checkpoint. These methods return a value of TCheckpointData class.

2.	Methods extracting checkpoint properties from the TCheckpointData value.

Methods and events of the first group (obtaining TCheckpointData):

TCheckpointData is a pointer. If these methods return nil, it means that there is no such checkpoint, item has no associated checkpoint, etc.

•	GetFirstCheckpoint, GetNextCheckpoint(CheckpointData), GetLastCheckpoint, GetPrevCheckpoint(CheckpointData) – allow you to obtain a list of all checkpoints in the document (except for checkpoints in table cells, see below);

•	GetItemCheckpoint(ItemNo) – returns the checkpoint associated with the specified item;

•	GetCheckpointByNo(No)  –  returns the checkpoint with the specified index;

•	FindCheckpointByName(Name) – returns the first checkpoint having the specified Name;

•	FindCheckpointByTag(Tag) – returns the first checkpoint having the specified Tag; Tag is considered as an integer value (integers are compared) or as a pointer to string (strings are compared) depending on RichView.Options;

•	event OnCheckpointVisible (Sender: TRichView; CheckpointData: TCheckpointData); this event is generated when:

o	RichView.CPEventKind = cpeWhenVisible and some checkpoint (with RaiseEvent=True) becomes visible (example of application: you can mark pictures in TRichView with checkpoints; when this picture becomes visible you can display information about it in a separate window)

o	RichView.CPEventKind = cpeAsSectionStart; in this mode it's guaranteed that the last event is generated for visible checkpoint or for the nearest checkpoint above the visible area (example of application: you can mark beginnings of chapters of your document with checkpoints, create a table of contents in ListBox (one listbox item = one chapter = one "RaiseEvent" checkpoint); if you select listbox item associated with the last raised checkpoint, the list box will always have name of the chapter in the field of view highlighted)

Methods of the second group (extracting information from TCheckpointData):

•	GetCheckpointInfo(CheckpointData, Tag, Name, RaiseEvent) – returns Tag, Name and "RaiseEvent" flag of checkpoint;

•	GetCheckpointXY(CheckpointData, X,Y), GetCheckpointYEx(CheckpointData): Integer – obtaining information about coordinates of checkpoint (Y is the most useful; you can pass this Y to RichView.ScrollTo method);

•	GetCheckpointItemNo(CheckpointData) : Integer – returns the index of the associated item; it can return -1 for checkpoint in the end of document (no associated item);

•	GetCheckpointNo(CheckpointData): Integer – returns the index of the checkpoint;

Methods belonging to the both groups:

•	GetCheckpointY(no): Integer – equivalent to GetCheckpointYEx(GetCheckpointByNo(No));

Methods of editor

The first group of methods contains editing-style analogs of SetCheckpointInfo and RemoveCheckpoint:

•	SetCheckpointInfoEd – adds checkpoint for the specified item, as an editing operation;

•	RemoveCheckpointEd – deletes checkpoint for the specified item, as an editing operation.

The second group contains methods working with the item at the position of caret (if the caret is between items, they work with the item to the left):

•	GetCurrentCheckpoint – returns checkpoint associated with the item at the caret position;

•	SetCurrentCheckpointInfo – adds/modifies checkpoint for the item at the caret position, as an editing operation;

•	RemoveCurrentCheckpoint – deletes checkpoint for the item at the caret position, as an editing operation.

The third group contains methods working with the checkpoint at the position of caret:

•	InsertCheckpoint – inserts checkpoint in the caret position (adds/modifies checkpoint for the item to the right; if the caret was in the middle of text item, the method preliminarily splits this item at the caret position), as an editing operation;

•	GetCheckpointAtCaret – returns the checkpoint exactly at the caret position;

•	RemoveCheckpointAtCaret – deletes the checkpoint exactly at the caret position, as an editing operation.

RTF and HTML

In HTML, checkpoints are saved as anchors (<a name> tag). Either checkpoint name or checkpoint index can be used, see rvsoUseCheckpointsNames option for SaveHTML and SaveHTMLEx. Links to checkpoints must start with '#' character.

In RTF, checkpoints are saved as bookmarks (checkpoints names are used). When importing RTF, bookmark start is read as checkpoint (bookmark name is written in checkpoint name). When reading RTF, links to bookmarks are converted to links started from '#'. When writing RTF, links started from '#' are written as links to bookmarks.

Example 1

Enumerating all checkpoints in the document (not including checkpoints in table cells). This method is very fast even for large documents, because all checkpoints are organized in a special list.

var Tag: Integer;

    Name: String;

    RaiseEvent: Boolean;

    CheckpointData: TCheckpointData;

begin

  CheckpointData := MyRichView.GetFirstCheckPoint;

  while CheckpointData<>nil do begin

    MyRichView.GetCheckpointInfo(CheckpointData,Tag,Name,RaiseEvent);

      // processing this checkpoint

    ...

    CheckpointData := MyRichView.GetNextCheckpoint(CheckpointData);

  end;

end;

Example 2

Enumerating all checkpoints in the document, including checkpoints in table cells

procedure EnumCheckpoints(RVData: TCustomRVData);

var i,r,c: Integer;

  table: TRVTableItemInfo;

  Tag: Integer;

  Name: String;

  RaiseEvent: Boolean;

  CheckpointData: TCheckpointData;

begin

  for i := 0 to RVData.ItemsCount-1 do begin

    CheckpointData := RVData.GetItemCheckpoint(i);

    if CheckpointData<>nil then begin

      RVData.GetCheckpointInfo(CheckpointData,Tag,Name,RaiseEvent);

      // processing this checkpoint

      ...

    end;

    if RVData.GetItemStyle(i)=rvsTable then begin

      table := TRVTableItemInfo(RVData.GetItem(i));

      for r := 0 to table.RowCount-1 do

        for c := 0 to table.ColCount-1 do

          if table.Cells[r,c]<>nil then

            EnumCheckpoints(table.Cells[r,c].GetRVData);

    end;

  end;

end;

Call:

EnumCheckpoints(MyRichView.RVData);

In the second example, RVData.GetCheckpointXY returns checkpoint coordinates relative to the top left corner of this RVData (it may be left top corner of the cell). In order to get absolute coordinates of this checkpoint in the document (for MyRichView.ScrollTo), obtain the coordinates of top left corner of this RVData (TCustomRVFormattedData(RVData).GetOriginEx(X,Y)), relative coordinates of checkpoint (TCustomRVFormattedData(RVData).GetCheckpointXY(X,Y)), and sum them up

Compatibility Issues

Incompatibility with old (freeware) versions of RichView: in older versions checkpoints were items. Now it's not true – they are an additional information associated with items (text, pictures or controls). Therefore, you now can't add two or more checkpoints one by one without an item "between" them. You can choose one of two options when compiling RichView source:

•	RichView raises an exception when you try to add checkpoint after checkpoint (default mode);

•	RichView ignores the second checkpoint; Add***Checkpoint*** methods will return the index of previously added checkpoint in this case. This mode is turned on by defining RVALLOWCPBYCP conditional define.

See also...

See also properties and events of TRVStyle:

CheckpointColor ,.CheckpointEvColor, OnDrawCheckpoint

See also properties of TRichView:

Options,.CPEventKind

See also events of TRichView:

OnCheckpointVisible

See also methods of TRichView:

AddNamedCheckpointEx, AddNamedCheckpointExTag, AddNamedCheckpoint, AddCheckpoint, AddCheckpointTag, SetCheckpointInfo, RemoveCheckpoint,·GetFirstCheckpoint, GetNextCheckpoint, GetItemCheckpoint, GetCheckpointByNo, FindCheckpointByName, FindCheckpointByTag, GetCheckpointInfo, GetCheckpointXY, GetCheckpointYEx, GetCheckpointItemNo, GetCheckpointNo, GetCheckpointY

See also methods of TRichViewEdit:

GetCurrentCheckpoint, SetCheckpointInfoEd, RemoveCheckpointEd


Items' "Tags"
 TRichView Reference | Overview

RichView Items' "Tags" Overview

Each item of RichView has an associated integer value – tag. Tags are provided for the convenience of storing additional integer value (4 bytes) or pointer information for special needs in application. Moreover, RichView can work in mode where all tags are treated as PChar – pointers to dynamically allocated strings. The main purpose of tags is organizing work with hypertext.

Do not confuse RichView items tags with "Tag" properties of TComponent descendants! (RichView uses "Tag" properties of inserted controls for its own needs; you can set "Tag" properties of ImageList for organizing saving/loading "bullets" and "hotspots" from RVF; but this topic is about completely different tags!)

What you need to know about items tags:

•	if you do not want to use them – just forget about them; they always will be equal to 0;

•	in the default mode (rvoTagsArePChars is not in RichView.Options) RichView does not use tags and you can use them as you wish;

•	if rvoTagsArePChars in RichView.Options then tags are treated as pointers to dynamically allocated strings (see below for details);

•	"checkpoints" also have tags; all rules for items tags work for checkpoints tags;

•	editor can clear (set to 0) tags when applying different style to text according to RichViewEdit.EditorOptions;

•	tag mode can be changed in the TRichView component editor.

"Tags are PChars mode"

In this mode RichView:

•	frees tag string's memory when deleting/clearing items,

•	compares tags in internal routines as strings,

•	saves tags in RVF as strings.

When RichViewEdit needs to duplicate tags (for example when user press  Enter  key and the current line will be separated into two lines) the editor duplicates it by allocating the same string (using StrNew) so both new items will have their own tag strings.

 Unicode note: For Delphi/C++Builder 2009 or newer, tags are pointers to Unicode strings (you must use PWideChar version of StrNew). For older versions of Delphi, tags are pointers to ANSI strings.

There are some rules for this mode:

•	All main AddXXX methods (methods for adding items to the end of document) have AddXXXTag modifications, accepting Tag as the last parameter. You must pass value obtained from StrNew or StrAlloc functions, or 0 (nil) converted to Integer to this parameter

For example

MyRichView.AddNLTag('Example', 0, 0, Integer(StrNew('Tag Example')));

Do not confuse StrNew with NewStr. Do not use NewStr!

The same rule applies to InsertStringTag of TRichViewEdit.

•	You can use AddXXX methods which do not have Tag parameter. These functions create a new item with Tag=0 (nil) which is legal value for this mode.

•	All methods of RichView/RichViewEdit which return Tag (as function value or as var-parameter) return a pointer to tag string, not to the copy of string; you need not and should not free memory for the returned string;

•	All methods of RichView/RichViewEdit for item modifying (SetXXXInfo) accept pointers to newly dynamically allocated strings, like AddXXXTag methods. But there is one exception  – you can pass tag value obtained from this item before (with GetXXXInfo)

Example:

var Tag: Integer;

    S: String;

    TagStr: PChar;

// Converting the first text item and its tag string to upper case

  MyRichView.GetTextInfo(0, S, Tag);

  TagStr := StrNew(PChar(Tag));

  TagStr := StrUpper(TagStr);

  MyRichView.SetItemText(0, UpperCase(S));

  MyRichView.SetItemTag(0, Integer(TagStr));

•	If you want to save and load document in RVF you must provide that tag strings do not contain #10, #1 and #2 characters.

•	You cannot mix integer and string tag (for different items in one RichView); you should not switch tag mode when the component contains nonzero tags.

See also...

RichView methods for adding items with tags to the end of document:

AddNLTag, AddTag, AddBreakTag, AddPictureExTag, AddHotspotExTag, AddBulletExTag, AddControlExTag, AddBreakExTag.

RichView methods for adding "checkpoints" with tags to the end of document:

AddCheckpointTag, AddNamedCheckpointExTag.

RichView methods for obtaining information about items (including tags):

GetItemTag, GetBreakInfo, GetBulletInfo, GetHotspotInfo, GetPictureInfo, GetControlInfo, GetTextInfo.

RichView methods for modifying items (including tags):

SetItemTag, SetBreakInfo, SetBulletInfo, SetHotspotInfo, SetPictureInfo, SetControlInfo.

RichView methods allowing work with checkpoints tags:

FindCheckpointByTag, GetCheckpointInfo, SetCheckpointInfo.

RichViewEdit methods for obtaining information about item in caret position:

GetCurrentTag, GetCurrentBreakInfo, GetCurrentBulletInfo, GetCurrentHotspotInfo, GetCurrentPictureInfo, GetCurrentControlInfo, GetCurrentTextInfo.

RichViewEdit methods for inserting:

InsertStringTag, InsertStringATag, InsertStringWTag

RichViewEdit methods for modifying items (including tags):

SetItemTagEd, SetBreakInfoEd, SetBulletInfoEd, SetHotspotInfoEd, SetPictureInfoEd, SetControlInfoEd.

RichViewEdit methods for modifying information about item in caret position:

SetCurrentTag, SetCurrentBreakInfo, SetCurrentBulletInfo, SetCurrentHotspotInfo, SetCurrentPictureInfo, SetCurrentControlInfo

RichViewEdit methods for working with checkpoints tags:

SetCheckpointInfoEd, SetCurrentCheckpointInfo.

RichViewEdit options affecting tags:

EditorOptions.


Hypertext Overview
 TRichView Reference | Overview

RichView Hypertext Overview

RichView has no default actions on hypertext events. However, it provides a convenient way for you to create hypertext document and define any actions that you want in response on user click on documents. RichView provides visual effects for items-hypertext jumps (highlighting).

There are three types of hypertext items:

•	text with hypertext styles;

•	hot pictures

•	hotspots

RichView provides the following indication of hypertext items (when the mouse pointer moves above them):

•	changing color of text items (TFontInfo.HoverColor, HoverBackColor);

•	underlining text items (TFontInfo.HoverEffects);

•	changing mouse cursor (any hypertext text style can have its own cursor, see TRVStyle.JumpCursor, TFontInfo.JumpCursor)

•	for hotspots it can change picture (there are two pictures for hotspot – "normal" and "hot"; they must be in the same imagelist but can have different indices);

By default, main events of hypertext (OnRVMouseMove, OnJump) and cursor indication do not work in editor (TRichViewEdit). Instead of highlighting items under mouse pointer editor highlights the item at the position of caret (item that is being edited).

But editor can be switched to hypertext mode when user presses and holds  Ctrl  key, if rvoCtrlJumps is in EditorOptions.

Since version 1.6, hypertext works in ReadOnly editor just like in viewer.

Besides, you can provide some specific actions in response on user clicking any RichView item, using OnRVMouseDown and OnRVMouseUp events.

Hypertext

Any hypertext link (text, hotspot or hot picture) has its own id. This id is passed in hypertext events - OnRVMouseMove and OnJump. The first hypertext item has id equal to RichView.FirstJumpNo, the next one is greater by one and so on. By default, RichView.FirstJumpNo=0 and hypertext items have id = 0, 1, 2, ...

Use OnRVMouseMove to provide action when user moves cursor to hypertext link. For example, you can change text in the status bar.

Example:

procedure TMyForm.MyRichViewRVMouseMove(Sender: TObject; id: Integer);

begin

  if id=-1 then

    MyStatusbar.SimpleText := ''

  else

    MyStatusbar.SimpleText := 'Click here';

end;

Special value (-1) is passed to this event as id when the user moves the mouse pointer outside any hypertext link. This event never occurs with the same id two times one after one.

The main hypertext event is OnJump:

Example:

procedure TMyForm.MyRichViewJump(Sender: TObject; id: Integer);

begin

  case id of

    0: Application.MessageBox('Ah!','',0);

    1: Application.MessageBox('Ugh!','',0);

    2: Application.MessageBox('Oops!','',0);

  end;

end;

The method shown in the example above (using id for defining specific actions) was the only available method in the older versions of RichView. Now you can use other ways, described below.

Sometimes information contained in the clicked item is enough to know what to do. The key method here is GetJumpPointLocation This function allows you to obtain the index of the clicked item. For example, if you have only text links (no hotspots and hot pictures) and they are URLs, you can write:

uses ..., CRVFData, ShellApi;

...

procedure TMyForm.MyRichViewJump(Sender: TObject; id: Integer);

var URL: String;

    RVData: TCustomRVFormattedData;

    ItemNo: Integer;

begin

  MyRichView.GetJumpPointLocation(id, RVData, ItemNo);

  URL := MyRichView.GetItemText(ItemNo);

  ShellExecute(Application.Handle, 'open', PChar(URL),

    nil, nil, SW_NORMAL);

end;

In the example above, we use GetJumpPointLocation to get the document containing this hyperlink (RVData) and the index of the clicked hypertext item in this document (ItemNo).

Next, we get information about the clicked text item with GetItemText and use the received string to launch a browser.

If you have both text and hotspot/hot pictures hypertext items, you can use RVData.GetItemStyle method to recognize the item type ("style"), and next use GetTextInfo or GetHotspotInfo/GetPictureInfo. For hotspots you can use image indices and hotspot name to decide which action to do.

The method shown in the next example is universal. You can use tags to add your information to any RichView item. There are two tag modes: tags are integers and tags are character strings. (See tags).

uses ..., CRVFData, ShellApi;

...

procedure TMyForm.MyRichViewJump(Sender: TObject; id: Integer);

var URL: String;

    RVData: TCustomRVFormattedData;

    ItemNo: Integer;

begin

  MyRichView.GetJumpPointLocation(id, RVData, ItemNo);

  URL := PChar(MyRichView.GetItemTag(ItemNo));

  ShellExecute(Application.Handle, 'open', PChar(URL),

    nil, nil, SW_NORMAL);

end;

Inserted controls cannot be hyperlinks. But, of course, you can set your own cursors and mouse events for any inserted control.

Hypertext and tables (new in version 1.4)

Hypertext works not only in a the main document but also in table cells (subdocuments)

Hypertext links are numbered sequentially through the document, including links in cells. All links in the document have unique indices (id).

Having hypertext id you can obtain hypertext item location with the method:

procedure TRichView.GetJumpPointLocation(id: Integer;

  var RVData: TCustomRVFormattedData; var ItemNo: Integer);

Hypertext item is the ItemNo-th item in RVData object.

RVData can be RichView[Edit].RVData, cell, or RVData of inplace editor.

Method GetJumpPointItemNo is obsolete because it returns only ItemNo.

See also...

•	OnReadHyperlink, OnWriteHyperlink;

•	example how to create a list of hyperlinks and move the caret to the selected hyperlink: http://www.trichview.com/forums/viewtopic.php?t=397.


Paragraphs
 TRichView Reference | Overview

Paragraphs in TRichView

Paragraphs

TRichView documents are organized in paragraphs. Each paragraph has its style defined as an index in the collection of paragraph styles (RichView.Style.ParaStyles).

For the list of properties available for paragraphs, see TParaInfo class (TParaInfo is a class of item in the collection of paragraph styles).

Line breaks inside paragraphs

(Since version 1.2) You can move item to the new line within the same paragraph (press  Shift + Enter  instead of  Enter ). Visually, such line breaks have the following differences from paragraph breaks:

•	FirstIndent is not applied to the first line after the break;

•	no additional spacing between this line and the previous line (SpaceBefore and SpaceAfter) is applied;

•	if the paragraph has border/background, this line will be inside the same border/background as the previous line.

Specifying paragraph attributes when generating document

All methods of RichView for appending items (except for the obsolete methods) have ParaNo parameter. It can be:

•	zero or positive value: index in the collection of paragraph styles, if this item will start a new paragraph;

•	-1, if this item will continue the paragraph (please do not add items with ParaNo=-1 after breaks or tables).

Breaks (horizontal lines) do not have paragraph style, so AddBreak*** methods do not have ParaNo parameter. But SpaceBefore and SpaceAfter values of the 0-th paragraph style are added to spacing of all breaks.

These methods are:

procedure AddNL(s, StyleNo, ParaNo);

procedure AddFmt(FormatStr, Args, StyleNo, ParaNo);

procedure AddTextNL(s, StyleNo, FirstParaNo, OtherParaNo);

procedure AddTextNLA(s, StyleNo, FirstParaNo, OtherParaNo);

procedure AddTextNLW(s: WideString; StyleNo, FirstParaNo, OtherParaNo,

  DefAsSingleParagraph);

procedure AddPictureEx(Name, gr, ParaNo, VAlign);

procedure AddHotspotEx(Name, ImageIndex, HotImageIndex,

  ImageList, ParaNo);

procedure AddBulletEx(Name, ImageIndex, ImageList, ParaNo);

procedure AddControlEx(Name, ctrl, ParaNo, VAlign);

procedure Add(s, StyleNo); // equivalent to AddNL(s, StyleNo, -1).

There are some obsolete methods that were developed when RichView had no paragraph styles. They still work, see compatibility.

See also: building a document, item types.

All the methods above have "tagged" analogs, see "tags".

See also methods of RichView:

function LoadText(FileName, StyleNo, ParaNo, AsSingleParagraph):Boolean;

function LoadTextW(FileName, StyleNo, ParaNo, DefAsSingleParagraph):Boolean;

function AppendRVFFromStream(Stream, ParaNo):Boolean;

function IsParaStart(ItemNo): Boolean;

function IsFromNewLine(ItemNo): Boolean;

function GetItemPara(ItemNo): Integer;

Text flow around left- and right-aligned items

Some items (for example, pictures) can be aligned to left or right side (see TRVVAlign). For such items, an invisible placeholder is left in the place of their insertion; the item itself is placed at the specified side. If the item is at the beginning of the line, this item is placed on the same level; otherwise, it is placed below this line.

Paragraphs flow around side-aligned images. You can disallow flowing around left- and/or right-aligned items using ClearLeft and/or ClearRight properties.

Editing

RichViewEdit has a group of Insert*** methods inserting new item(s) in the position of caret, using the current paragraph style. Usually, if you implement RichViewEdit-based editor, you need to provide interface for displaying and changing the current paragraph style. You can do it using ComboBox with style names, toolbar buttons or/and keyboard shortcuts.

property CurParaStyleNo: Integer;

– index of the current (in the position of caret) paragraph style;

When the user moves the caret to paragraph with different style, OnCurParaStyleChanged event is generated, so you can select another item in ComboBox of styles or check toolbar buttons.

Assigning to CurParaStyleNo property is possible, but will not create a desired effect. To apply style to the paragraph at the position of the caret (and all selected paragraphs) use

procedure ApplyParaStyle(ParaStyleNo: Integer);

ApplyParaStyle applies only one paragraph style to all selected paragraphs. This method does not allow to implement more complex commands, such as "increase indents", "align to the right", etc. For implementing these commands, use

procedure ApplyParaStyleConversion(UserData: Integer);

See also...

Borders and Background of Paragraphs


Borders and Background of Paragraphs
 TRichView Reference | Overview

 Borders and Background of Paragraphs

Paragraphs can have borders and/or background color. These properties are defined in paragraph styles (see TParaInfo). Border is defined in Border property, background is in Background property.

By default, there is no border around paragraph (TRVStyle.ParaStyles[i].Border.Style=rvbsNone), and background of paragraph is transparent (TRVStyle.ParaStyles[i].Background.Color=clNone).

Border offsets and colored area offsets are defined separately from each other, so you can draw border inside colored area, border around colored area with gap, and even more interesting effects:

Border and colored area both have BorderOffsets property, which defines:

•	for borders: a gap between the border and the paragraph contents;

•	for background: a colored area overhang (padding) from the paragraph content.

Top, right, bottom, left offsets (i.e. gap and padding) are defined by Top, Right, Bottom, Left properties of BorderOffsets.

Positive values increase gap (padding). Negative values put the border and edges of the colored area inside the paragraph content.

In the example above Background.BorderOffsets = (Left: -7; Top: -7; Right: 7; Bottom: 7).

BorderOffsets.Top must not exceed SpaceBefore property of the same paragraph.

BorderOffsets.Bottom must not exceed SpaceAfter property of the same paragraph.

You can hide some edges of border using Border.VisibleBorders property.

Breaks use SpaceBefore and SpaceAfter values of the 0-th paragraph style, but they never have a border and a colored background.

It's possible to create a line break without starting a new paragraph. In editor, press  Shift + Enter  instead of  Enter . Items after the caret will be moved to the new line, but still they will be inside the same paragraph (inside the common border and the colored area, no SpaceBefore and SpaceAfter will be applied).

See also...

TParaInfo.Border

TRVBorder


Building a Document
 TRichView Reference | Overview

 Building RichView Document

Creating a New Document

You can build document by:

1.	clearing TRichView,

2.	appending items,

3.	reformatting and redrawing RichView.

Therefore, a general structure of document generation procedure is:

MyRichView.Clear;
<Methods for adding contents>
MyRichView.Format;

Note: all methods introduced in RichView (except for the formatting methods) do not reformat document, do not redraw RichView and do not call OnChange event (RichView does not have OnChange event, it is introduced in TRichViewEdit) ( [image] viewer-style methods)

A group of methods for adding items is the largest group of methods (and contains a large number of methods for backward compatibility).

Appending Text Items

Important: Do not pass string with cr, lf or cr+lf, tab and page break characters in the functions below, except for AddText*** methods!

Some text items can be hypertext. Hypertext items are added by the same methods as regular text items.

Methods working with String parameter

These methods add text specified in a String parameter. This parameter is Unicode for Delphi/C++Builder 2009, and ANSI for the older versions of Delphi/C++Builder.

•	AddNL(S, StyleNo, ParaNo) – adds one item with text S; StyleNo is an index in the collection of text styles (RichView.Style.TextStyles); ParaNo is an index in the collection of paragraph styles (RichView.Style.ParaStyles) (if this item will start a new paragraph) or -1 (if this item will continue the paragraph).

•	Add(S, StyleNo) – equivalent to AddNL(S, StyleNo, -1).

•	"Tagged" analogs: AddNLTag, AddTag (see Tags)

•	AddTextNL(s, StyleNo, FirstParaNo, OtherParaNo) – adds one or more text items; the first item is added with FirstParaNo paragraph style, and other items are added as new paragraphs with OtherParaNo paragraph style; items are separated by cr, lf or cr+lf characters in s; s can contain page break and tab characters.

•	AddFmt(FormatStr, Args, StyleNo, ParaNo) adds Format(FormatStr, Args) string, where Format is a function from SysUtils unit.

Methods working with ANSI/Unicode explicitly

•	AddNLATag, AddNLWTag, AddTextNLA, AddTextNLW

Notes for former users of freeware version:

In older versions of RichView you was not able to add empty strings, which are useful as empty paragraphs. Now there is no such limitation.

In older versions, there was no special processing of tab characters: they were displayed as special characters. Now Add*** methods replace tab characters with spaces or insert them as tabulators (RichView.Style.SpacesInTab space characters per one tab; changing SpacesInTab will not change already created document).

Appending Images

You can add picture of any Delphi format – TBitmap, TIcon, TMetafile, TJpegImage or third party graphic format.

You should create a picture and TRichView will destroy it itself when necessary (for example, when you call RichView.Clear).

•	AddPictureEx(Name, gr, ParaNo, VAlign)
(Name: TRVAnsiString – name of picture; this string is not used by RichView itself; this string should not contain cr and lf characters; gr: TGraphic - picture; ParaNo:Integer is an index in the collection of paragraph styles (RichView.Style.ParaStyles) (if this picture will start the paragraph) or -1 (if this picture will continue paragraph); VAlign: TRVVAlign – vertical alignment of picture).

•	"Tagged" analogs: AddPictureExTag (See Tags).

•	Obsolete method: AddPicture.

Appending Hot Images

•	AddHotPicture, AddHotPictureTag

Appending Delphi Controls

You can add any Delphi control in RichView, and it will work as usual. You should create the control and RichView will destroy it itself when necessary (for example, when you call RichView.Clear). The methods for adding controls assign RichView to control.Parent.

•	AddControlEx(Name, ctrl,ParaNo, VAlign), AddControlExTag(Name, ctrl,ParaNo, VAlign, Tag) is similar to the methods for pictures.

•	Obsolete method: AddControl.

This version of TRichView, like old ones, uses Tag properties of inserted components for internal needs (do not confuse with RichView items tags).

Appending Bullets – Images from ImageLists

•	AddBulletEx (Name, ImageIndex, ImageList, ParaNo)
(Name: TRVAnsiString – name of the bullet; this string is not used by RichView itself; this string should not contain cr and lf characters; ImageIndex: Integer – index of the picture in imagelist; ImageList: TCustomImageList – imagelist; this will be just a reference to imagelist; RichView does not hold copy of imagelist, and does not free it; ParaNo:Integer is an index in the collection of paragraph styles (RichView.Style.ParaStyles) (if this bullet will start a paragraph) or -1 (if this bullet will continue paragraph)).

•	"Tagged" analog: AddBulletExTag (See Tags).

•	Obsolete method: AddBullet.

Appending Hotspots – Hypertext Images from ImageLists

Hotspots are just like bullets, but can have two images ("normal" and "hot") and can be used as hypertext link.

•	AddHotspotEx(Name, ImageIndex, HotImageIndex, ImageList, ParaNo) – similar to AddBulletEx

•	"Tagged" analog: AddHotspotExTag (See Tags).

•	Obsolete method: AddHotspot.

Appending Breaks – Horizontal Lines

•	AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag.

Adding Paragraphs' Bullets and Numbering (list markers)

List markers can be added using SetListMarkerInfo method. Unlike the methods above, this method can insert list markers not only to the end of document, but set them for existing paragraphs.

Adding Other Items

Tables, labels, numbered sequences, endnotes, footnotes, references to parent footnotes and endnotes, custom item types do not have special methods for adding them to documents. All of them are added by AddItem method.

Appending Checkpoints

Checkpoints are not items of RichView, but methods for adding checkpoints are similar to methods for adding items. The main methods for appending checkpoints are AddNamedCheckpointEx, AddNamedCheckpointExTag. See "checkpoints".

Adding Page Breaks

Page break is an item property ("this item starts a new page" flag). Only items that start a new paragraph can start a new page.

Example:

var ItemNo: Integer;

MyRichView.AddNLATag('First page', 0, 0, 0);

ItemNo := MyRichView.ItemCount;

MyRichView.AddNLATag('Second page', 0, 0, 0);

MyRichView.PageBreaksBeforeItems[ItemNo] := True;

Appending and Inserting RVF

You can append RVF data by the methods:

•	function InsertRVFFromStream(Stream: TStream; Index: Integer):Boolean;

This method can insert RVF. The first item of RVF will have the specified Index. For example, if you want to append items from RVF, write:

MyRichView.InsertRVFFromStream(MyStream, MyRichView.ItemCount);

InsertRVFFromStream is the only method of RichView (not RichViewEdit) for inserting items.

•	function AppendRVFFromStream(Stream: TStream; ParaNo: Integer):Boolean;

This method is similar to InsertRVFFromStream (if it used for appending RVF), but it ignores paragraph style of the first item in RVF and uses ParaNo instead of it. ParaNo is an index in the collection of paragraph styles (RichView.Style.ParaStyles) (if item will start a paragraph) or -1 (if the item will continue paragraph).

Appending Content of Another RichView

•	procedure AppendFrom(Source: TCustomRichView);

This is the most efficient method to copy contents of one RichView to another one. Both the source and the target RichViews must have  the same "tag" mode (rvoTagsArePChars in Options) and must be linked to the same RVStyle. Inserted controls and tables are not copied with this method  (just ignored).

Loading

Methods for loading (Load***) belong to this group of methods as well.

Additional Notes

There is an important change in version 1.2: you can add items from new line without starting a new paragraph. There are no new methods for generating documents (it is added in v1.3: AddTextNLW), but there is a method that affects their behavior: TRichView.SetAddParagraphMode.

Some custom item types (such as tables) do not have special methods for appending them. They can be appended by general method AddItem.


Scrolling
 TRichView Reference | Overview

Scrolling in RichView

Vertical scrolling

Documents in RichView can have almost unlimited height. But ranges of scrollbars are limited, and RichView cannot use pixels as scrolling units (small step of scrollbar). Scrolling units of RVScroller (ancestor of RichView) are referred here as "RVSU" (RichView Scrolling Units). By default, 1 RVSU = 10 pixels, but the component can increase it automatically during formatting if the range of vertical scrollbar exceeds 30,000. You can set a number of pixels in 1 RVSU with VSmallStep property (but the component can increase it during formatting).

For example, you may want to set RVSU to the height of one line of the normal text. After assigning a new value to VSmallStep, you should reformat document using Format method).

You can get or set position of vertical scrollbar using VScrollPos property (in range 0..VScrollMax)

You can also use method ScrollTo for scrolling to the specified vertical position, measured in pixels.

ScrollTo(y) is equivalent to VScrollPos := y div VSmallStep, so ScrollTo cannot scroll exactly to the specified position.

You can show and hide vertical scrollbar with VScrollVisible property.

DocumentHeight property is a vertical height of a document in pixels (height of scrollable area). For example, you can use this value to set height of RichView. DocumentHeight includes values of TopMargin and BottomMargin.

You can get vertical coordinate in document for:

•	checkpoints

•	hypertext link (GetJumpPointY)

•	any item (GetItemCoords)

Horizontal scrolling

Horizontal scrollbar appears automatically when necessary.

You can hide it with HScrollVisible property.

You can get or set the position of horizontal scrollbar using HScrollPos property (in range 0..HScrollMax)

You can use some properties to control width of a document (a width of scrollable area minus margins), thus controlling a horizontal scrolling (see LeftMargin, RightMargin)

By default, if the document does not contain wide images, controls or tables, text is wrapped to fit the client width of RichView minus margins.

If there are pictures or controls, width of scrolling area is equal to

max(client width of RichView,

    "maximal width of pictures or controls" + "maximal left + first line +  right indent" + margins),

and text is wrapped to fit width of the scrolling area minus margins.

Text in paragraphs with no-wrap option can also affect to width of scrolling area, in the same was as wide pictures or controls.

Use MinTextWidth property to set the minimal width for text wrapping (text wraps when its length in pixels exceeds this value). Horizontal scrollable area cannot be less than MinTextWidth+margins (but can be greater because of wide pictures or wide client width of RichView). You can use MinTextWidth to speed up formatting when RichView is resized. Formatting is very quick if width of scrollable area is not changed. For example, if you set MinTextWidth to the size of screen, RichView will not perform full reformatting when user resizes it (well, it's not convenient to read text with horizontal scrollbar)

Use MaxTextWidth property to set maximal width for text wrapping. This value does not affect width of scrollable area.

A similar effect can be achieved using rvoClientTextWidth option from Options. If this option is set, width for text wrapping is always equal to client width of RichView minus margins. It is useful if your document can have wide pictures or controls, or no-wrap paragraphs.

You can set no-wrap option for paragraph style. If this option is set, this paragraph will not be wrapped automatically.


Selecting
 TRichView Reference | Overview

Selecting Part of RichView Document

User can select a part RichView document with the mouse (in RichViewEdit he/she also can use  Shift +caret movement keys).

You can turn off/on a word selection mode, see RVStyle.SelectionMode.

Selection Appearance

Selected text has RichView.Style.SelTextColor/InactiveSelTextColor color and RichView.Style.SelColor/InactiveSelColor background.

By default, it is clHighlightText on clHighlight both for active (focused) and inactive windows..

Selected bullets and hotspots are shaded with RichView.Style.SelColor, selected images and breaks have border with RichView.Style.SelColor color.

See also RVStyle.SelectionStyle.

Operations

You can:

•	disallow making selection (clear rvoAllowSelection in Options); please do not use in editor!

•	determine if the selection is not empty (SelectionExists);

•	deselect RichView (Deselect; Invalidate);

•	select the whole document (SelectAll; Invalidate);

•	get selection bounds (GetSelectionBounds);

•	select a part of the document (SetSelectionBounds;Invalidate);

•	select the inserted control (SelectControl);

•	get the selection as a text (GetSelText, GetSelTextW);

•	get the selection as a Rich Text Format  (SaveRTFToStream, SaveRTF);

•	get the selection as an image, if image is selected (GetSelectedImage);

•	save the selection to stream or file (SaveRVFToStream, SaveRVF);

•	copy the selection to the Clipboard in various formats (see RichView Clipboard Functions Overview)

In editor you can:

•	delete selection (DeleteSelection);

•	select the current word or line;

•	cut selection to the Clipboard (CutDef);

Note: All methods introduced in RichView which can change visual appearance require calling Invalidate or Refresh after them.

Note: All methods working with selection must be called only when the document is formatted.

See also...

Searching and replacing


Clipboard
 TRichView Reference | Overview

 RichView Clipboard Functions Overview

TCustomRichView and its descendants can copy information to the Clipboard as plain (ANSI and Unicode) text, image, RTF and RVF, and your own custom formats.

RichViewEdit can paste information from the Clipboard as text (ANSI and Unicode), image, RTF, and RVF (and your own formats).

Copying

The main method for copying to the Clipboard is CopyDef. It can copy selection in one or more formats.

This method copies data in formats specified in RichView.Options:

Option	Meaning
rvoAutoCopyText	if set, CopyDef copies selection as ANSI text
rvoAutoCopyImage	if set, CopyDef can copy selected image to clipboard
rvoAutoCopyUnicodeText	if set, CopyDef copies selection as Unicode text
rvoAutoCopyRTF	if set, CopyDef copies selection as RTF (Rich Text Format)
rvoAutoCopyRVF	if set, CopyDef copies selection as RVF
CopyDef is called automatically when the user presses  Ctrl + Insert  or  Ctrl + C .

You can also use methods for copying:

•	Copy – copies selection to the Clipboard in all formats;

•	CopyTextA – copies the selection as ANSI text;

•	CopyTextW – copies selection as Unicode text

•	CopyImage – if there is a selected image, this method copies it to the Clipboard;

•	CopyRVF – copies selection in RVF format. This format has name 'RichView Format' and consist of two parts: <Size of RVF><RVF> where <Size of RVF> is 4-byte integer value (number of bytes in <RVF>), <RVF> is RVF data (see: About RVF, RVF Specification)

•	CopyRTF – copies selection as RTF (Rich Text Format).

SelectionExists method answers to the question "does the selection contain some data (not empty)?"

OnCopy event allows copying in your own formats.

Pasting

TRichView cannot paste. All these methods are methods of TRichViewEdit.

Pasting:

•	PasteBitmap – pastes bitmap from the Clipboard, if available;

•	PasteMetafile – pastes metafile from the Clipboard, if available;

•	PasteGraphicFile – pastes graphic file(s) the Clipboard, if available;

•	PasteText – pastes text from the Clipboard, if available;

•	PasteRVF – pastes RVF from the Clipboard, if available;

•	PasteRTF – pastes RTF from the Clipboard, if available;

•	Paste – tries to paste as RVF; if can't – as RTF, if can't – as text; if can't – as graphic file(s), if can't – as bitmap; if can't – as metafile.This method is called automatically when user press  Ctrl + V  or  Shift + Insert .

Testing is the Clipboard has the specific format:

•	CanPaste – "does the Clipboard contain any format what can be pasted in RichViewEdit?"

•	CanPasteRVF – "does the Clipboard contain RVF?"

•	CanPasteRTF – "does the Clipboard contain RTF?"

OnPaste event allows to override the default pasting procedure. For example, you can paste data in different format, or you can allow pasting only some specific formats (for example, only a plain text).

Cutting

RichViewEdit.CutDef copies the selection (like CopyDef) and then deletes it (like DeleteSelection). This method is called automatically when user presses  Ctrl + X  or  Shift + Delete .

Windows messages

RichView processes WM_COPY message, RichViewEdit also processes WM_PASTE and WM_CUT.

See also...

Drag&drop


Searching and Replacing
 TRichView Reference | Overview

Searching and Replacing in RichView and RichViewEdit

function TRichView.SearchText(s: String; SrchOptions: TRVSearchOptions): Boolean;

type

  TRVSearchOption = (rvsroMatchCase, rvsroDown, rvsroWholeWord, rvsroFromStart);

  TRVSearchOptions = set of TRVSearchOption;

function TRichViewEdit.SearchText(s: String; SrchOptions: TRVESearchOptions): Boolean;

type

  TRVESearchOption = (rvseoMatchCase, rvseoDown, rvseoWholeWord);

  TRVESearchOptions = set of TRVESearchOption;

These methods search for the substring s. If found, they select it an make it visible (scroll the window to it).

The methods of RichView start searching from the current selection (if exists) or from the first (or the last, when searching up) visible item. If rvsroFromStart is included in SrchOptions, the methods start searching from the beginning (or the end, when searching up) of the document.

The methods of RichViewEdit start searching from the caret position.

There is a special unit RVMisc.pas containing the functions to convert options of search dialogs:

function GetRVSearchOptions(fo: TFindOptions): TRVSearchOptions;

function GetRVESearchOptions(fo: TFindOptions):TRVESearchOptions;

It's easy to implement replacing of text in editor. SearchText selects the old substring, InsertText replaces the selected string with the new one.

 Unicode note: ANSI and Unicode versions of these methods are available (SearchTextA and SearchTextW).


Obtaining Items
 TRichView Reference | Overview

Reading Information about Items of RichView

There are two groups of methods that can be used to obtain information about items of RichView:

•	Get***Info methods, introduced in RichView, can be used to get information about any item;

•	GetCurrent***Info methods of RichViewEdit, return information about the "current" (at the caret position) item.

GetCurrent***Info methods  are equivalent to Get***Info(CurItemNo,...). But there is one important exception: when using tables, GetCurrent***Info methods return information about the item at the position of caret regardless its location (in root editor or in cell inplace editor).

Read-only property RichView.ItemCount returns the number of items.

function RichView.GetItemStyle(ItemNo: Integer): Integer;

This method returns style (type) of item with the specified index.

If the returned value>=0 then this is a text item and the returned value is an index in the collection of text styles (RichView.Style.TextStyles).

If the returned value <0 then this is a special item. Negative value could be equal to one of the following constants:

Constant	Value	Meaning
rvsBreak	-1	horizontal line
rvsPicture	-3	picture
rvsHotspot	-4	hotspot
rvsComponent	-5	Delphi control
rvsBullet	-6	bullet
rvsHotImage	-10	hot-picture
rvsListMarker	-11	list marker (bullet or numbering of paragraphs)
rvsTab	-12	tabulator
rvsTable	-60	table
See also: rvsXXX constants)

When you know a type of item you can get further information about it with the methods (Get***Info methods):

•	GetBreakInfo,GetBulletInfo, GetHotspotInfo, GetPictureInfo, GetControlInfo, GetTextInfo.

•	For item of any type your can get additional property: GetItemExtraIntProperty and GetItemExtraStrProperty.

•	For item of any type your can get "tag" (GetItemTag), "checkpoint" (GetItemCheckpoint)

•	For any item you can get information about its paragraph: (GetItemPara, IsParaStart, IsFromNewLine).

•	For any item you can get its text (text for text item, name for non-text item) (GetItemText)

•	For any item you can get object representing it in a document (GetItem, usually used for tables)

In editor you can use the methods above or GetCurrentBreakInfo, GetCurrentBulletInfo, GetCurrentHotspotInfo, GetCurrentPictureInfo, GetCurrentControlInfo, GetCurrentTextInfo (GetCurrent***Info methods), and GetCurrentTag, GetCurrentCheckpoint, GetCurrentItemText.

The arguments of these methods are similar to the arguments of Add***Tag methods for appending items.

It should be noted that these methods return references to pictures, controls, and tag strings (if there is tags-are-PChars mode) owned by RichView, not to their copy. Please use them wisely. For example, you can draw something on the returned picture but you should not destroy it. The preferred way to modify items of RichView is using Set***Info (or Set***InfoEd for editor).

Table in the position of caret (or top-level table containing caret) can be obtained with the method GetCurrentItemEx.


Modifying Items
 TRichView Reference | Overview

Modifying RichView Items

There are several groups of methods for modifying content of RichView:

•	Set***Info methods, introduced in TRichView (viewer-style methods)

•	Set***InfoEd methods of RichViewEdit (editor-style methods)

•	SetCurrent***Info methods of RichViewEdit – the same as Set***InfoEd but work with the "current" (in the caret position) item.

SetCurrent***Info methods are equivalent to Set***InfoEd(CurItemNo,...) But there is one important exception – when using tables, SetCurrent***Info methods modify item in the position of caret regardless its location (in the root editor or in cell inplace editor).

You cannot change a type of item (except for conversion pictures to hot-pictures and vice versa)

First, you need to know a type of item. You can use RichView.GetItemStyle(ItemNo). Or you can use CurItemStyle property of RichViewEdit for the item in the position of caret.

Next, you usually need to get information about the given item.

Finally, you can modify it.

Set***Info methods

The arguments of these methods are similar to the arguments of Add*** methods.

For the specified items you can use

•	·SetBreakInfo, SetBulletInfo, SetHotspotInfo (call Invalidate to repaint RichView after them, reformatting is not necessary)

•	·SetPictureInfo, SetControlInfo return Boolean value: "reformatting is necessary?" (call Invalidate to repaint RichView after it, reformatting is not necessary if new picture or control has the same size).

You can also use:

•	SetItemTag method to change tags of items,

•	SetCheckpointInfo to change checkpoints of items,

•	SetItemExtraIntProperty to change values of additional integer properties,

•	SetItemExtraStrProperty to change values of additional integer properties,

•	SetItemText to change item text (visible text for text items, names for non-text items).

Please read the topic about "tags" if you want to change tags of items.

The limitations of this version are:

•	you can't change ImageList of bullets and hotspots;

•	you can't replace control with the different one;

It is not recommended to use these methods in editor, see Viewer vs Editor

Set***InfoEd methods (editor)

The same set of methods as Set***Info methods, with the same arguments, but they are editor-style methods.

SetBreakInfoEd, SetBulletInfoEd, SetHotspotInfoEd, SetPictureInfoEd, SetControlInfoEd;

also SetItemTagEd, SetCheckpointInfoEd, SetItemTextEd, SetItemExtraIntPropertyEd, SetItemExtraStrPropertyEd

SetCurrent***Info methods (editor)

The same as Set***InfoEd methods, but they work with the current (in position of caret) item.

SetCurrentBreakInfo, SetCurrentBulletInfo, SetCurrentHotspotInfo, SetCurrentPictureInfo, SetCurrentControlInfo,

also SetCurrentTag, SetCurrentCheckpointInfo, SetCurrentItemText, SetCurrentItemExtraIntProperty, SetCurrentItemExtraStrProperty.

Additional methods for controls

There are some special methods for resizing inserted controls in editor.

procedure ResizeControl(ItemNo, NewWidth, NewHeight: Integer);

procedure ResizeCurrentControl(NewWidth, NewHeight: Integer);

This is the preferred way to change size of the control. These methods reformat the affected part of document and repaint it.

If your control can sometimes change its size or move itself, you need to call

procedure AdjustControlPlacement(ItemNo: Integer);

procedure AdjustControlPlacement2(Control: TControl);

after such actions. These methods restore the correct position of the control and make all necessary reformatting and repainting if the control was resized.


RichViewEdit: Inserting Items in Position of Caret
 TRichView Reference | Overview

RichViewEdit: 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(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: Integer): 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.


Undo and Redo
 TRichView Reference | Overview

Undo/Redo in RichViewEdit

(Introduced in version 1.3)

All methods for document editing that introduced in editor (TRichViewEdit) can be undone/redone (see editor-style methods).

All methods for document modification that introduced in TRichView can't be undone/redone (see viewer-style methods). If you wish to modify document with these methods, you must clear undo buffer before.

All methods and properties described in this topic are methods and properties of TRichViewEdit.

property UndoLimit: Integer

Property UndoLimit sets the capacity of undo buffer. It can be used to disable undo/redo feature.

Basic undo/redo

Undo/redo is available in editor even without any effort from your side.

User can undo the last operation by pressing  Ctrl + Z  or  Alt + Backspace .

User can redo the last undone operation by pressing  Shift + Ctrl + Z  or  Shift + Alt + Backspace .

Undo/redo buffers will be cleared automatically when you call Clear method, or when you use methods for loading documents (which call Clear inside).

You can clear undo and redo buffer yourself using method ClearUndo.

Implementing menu/toolbar buttons for undo/redo

You can undo/redo operations from the application code, using methods Undo and Redo.

You can change enabled/disabled state of menu items or buttons comparing the returned values of functions UndoAction and RedoAction with rvutNone (rvutNone – menu for undo/redo should be disabled; other values – enabled).

Call these methods inside OnChange event.

You can modify caption/hint of menu item or button to display the name of action that will be undone/redone next. A value identifying this undo/redo action can be obtained using UndoAction/RedoAction.

There are no predefined names for standard undo/redo actions. The Editor demo (Demos\Delphi\Editors\Editor 1\) has the suggested names of actions in RVUndoStr.pas.

rvutCustom constant is a special case, see below. For this value, use UndoName/RedoName methods.

Grouping operations for undo

You can set the mode so that all subsequent operations will be considered by the editor as a whole, and they will be undone (and redone) in one step.

First, you need to give name to this undo action. Name can be standard (not a name really, but a type of undo action) or custom.

Use BeginUndoGroup to give a standard name, and BeginUndoCustomGroup to give a custom name.

Next, you need to call SetUndoGroupMode.

procedure TRichViewEdit.BeginUndoGroup(UndoType: TRVUndoType);

– begins a new undo action. It must be followed by SetUndoGroupMode(True) ... SetUndoGroupMode(False).

UndoType can be any value of type TRVUndoType, except for rvutNone and rvutCustom.
This value will be returned by UndoAction/RedoAction when undo/redo.

procedure TRichViewEdit.BeginUndoCustomGroup(const Name: String);

– the same as BeginUndoGroup, but allows to set your own name for the undo action. The undo action will have type = rvutCustom.

Name of it will be returned by UndoName/RedoName.

procedure TRichViewEdit.SetUndoGroupMode(GroupUndo: Boolean);

– sets mode where all subsequent actions will be undone and redone as one. It must be preceded by either BeginUndoGroup or BeginUndoCustomGroup. Typing can not be grouped. Operations in different cell inplace editors cannot be grouped.

These methods must be called for the editor where these operations are performed (usually TopLevelEditor)

Example (inserting picture and resizing it 100x100):

  MyRichViewEdit.TopLevelEditor.BeginUndoGroup(rvutInsert);

  MyRichViewEdit.TopLevelEditor.SetUndoGroupMode(True);

  try

    if MyRichViewEdit.InsertPicture(...) then begin

      MyRichViewEdit.SetCurrentItemExtraIntProperty(

        rvepImageHeight, 100, True);

      MyRichViewEdit.SetCurrentItemExtraIntProperty(

        rvepImageWidth, 100, True);

  finally

    MyRichViewEdit.TopLevelEditor.SetUndoGroupMode(False);

  end;

Each call of SetUndoGroupMode(True) should be followed by exactly one call of SetUndoGroupMode(False).

Calls can be nested.

See also...

Methods introduced in TRichView and undo: see Viewer vs Editor


Drag and Drop
 TRichView Reference | Overview

Drag&Drop in TRichView

You can drag data from TRichView or TRichViewEdit. You can drop data to TRichViewEdit.

Drag&drop is possible not only inside the same editor, but between different controls and even between different applications.

For example, you can drop files from Windows Explorer, hyperlinks, text and images from Internet Explorer or Word.

Drag&drop feature requires Delphi 3 or newer, or C++Builder 3 or newer (it is disabled for Delphi 2 and C++Builder 1).

Dragging from TRichView (or TRichViewEdit)

TRichView provides data in the following formats:

•	RichView Format ('RichView Format')

•	RTF ('Rich Text Format')

•	ANSI text (CF_TEXT)

•	Unicode text (CF_UNICODETEXT)

•	bitmap (CF_BITMAP), if TBitmap picture is selected

•	metafile (CF_ENHMETAFILE), if TMetafile picture is selected.

You can disallow dragging from the given TRichView by including rvoDisallowDrag in the Options property.

TRichView cannot initialize dragging of inserted controls. If you want to drag them, use BeginOleDrag method.

Dragging to TRichViewEdit

AcceptDragDropFormat lists formats that can be accepted.

By default all formats are accepted except for URL (because it requires processing in OnReadHyperlink)

Dropped object can contain data in multiple formats. The priority is: RVF, then RTF, then URL, then text, then bitmap, then metafile, then files.

If the current text style is Unicode, Unicode text format has higher priority than ANSI text format, and vice versa.

The following events may occur:

•	OnReadHyperlink;

•	OnDropFiles.

You can customize drag&drop process using the following low level events:

•	OnOleDragEnter;

•	OnOleDragOver;

•	OnOleDragLeave;

•	OnOleDrop.

See also...

Clipboard


Animated Images
 TRichView Reference | Overview

Animated Images in TRichView

Overview

TRichView can animate inserted images.

AnimationMode property defines when animation starts. By default, AnimationMode=rvaniManualStart.

rvaniManualStart is used by default because rvaniOnFormat may cause problems in some existing applications (created before implementing this feature), because animation must be stopped when you call viewer-style methods like DeleteItems. If you simply load and edit documents, set this mode to rvaniOnFormat.

Methods:

•	StartAnimation starts all animations;

•	StopAnimation stops all animations;

•	ResetAnimation rewinds all animations to the first frame.

Supported Animations

1.	TGifImage included in Delphi 2007, 2009 or newer

Include RVGifAnimate2007 unit in your project to enable this animation.

2.	TGifImage by Anders Melander

Downloads:

•	http://www.torry.net/vcl/graphics/gif/gifimage.exe (original);

•	http://www.trichview.com/resources/thirdparty/gifimage.zip (update, necessary).

Include RVGifAnimate unit in your project to enable this animation.

3.	RVJvGifAnimate for TJvGifImage from JEDI's JVCL

Dowloads: http://jvcl.sourceforge.net.

4.	TBitmap

Bitmap is sliced into animation frames (rvepImageWidth x rvepImageHeight) arranged in rows and columns. Animation is enabled if you set nonzero rvepAnimationInterval (animation delay in 1/100 of second), see TRVExtraItemProperty type. If one of rvepImageWidth and rvepImageHeight is not defined (zero), frame width/height is assumed to be equal to the image width/height. If both of them are not defined, animation is not played.


Saving and Loading
 TRichView Reference | Overview

RichView Methods for Saving and Loading

RichView has the following methods for export:

•	SaveHTML, SaveHTMLEx: saving HTML files (also SaveHTMLToStream, SaveHTMLToStreamEx)

•	SaveText: saving plain ANSI text in file; SaveTextW: saving plain Unicode text;
SaveTextToStream, SaveTextToStreamW – the same for streams (can save the whole document or only selection);
SaveRTF,SaveRTFToStream – exporting the whole document or the selected part to file or stream as RTF (Rich Text Format);

•	SaveRVF,SaveRVFToStream – saving the whole document or the selected part to RVF (RichView Format) file or stream;

RichView has the following methods for import:

•	LoadText: reading plain ANSI text;
LoadTextW: reading plain Unicode text;

•	LoadTextFromStream, LoadTexFromStreamtW - the same for streams instead of files;

•	LoadRTF, LoadRTFFromStream: reading RTF (Rich Text Format) file or stream.

•	LoadRVF, LoadRVFFromStream: reading RVF (RichView Format) file or stream;

See also: InsertRVFFromStream, AppendRVFFromStream.

Note: All methods for reading contents, introduced in RichView, are  viewer-style methods.

RichViewEdit has the following additional methods for import (insertion):

•	InsertRVFFromFileEd, InsertRVFFromStreamEd – like InsertRVFFromFile/InsertRVFFromStream, but editor-style methods.

•	InsertRTFFromFileEd, InsertRTFFromStreamEd – inserting RTF (Rich Text Format) file or stream.

•	InsertTextFromFile  – editor-style method;
InsertOEMTextFromFile – the same method for files in DOS code page;
InsertTextFromFileW – the same method for Unicode files.

There are also method for pasting data from the Clipboard.

Events on export:

•	HTML: OnHTMLSaveImage, OnSaveImage2, OnSaveComponentToFile, OnSaveHTMLExtra, OnSaveItemToFile, OnSaveParaToHTML, OnWriteHyperlink.

•	RTF: OnSaveComponentToFile, OnSaveRTFExtra, OnSaveItemToFile, OnWriteHyperlink.

•	Text: OnSaveComponentToFile, OnSaveItemToFile

Events on import

•	RTF: OnImportPicture, OnReadHyperlink

See also...

Saving HTML

Reading/writing RVF

Export of tables

Unicode in RichView


RVF (RichView Format)
 TRichView Reference | Overview

RichView Format (RVF) Overview

What is RVF?

RVF (RichView Format) is a file format specially designed for saving/loading TRichView documents. It is quite simple and compact format. It can be text file or binary file (defined by RichView.RVFOptions).

This format is used:

•	in TDBRichView, TDBRichViewEdit to save their contents to binary fields;

•	RVF can be copied to the Clipboard; editor can paste RVF;

•	data can be dragged&dropped as RVF;

•	you can load/save RVF with the methods: LoadRVFFromStream, InsertRVFFromStream,  AppendRVFFromStream, LoadRVF, SaveRVFToStream, SaveRVF.

All RichVew document features can be saved in RVF (including text, images, bullets, hotspots, controls, checkpoints, tables). Collections of text, paragraph, list styles, margins and background can be saved optionally (see below).

The main things you need to know about RVF

•	main settings affecting RVF saving and loading can be changed in the TRichView component editor;

•	in order to load bullets, hotspots and list levels with imagelist from RVF you need to process OnRVFImageListNeeded event;

•	you can save pictures and controls in binary mode or text mode (binary mode is much more efficient and compact);

•	you can save pictures and controls in RVF, or create them on request when loading;

•	if you load pictures and controls in RVF you need to register them with RegisterClasses procedure (you do not need to register TBitmap, TMetafile, TIcon and TJpegImage)

•	formatting of text and paragraph (i.e. styles) is saved in RVF documents optionally, if rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions.

RVF and Image Lists

RichView can save and load all document content itself, but there is an exception: bullets, hotspots and list markers having imagelist picture in list levels.

When loading, RichView needs to know which ImageList to use for the given bullet or hotspot. It asks the application about it by calling OnRVFImageListNeeded event. You need to process this event if you want to load bullets and hotspots.

When saving, RichView stores Tag properties of ImageList with bullet or hotspot. When reading, RichView calls OnRVFImageListNeeded event and pass this value to it.

Example

If you have two ImageLists (ImageList1 and ImageList2) that you use for bullets in MyRichView, you can:

•	set ImageList1.Tag to 1, set ImageList2.Tag to 2,

•	process MyRichView.OnImageListNeeded event::

procedure TMyForm.MyRichViewRVFImageListNeeded(

  Sender: TCustomRichView; ImageListTag: Integer;

  var il: TCustomImageList);

begin

  case ImageListTag of

    1:

      il := ImageList1;

    2:

      il := ImageList2;

  end;

end;

DO NOT CONFUSE IMAGELIST.TAG WITH RICHVIEW ITEMS' TAGS. IN THIS CASE RICHVIEW USES TIMAGELIST.TAG PROPERTY.

RichView does not own any ImageList, it never destroys them. It just holds references to them.

If you want to load pictures and/or controls from RVF you need to register them with RegisterClasses procedure (you need not to register TBitmap, TMetafile, TIcon and TJpegImage - they are already registered by RichView)

RVF and Pictures & Controls

You can save full information about pictures and inserted controls in RVF, but you can also use advanced feature: you can save pictures/controls yourself and include in RVF only some "identifiers" that can be used to create pictures/controls when needed (on loading). Two values can be uses as these "identifiers": RichView items tags and names.

These options do not affect loading from RVF. RichView autodetects these modes (binary/text, indices/names of styles).

When loading, you can use OnRVFPictureNeeded and OnRVFPictureNeeded events.

Example:

procedure TMyForm.MyRichViewRVFControlNeeded(
  Sender: TCustomRichView; Name: String; Tag: Integer;

  var ctrl: TControl);

begin

  case Tag of

    1:

      begin

        ctrl := TButton.Create(nil);

        TButton(ctrl).Caption := Name;

      end;

    2:

      begin

        ctrl := TEdit.Create(nil);

        TEdit(ctrl).Text := Name;

      end;

  end;

end;

procedure MyRichViewRVFPictureNeeded(Sender: TCustomRichView;

  Name: String; Tag: Integer; var gr: TGraphic);

begin

  gr := TBitmap.Create(nil);

  TBitmap(gr).LoadFromFile(Name);

end;

As you can see, RichView passes two parameters that can help you to identify your image or control:

•	Tag: Integer – RichView item tag (do not confuse with tag properties of TComponent descendants);

•	Name: String – string that can be associated with any control or picture in RichView.

Options for Saving

When saving RVF, the following options in RichView.RVFOptions affect the result:

Option	Meaning
rvfoSavePicturesBody	• If set, full information about all pictures in RichView are saved in RVF. • If not set, OnRVFPictureNeeded event occurs on loading.
rvfoSaveControlsBody	• If set, full information about all controls in RichView are saved in RVF. • If not set, OnRVFControlNeeded event occurs loading.
rvfoSaveBinary	• If set, all non-text data are saved in RVF as they are (pictures, controls, tables, background, styles, Unicode text). • If not set, all binary data are converted to text (hexadecimal string); RVF becomes a plain text format, like RTF, but file size is increased.
rvfoSaveBack	(since version 1.2) If set, background (color and image) is saved in RVF. This flag affects only saving the whole document; selection is never saved (or copied to the Clipboard) with background. (see rvfoLoadBack below)
rvfoUseStyleNames (almost obsolete)	If set, TRichView saves quoted names of text and paragraph styles instead of their indices (requires Delphi3+) Pluses: • content of file remains synchronized with collections of styles even if you delete or insert new styles; Minuses: • increased file size; • names of styles must be unique; • files become sensitive to changing style names. It's not recommended to use this options together with rvfoSaveTextStyles and rvfoSaveParaStyles.
rvfoSaveTextStyles	If set, collection of text styles associated with this RichView (TextStyles property of the linked TRVStyle component) is saved in RVF. See RVFTextStylesReadMode property.
rvfoSaveParaStyles	If set, collections of paragraph and list styles associated with this RichView  (ParaStyles and ListStyles properties of the linked TRVStyle component)  are saved in RVF. See RVFParaStylesReadMode property.
rvfoSaveLayout	If set, the following properties are stored in RVF: Left-, Right-, Top-, BottomMargin, MinTextWidth, MaxTextWidth, BiDiMode. Layout is saved only when saving the whole document (not selection). (see rvfoLoadLayout below)
rvfoSaveDocProperties	If set, DocProperties and DocParameters are saved in RVF. (see rvfoLoadDocProperties below)
Options for Loading

When loading RVF, the following options in RichView.RVFOptions affect the result:

Option	Meaning
rvfoLoadBack	If not set, RichView ignores background information, saved in RVF. (see rvfoSaveBack above)
rvfoIgnoreUnknownPicFmt	• If set, RichView skips pictures of unknown (unregistered) classes. • if not set, RVF reading methods return False (failure value) if pictures of unknown classes exist in RVF
rvfoIgnoreUnknownCtrls	The same as rvfoIgnoreUnknownPicFmt, but for Controls
rvfoConvLargeImageIdxToZero	• If set, too large (>=Imagelist.Count) image indices for bullets and hotspots are converted to 0. • if not set, RVF reading methods return False (failure value) in such case.
rvfoConvUnknownStylesToZero	• If set, RichView converts too large (>= RichView.Style.TextStyles.Count, or RichView.Style.ParaStyles.Count) style indices to 0. • If not set, RVF reading methods return False (failure value) in such case.
rvfoLoadLayout	If not set, RichView ignores layout information saved in RVF (see rvfoSaveLayout above)
rvfoLoadDocProperties	If set, DocProperties and DocParameters are loaded from RVF (but not by methods for RVF insertion) (see rvfoSaveDocProperties above)
After loading you can check RichView.RVFWarnings property. Depending on RichView.RVFOptions some flags in RichView.RVFWarnings can be errors or warning:

Warning	Meaning
rvfwUnknownPicFmt	Pictures of unknown classes exist in RVF. See rvfoIgnoreUnknownPicFmt.
rvfwUnknownCtrls	Controls of unknown classes exist in RVF. See rvfoIgnoreUnknownCtrls.
rvfwConvLargeImageIdx	Bullets or hotspots with too large image indices exist in RVF. See rvfoConvLargeImageIdxToZero.
rvfwConvUnknownStyles	Text, paragraph or list styles with too large indices exist in RVF. See rvfoConvUnknownStylesToZero.
rvfwConvToUnicode rvfwConvFromUnicode	There was a conversion from ANSI text in RVF file to Unicode in RichView or vice versa. This is a result of loading RVF file with set of styles different from the set which was used when saving. Conversion is performed automatically, without generating errors. For example, in applications compiled in Delphi/C++Builder 2009+, this conversion (from ANSI to Unicode) always occurs when loading RVF files  (with non-Unicode text styles) saved by applications compiled in older version of Delphi/C++Builder
rvfwInvalidPicture	Some pictures were replaced with InvalidPicture.
See also...

RVF Specification

RichView properties:

•	Options,

•	RVFOptions,

•	RVFWarnings.

RichView events:

•	OnRVFImageListNeeded,

•	OnVFControlNeeded,

•	OnRVFPictureNeeded,

•	OnControlAction (ControlAction=rvcaAfterRVFLoad),

•	OnItemAction (ItemAction=rviaInserting and rviaInserted).

RichView methods:

•	LoadRVFFromStream, InsertRVFFromStream, AppendRVFFromStream, LoadRVF,

•	SaveRVFToStream, SaveRVF,

•	Copy, CopyDef, CopyRVF.

RichViewEdit methods:

•	InsertRVFFromStreamEd, InsertRVFFromFileEd,

•	Paste, PasteRVF, CanPasteRVF, CutDef.


Export to HTML
 TRichView Reference | Overview

Export of RichView Content to HTML

Overview

RichView has methods for saving HTML files. There are no methods for reading HTML files in current version (use free addon: TrvHtmlImporter).

RichView saves HTML file and a set of image files.

By default, images are saved as Jpegs (*.jpg).

If you do not want to use TJpegImage class, you can define RVDONOTUSEJPEGIMAGE conditional define when compiling, and images will be saved as bitmaps.

You can specify graphic formats that must not be converted to Jpegs.

Besides, you can save images yourself in custom formats using OnHTMLSaveImage or OnSaveImage2 event (see demo in Demos\Delphi\Assorted\Save HTML\)

There are two ways to save HTML in RichView:

•	saving using <font>, <b>, <i> and similar html tags,

•	saving using CSS (Cascading Style Sheets).

HTML files which were saved with the first way can be read by larger number of programs (including TrvHtmlImporter).

HTML files with CSS retain much more formatting properties of RichView document (they look almost exactly like RichView content when using a capable browser) and have much more elegant and compact HTML code. Such files can be successfully viewed for example with MS Internet Explorer 4+, Netscape Navigator 4+, MS Word 2000+; but when viewed, for example,  with MS Word 97 they lose all formatting. TRVHtmlImporter does not support CSS generally, but it can read HTML with CSS files saved by TRichView.

Saving Using <font> Tags

function RichView.SaveHTML(const FileName,Title,

  ImagesPrefix: String; Options: TRVSaveOptions):Boolean;

FileName – file name.

Title – title of document (tag <title>).

Return value – "saving was successful?"

ImagesPrefix – first part of images file names. For example, if ImagesPrefix='img' then images will be saved as img1.jpg, img2.jpg and so on (or img1.bmp, img2.bmp and so on, see above).

If rvsoOverrideImages in Options then all files with the same names will be overridden. Otherwise, the component will make unique file names for images.

Saved jpegs or bitmaps are not transparent. When converting to jpeg or bitmap, transparent color of icons or metafiles converted to the background color of RichView.

You can change saving of images using OnHTMLSaveImage or  OnSaveImage2 events.

Checkpoints are saved as <a name=RichViewCheckpoint#></a> where # is an index of checkpoint. If rvsoUseCheckpointsNames is in Options, checkpoint name is used instead.

RichView uses Charset property of 0th text style to save language of HTML file (for Delphi 3+). There is also an option to save Unicode (UTF-8) HTML files.

When saving with SaveHTML method, many formatting properties are lost (such as text and paragraph background colors, borders, hover color, all margins/indents, font sizes are converted to 7 available HTML font sizes). Centered and stretched background bitmaps become tiled.

Saving Using CSS

function RichView.SaveHTMLEx(const FileName, Title, ImagesPrefix,

  ExtraStyles, ExternalCSS, CPPrefix: String;

  Options: TRVSaveOptions):Boolean;

This method is not an extension of SaveHTML method – this is a completely different method. It saves HTML using style sheets (CSS). CSS can be saved inside HTML file or this method can place only a reference to external CSS file into this HTML file

External CSS file can be saved using SaveCSS method of RichView.Style:

You can save your style sheet one time and use it for all saved HTML files (if they all use the same collection of styles). This method allows you to reduce size when saving several HTML files with the same text and paragraph styles.

Font families are stored in CSS for the most frequently used fonts. For example, if font name is 'Arial', the string 'Arial', 'Helvetica', sans-serif will be saved.

ExtraStyles is a string that can contain additional styles for your own use. RichView will not use these styles, but you can use them when saving, for example, controls and URLs.

CPPrefix is a first part of name used when saving checkpoint. If CPPrefix='' then RichView uses standard name ('RichViewCheckPoint'). For example, if CPPrefix='label' then checkpoints will be saved as <a name=label#></a> where # is an index of checkpoint. If rvsoUseCheckpointsNames is in Options, checkpoint name is used instead.

Usually you do not need to use advanced parameters and can write:

MyRichView.SaveHTMLEx(MyFileName, MyTitle, MyImagesPrefix,

  '', '', '', []);

Saved HTML looks exactly like RichView with the exceptions:

•	saving centered background pictures instead of stretched;

•	if VShift property of text style >0 then this style saved as superscript, <0 as subscript;

•	all pictures becomes jpegs or bitmaps, so transparency is lost (transparent pixels are replaced with color of picture's paragraph or RichView itself), if you do not use OnHTMLSaveImage or OnSaveImage2 events or if you did not define their formats as html graphic format.

•	only "normal" (not "hot") hotspots' pictures are saved;

•	border styles converted to available set for HTML;

•	negative BorderOffsets can be saved, but browsers understand them as zero offsets;

•	paragraph background offsets and border offsets can't be saved separately; maximal values of these offsets are saved;

•	old browsers (such as Netscape Communicator 4) do not support subscripts/superscripts, partial borders.

SaveHTMLEx saves all text of "Symbol" font as a set of HTML character entities or Unicode codes. For example, the text 'a+b=g' of "Symbol" font (α+β=γ) is saved as '&alpha;+&beta;=&gamma;'

Pros:

•	correct view not only in IE, but also in Opera and Mozilla;

•	correct view on non-Windows platforms

Cons:

•	characters may look slightly different;

•	some exotic characters are lost.

Common for the Both Methods

By default, hypertext links are not saved (saved as a normal text). However, you can save them in the event OnWriteHyperlink.

By default, inserted controls are not saved. However, you can save them in the event OnSaveComponentToFile.

You can save additional information in HTML in the events: OnSaveHTMLExtra, OnSaveParaToHTML.

You can insert HTML codes in text.

You can completely change saving of items of any type in HTML using  OnSaveItemToFile event.

There is a set of methods for saving HTML files to stream: TRichView.SaveHTMLToStream, TRichView.SaveHTMLToStreamEx, TVStyle.SaveCSSToStream.

There is also a possibility to save only part of HTML document (opening part, middle part, closing part) – useful if you use HTML output of RichView only as a part of HTML document.

Known problems:

Numeration of checkpoints starts from 0 in each table cell. So, it's recommended to use checkpoint names as identifiers (add rvsoUseCheckpointsNames in Options).

Some ideas what may be implemented in future

•	to associate HTML tags with text styles (such as <H1>, <B>) and use them when saving HTML file; this method gives very simple compact HTML and almost all browsers will understand it; Though it can look not similar to original RichView document;

•	option to save tag strings (see Tags) as URLs automatically

See also...

•	RichView methods for saving and loading;

•	Export of tables;

•	Typed constants related to HTML export;

•	Example how to save MIME-encoded files (*.eml or *.mht), how to send HTML e-mail using TNMSMTP or TIdSMTP components: http://www.trichview.com/forums/viewtopic.php?t=11.


Unicode in RichView
 TRichView Reference | Overview

Unicode in RichView

Introduction

Unicode is a worldwide character-encoding standard. Unicode simplifies localization of software and improves multilingual text processing. By implementing it in an application, a developer can enable the application with universal data exchange capabilities for global marketing, using a single binary file for every possible character code. Because each Unicode character is 16 bits wide (in UTF-16 encoding), it is possible to have separate values for up to 65,536 characters. Unicode-enabled functions are often referred to as "wide-character" functions.

For Delphi 2009 or newer, Unicode is a default encoding for strings.

Unicode strings are referred here as 'Unicode'

Single-byte strings are referred here as 'ANSI' (for simplicity)

Unicode and ANSI Text in TRichView

Not all strings in TRichView are Unicode strings.

Text in text items can be Unicode or ANSI depending on Unicode property of text style.

Text (item name) of non-text items is always ANSI.

The following text depends on version of Delphi/C++Builder (Unicode for Delphi/C++Builder 2009 or newer, ANSI for older versions):

•	tag strings (in tags-are-PChars mode);

•	extra item properties;

•	names of checkpoints;

•	visible text in labels, numbered sequences, endnotes, footnotes;

•	live spelling interface;

•	text in list markers;

•	hypertext targets (OnReadHyperlink, OnWriteHyperlink);

•	and others.

Main Limitations of the Current Implementation

You must prevent conversion of Unicode to double-byte character set (DBCS) strings, used for representation of characters in Asian languages, because DBCS is not supported by RichView. The only exception (where conversion is ok) is exporting and saving (because in these cases DBCS text will not be used in RichView).

How to Enable Unicode. Using Both ANSI and Unicode

Set Unicode property of text style to True. Important: document must be empty when changing this property. TRichViewEdit initially has one empty string, so it is not completely empty, call Clear before changing this property. The default value of this property is True for Delphi/C++Builder 2009 or newer.

Document can contain both Unicode and ANSI text (in different styles).

So, you can mix ANSI and Unicode text. Of course, you can use only ANSI or only Unicode styles. This is even recommended.

How to Make Unicode Editor (Without ANSI Text)

1.	Set Unicode property to True for all TextStyles in TRVStyle. Important: document must be empty when changing this property. TRichViewEdit initially has one empty string, so it is not completely empty, call Clear before changing this property. The default value of this property is True for Delphi/C++Builder 2009 or newer.

2.	Set RichViewEdit1.RTFReadProperties.UnicodeMode = rvruOnlyUnicode (this is the default value of this property for Delphi/C++Builder 2009 or newer).

3.	Many methods working with text have 3 versions:

•	with TRVUnicodeString parameters (finished with -W, for example SearchTextW);

•	with TRVAnsiString parameters (finished with -A, for example SearchTextA);

•	with String parameters (for example, SearchText).

For Delphi/C++Builder versions prior to 2009, use TRVUnicodeString-methods. For Delphi/C++Builder, you can use either TRVUnicodeString-methods or String-methods. Avoid using TRVAnsiString-methods to prevent conversion between Unicode and ANSI text.

These methods include the following methods of TRichView (methods names without -A and -W are listed):

•	AddNLTag and its versions;

•	AddTextNL;

•	GetItemText;

•	GetSelText;

•	GetWordAt;

•	SearchText;

•	SetItemText.

These methods include the following methods of TRichViewEdit (methods names without -A and -W are listed):

•	GetCurrentItemText;

•	InsertStringTag;

•	InsertText;

•	PasteText;

•	SearchText;

•	SetItemTextEd;

•	SetCurrentItemText.

4.	Existing non-Unicode RVF documents must be converted to Unicode by calling ConvertToUnicode after loading them (see below).

This step is not necessary for Delphi/C++Builder 2009: all text styles in RVF documents saved by applications compiled with older version of Delphi/C++Builder are converted to Unicode automatically.

It's safe to call this procedure for Unicode documents – it will do nothing.

uses CRVData, RVItem, RVUni;

// this code uses some undocumented methods

procedure ConvertRVToUnicode(RVData: TCustomRVData);

var i,r,c, StyleNo: Integer;

    table: TRVTableItemInfo;

begin

  for i := 0 to RVData.ItemCount-1 do begin

    StyleNo := RVData.GetItemStyle(i);

    if StyleNo>=0 then begin

      if not RVData.GetRVStyle.TextStyles[StyleNo].Unicode then begin

        RVData.SetItemTextR(i, RVU_GetRawUnicode(RVData.GetItemTextW(i)));

        Include(RVData.GetItem(i).ItemOptions, rvioUnicode);

      end;

      end

    else if RVData.GetItemStyle(i)=rvsTable then begin

      table := TRVTableItemInfo(RVData.GetItem(i));

      for r := 0 to table.Rows.Count-1 do

        for c := 0 to table.Rows[r].Count-1 do

          if table.Cells[r,c]<>nil then

            ConvertRVToUnicode(table.Cells[r,c].GetRVData);

    end;

  end;

end;

procedure ConvertToUnicode(rv: TCustomRichView);

var i: Integer;

begin

  ConvertRVToUnicode(rv.RVData);

  for i := 0 to rv.Style.TextStyles.Count-1 do

    rv.Style.TextStyles[i].Unicode := True;

end;

Unicode in Delphi/C++Builder 2009 or newer

In the new versions of Delphi/C++Builder, the String type is Unicode by default.

Many properties and parameters in TRichView become Unicode, see "Unicode and ANSI Text in TRichView" above.

Default (initial) values of some properties are changed:

•	Unicode property of text style (from False to True);

•	TRichView.RTFReadProperties.UnicodeMode (from rvruNoUnicode to rvruOnlyUnicode);

•	TRichView.Options (rvoAutoCopyUnicodeText is included, rvoAutoCopyText is excluded).

When saving text styles (in RVF files or Delphi forms) in older versions of Delphi/C++Builder, only non-default value (True) of Unicode property of text style is saved. When saving text styles (in RVF files or Delphi forms) in Delphi/C++Builder 2009+, value of Unicode property is always saved, default or not. The main consequence is the following: when loading forms/RVF files with styles saved by older versions of Delphi/C++Builder in Delphi/C++Builder 2009+, Unicode property of all text styles become True. For RVF files, all text in text items is converted to Unicode automatically.

Because of this change of default value of Unicode property, older projects that use deprecated methods (see "Deprecated Methods (If You Use Unicode)" above) may not work properly when compiled in Delphi/C++Builder 2009 or newer. It is because these methods must not accept ANSI string for Unicode text items. Change them to the proper methods as it is described in "How to Make Unicode Editor (Without ANSI Text)" above.

ANSI text may appear in document when reading RTF files, if TRichView.RTFReadProperties.UnicodeMode<>rvruOnlyUnicode. If you use projects converted from the older version of Delphi/C++Builder, check value of this property.

Import and Export

Text Files

LoadText, LoadTextFromStream load ANSI text files. When loading to Unicode style, they perform conversion from ANSI to Unicode.

LoadTextW, LoadTextFromStreamW load Unicode text files. When loading to non-Unicode style, they perform conversion from Unicode  to ANSI.

Code page used for conversion is based on Charset property of the corresponding style (Charsets of Unicode styles are used only for conversion to/from ANSI).

Note:  you can test file with the function

function RV_TestFileUnicode(const FileName: String): TRVUnicodeTestResult

defined in RVUni.pas.

Return values

•	rvutNo – the file is not Unicode (odd size);

•	rvutYes – the file is most likely Unicode (even size, Unicode byte-order characters at the start or #0 in text (first 500 bytes checked));

•	rvutProbably – the file can contain Unicode (even size);

•	rvutEmpty – the file is empty;

•	rvutError – error opening the file.

You can also use WinAPI function IsTextUnicode performing more advanced tests.

SaveText saves ANSI text file. Unicode strings are converted basing on Style.DefCodePage property.

SaveTextW saves Unicode text file. ANSI strings are converted basing on the corresponding Charsets.

RTF (Rich Text Format)

Methods for RTF saving are able to store Unicode.

Methods for RTF loading and inserting work depending on TRichView.RTFReadProperties.UnicodeMode.

HTML

SaveHTML*** can save ANSI or Unicode (UTF-8) HTML files. In ANSI HTML files, Unicode characters are written as codes (&#NNNN;), so all Unicode characters are preserved, but file size is increased.

Selection, Search and The Clipboard

GetSelTextA returns selection as an ANSI string. Unicode text is converted basing on Style.DefCodePage property.

GetSelTextW returns selection as a Unicode string. ANSI strings are converted basing on corresponding Charsets.

Text searching methods have versions allowing to search for ANSI and for Unicode string: TRichView.SearchTextA/SearchTextW, TRichViewEdit.SearchTextA/SearchTextW. All methods can search both in ANSI and Unicode text items. When comparing ANSI text with Unicode text, SearchText methods use Style.DefCodePage property, SearchText methods use text Charsets.

CopyTextA copies selection as ANSI text. Unicode strings are converted basing on Style.DefCodePage property.

CopyTextW copies selection as Unicode. ANSI strings are converted basing on corresponding Charsets.

None: on NT-based systems (such as Windows XP), the Clipboard is able to convert Unicode text to ANSI  text and vice versa. So, if you copy in one of these formats, both formats are available for pasting.

Copy and CopyDef are able to copy Unicode (Option-rvoAutoCopyUnicodeText)

Editing Operations

If pasting text using Paste method, and both ANSI and Unicode texts are available in Clipboard, then the choice is made depending on the current text style  (Unicode or not).

PasteTextA pastes ANSI text, PasteTextW pastes Unicode text.

InsertTextFromFile: the file must be ANSI (converted, if needed)

InsertOEMTextFromFile: the file must be OEM (converted, if needed)

InsertTextFromFileW: the file must be Unicode (converted, if needed)

InsertText, InsertStringTag add Unicode string in Delphi/C++Builder 2009+ and ANSI string in older versions of Delphi/C++Builder.

InsertTextA, InsertStringATag add ANSI string  (converted, if needed)

InsertTextW, InsertStringWTag add Unicode string (converted, if needed)

RVF (RichView Format)

Applications compiled with older versions of RichView (version less than 1.2) will not be able to load RVF files with Unicode.

RVF files will be loaded correctly even if Unicode flags in text styles are mismatched (saved with different RVStyle then loaded), conversions will be performed if required (for example, this conversion will occur when loading old RVF files in applications compiled in Delphi/C++Builder 2009+). There are two RVF Warnings: rvfwConvToUnicode and rvfwConvFromUnicode, which indicate if any conversion took place.

TRichView v11 introduces a new change in RVF files allowing to store String properties as Unicode. RVF files saved in Delphi/C++Builder 2009+ are saved as RVF version 1.3.1, RVF files saved in the older versions of Delphi/C++Builder are saved as RVF version 1.3.

See also...

•	TRVStyle.DefUnicodeStyle;

•	Example how to load UTF-8 files.


Bidirectional text
 TRichView Reference | Overview

Bidirectional text in RichView

Bidirectional mode determines the reading order of the text, order of items in lines, and placement of vertical scrollbar.

The support for bidirectional text (Arabic or Hebrew) is turned off by default. In order to turn it on, set BiDiMode property of TRichView either to rvbdLeftToRight or to rvbdRightToLeft.

BiDiMode of document can be overridden by BiDiMode of paragraph, BiDiMode of paragraph can be overridden by BiDiMode of text item.

Mixed right-to-left and left-to-right text is supported. (even inside the same text item).

Attaching of adjacent characters (common for Arabic languages) is supported too.

Bullets and numbering of paragraphs take BiDiMode into account: for right-to-left paragraphs, list markers are positioned to the right.

Tab stops support BiDiMode too: they are inverted (including tab alignments) for right-to-left paragraphs.

Limitations

•	BiDiMode works in Windows versions supporting right-to-left languages (for example, on Win2000 and WinXP with RTL support installed, see Control Panel, Regional and Language Options, tab Languages, Install files for complex scripts and right-to-left languages). In all other versions of Windows, right-to-left text will be displayed left-to-right.

•	BiDiMode mode for Unicode text works only under WinNT/2000.

•	Justify alignment does not work if BiDiMode support is enabled.

•	Editing text in BiDiMode works properly only if all characters in text have glyphs in the their font.

Demo project

Demos\Delphi\Assorted\International\RTL\

Demos\CBuilder\Assorted\International\RTL\


Live spelling check
 TRichView Reference | Overview

Live spelling check

Live spelling check marks misspelled words with special underlines (wavy line of TRVStyle.LiveSpellingColor color).

Spelling check is executed in background thread.

Starting and finishing spelling check

In TRichView:

Spelling check is started by calling StartLiveSpelling method.

In TRichViewEdit:

Spelling check is started:

•	by calling StartLiveSpelling method or

•	when user modifies document or when any editing-style method is called (if LiveSpellingMode=rvlspOnChange)

Spelling check is stopped by ClearLiveSpellingResults method.

Checking Words

RichView Package does not have its own spelling check engine and dictionaries. You need to use third-party components.

Currently the following components are supported:

1.	Addict3 by Addictive Software (shareware Delphi component)

2.	EDSSpell 7.0 by OneDomain, Inc (shareware Delphi component)

3.	VSSpell 8.0 by ComponentOne LLC (shareware ActiveX)

4.	VSSpell 3.0 by Visual Components, Inc (shipped with older versions of Delphi, ActiveX)

5.	ASpell by Kevin Atkinson (DLL, license: LGPL)

6.	LS Speller by Luzius Schneider (ISpell + MS Office (CSAPI) spell checkers, freeware)

7.	HunSpell ( C++ library under GPL/LGPL/MPL tri-license)

Let me know if you are interested in supporting other spelling checkers.

Files required for these spell-checkers can be downloaded from Resources for RichView web page.

The live spelling thread calls OnSpellingCheck event for each word in the document.

Word is defined as a run of characters between delimiters. Additionally, '&' is treated as a delimiter. Apostrophes are processed specially, see RichViewApostropheInWord global variable.

Single quote character is processed specially: if it's inside word, it's treated as a part of word (for example "it's" or "I'll"). If it's to the left/right, it's treated as a delimiter.

URLs are ignored, see RVIsCustomURL function.

Making Corrections

Call LiveSpellingValidateWord if user added word in a custom dictionary or ignore list.

Call GetCurrentMisspelling to get or to correct the current misspelled word. For example, you can use this method to implement popup menu:

1.	when context menu is about to be shown, use GetCurrentMisspelling to get misspelled word in the caret position and to generate suggestions;

2.	when the user has chosen a suggestion, use GetCurrentMisspelling again to select the misspelled word and use InsertText to insert replacement.

Alternatively, misspelled word can be selected on the step 1 (before displaying popup menu).

Memory Usage

Live spelling support adds 8 extra bytes per each item. If you do not use it, you can compile your application with RVDONOTUSELIVESPELL compiler define (see RV_Defs.inc file)


Viewer vs Editor
 TRichView Reference | Overview

Viewer vs Editor

Methods of TRichView

TRichView has the following 3 groups of methods for modifying documents:

1.	appending items to the end of the document (may be from file or stream);

2.	modifying item with the given index;

3.	loading files and streams.

Examples of the first group are: AddNL, AddPictureEx, LoadRTF.

Examples of the second group are SetPictureInfo, SetItemText.

Examples of the third group are: LoadRVF, LoadRTFFromStream.

All these methods have the following characteristics:

•	they do not require that the document is formatted (formatting is a preparing document for displaying)

•	even if the document was formatted before calling such method, it is not formatted after.

You need to call Format (or FormatTail) to display documents created or modified with such methods.

Table cells also have such methods.

Methods of TRichViewEdit

TRichViewEdit has the following groups of methods for modifying documents:

1.	all methods of TRichView;

2.	methods for inserting items in the position of caret
(Insert*** methods, such as InsertText, InsertPicture);

3.	methods for modifying the item at the position of caret
(SetCurrent*** methods, such as SetCurrentPictureInfo, SetCurrentItemText);

4.	extended set of methods for modifying item with the given index
(Set***Ed methods, such as SetPictureInfoEd, SetItemTextEd).

Methods of the group 1 are referred as viewer-style methods, methods of the groups 2-4 are editor-style methods.

All these methods (except for the methods of the group 1, inherited from TRichView) have the following characteristics:

•	document must be formatted before calling such methods;

•	these methods automatically reformat the affected area of documents;

•	if the document is read-only they do nothing; they also respect protection of text and paragraphs;

•	they call OnChange event;

•	modifications can be undone and redone.

In editor, the main application of the methods of the group 1 is generating new documents from scratch (after calling Clear).

The main application of other methods is performing user commands. They should not be used for generation of new document (because each such method updates documents, it can cause undesirable flicker, and they are much slower).

Important: You must not mix methods of group 1 and methods of groups 2-4! Methods inherited from TRichView do not update undo and redo buffers, and results of undo and redo commands will be unpredictable!

The only applications of methods of the group 1 is generating a new document, in the sequence:

1.	Clear; (this method also clears undo and redo buffers);

2.	One or several calls of methods of the group 1;

3.	Format (after the document has been formatted, you can apply methods of the groups 2-4)

See also: Undo in tables


Controls - Documents - Items
 TRichView Reference | Overview

Controls, Documents, Items

There are three main families of classes.

1. VCL controls, descendants of TCustomRichView.

See the diagram of class hierarchy.

The main visual controls are: TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit.

2. Documents, objects containing items, descendants of TCustomRVFormattedData.

Documents are objects, but not components.

Each RichView or RichViewEdit has such document accessible as RVData property.

They have the most of methods of RichView controls. For example, calling

MyRichView.AddNL('text',0,0)

is equivalent to

MyRichView.RVData.AddNL('text',0,0)

Tables have cells. Cells are also documents containing items, cells are descendants of TCustomRVFormattedData.

3. Items of documents, descendants of TCustomRVItemInfo.

Items are objects, but not components.

Items are usually hidden from programmers. They can be added and modified by methods of controls or document objects. The only exception is tables (TRVTableItemInfo).

Documents contain items, some items (tables) can contain documents (cells).

There is an important case: cell editing. When editing cell, RichViewEdit creates a special editor (also TRichViewEdit) on the top of the cell. While editing, all items in the cell are moved in this editor. When editing is finished, items are moved back to the cell.

At any time, object containing cell items is accessible as cell.GetRVData (if cell is not edited, it is the cell itself; if edited, it is RVData of its inplace editor).

Example 1

This example shows that the same procedure can be applied to the main document and table cells.

This example converts all text to upper case

procedure AllUpperCase(RVData: TCustomRVData);

var i,r,c: Integer;

    s: String;

    table: TRVTableItemInfo;

begin

for i := 0 to RVData.ItemCount-1 do

  if RVData.GetItemStyle(i)>=0 then begin // this is a text item

    s := RVData.GetItemText(i);

    s := AnsiUpperCase(s);

    RVData.SetItemText(i,s);

    end

  else if RVData.GetItemStyle(i)=rvsTable then begin

    table := TRVTableItemInfo(RVData.GetItem(i));

    for r := 0 to table.RowCount-1 do

      for c := 0 to table.ColCount-1 do

        if table.Cells[r,c]<>nil then

          AllUpperCase(table.Cells[r,c].GetRVData);

  end;

end;

Call:

AllUpperCase(MyRichView.RVData);

MyRichView.Format;

Example 2

The same task, using different methods

// This procedure will be called for each RichView item

procedure TForm1.EnumItemsProc(RVData: TCustomRVData;

  ItemNo: Integer;  var UserData1: Integer;

  const UserData2: String; var ContinueEnum: Boolean);

var s: String;

begin

  if RVData.GetItemStyle(ItemNo)>=0 then begin

    s := RVData.GetItemText(i);

    s := AnsiUpperCase(s);

    RVData.SetItemText(ItemNo,s);

  end;

  ContinueEnum := True;

end;

Call:

var v: Integer;

v := 0;

// RVData.EnumItems calls the specified procedure (EnumItems)

// for each items in RVData and its subdocuments (table cells)

// The second and the third parameters are user defined data,

// they will be passed in the procedure as UserData1 and UserData2

MyRichView.RVData.EnumItems(EnumItemsProc, v, '');

MyRichView.Format;

The advantage of using RVData.EnumItems is more clear and compact code.

The disadvantage: you cannot use it if you need to add or delete items.


Valid Documents
 TRichView Reference | Overview

Valid Documents

There are some limitations on document structure.

Internally, each document item has properties:

•	index of paragraph style

•	"this item starts a paragraph" flag

•	"this item starts a line inside a paragraph" flag

Not all combinations are acceptable.

All operations in editor always create a valid document (providing that it was valid before the operation).

But some operations in viewer can create invalid documents (especially DeleteItems)

Rules of Valid Documents:

1.	All items in paragraphs must have the same index of paragraph style (in the most of cases, RichView provides this. It's possible to create invalid documents by incorrect using of DeleteItems and SetAddParagraphMode)

2.	The first item (in document or table cell) must start a paragraph.

3.	Full-line items (breaks and tables) must start a new paragraph.

4.	Items after full-line items must start a new paragraph.

5.	Table cells must contain at least one item (by default they contain one empty text item).

6.	List markers must start a new paragraph.

7.	Paragraph after marker must contain at least one item (may be an empty text item). Documents where next item after marker starts a new paragraph (or a line) are incorrect

8.	Empty text items can be only in empty paragraphs (the only item in paragraph, or the only item after list marker)

RichViewActions includes RVNormalize unit containing NormalizeRichView procedure. This procedure can fix the most of document problems.


Custom drawing
 TRichView Reference | Overview

Custom Drawing

There are the following events for custom drawing.

TCustomRichView

•	OnPaint – drawing over RichView document.

TRVPrint

•	OnPagePrepaint – drawing on page under the document;

•	OnPagePostpaint – drawing on page over the document;

•	OnPrintComponent – printing components.

TRVStyle

•	OnDrawCheckpoint – drawing checkpoint;

•	OnDrawPageBreak – drawing page break;

•	OnDrawParaBack – drawing background of paragraph;

•	OnDrawTextBack – drawing background of text;

•	OnApplyStyle – applying text style to Canvas;

•	OnApplyStyleColor – applying the text style color to Canvas;

•	OnDrawStyleText – drawing text of the given style;

•	OnStyleHoverSensitive – returns "should component be repainted when user moves the mouse to a hypertext of the given style?"

TRVTableItemInfo

•	OnDrawBorder – drawing table and cell borders.


Cursors
 TRichView Reference | Overview

TRichView  Cursors

Image	Constant	Value	Used by	Unit
*	crJump	101	TRVStyle component: • TRVStyle.JumpCursor; • TFontInfo.JumpCursor.	RVStyle.pas
	crRVZoomIn	102	TRVPrintPreview component (ZoomInCursor)	CRVPP.pas
	crRVZoomOut	103	TRVPrintPreview component (ZoomOutCursor)	CRVPP.pas
	crRVSelectRow	104	TRVTableItemInfo	RVTable.pas
	crRVSelectCol	105	TRVTableItemInfo	RVTable.pas
	crRVFlipArrow	106	TRVStyle component (LineSelectCursor)	RVStyle.pas

* in Windows2000+, RichView uses system default hypertext cursor instead (since version 1.4)


RVF Specification
 TRichView Reference | Overview

RVF Specification

This topic contains thorough information about RichView file Format.

For the most of applications you need not to know about internals of RVF, all necessary information is in RVF Overview.

Changes in RVF Format

RVF Version 1.2

Older programs are not able to read new RVF files, but programs compiled with new versions of RichView can read old RVF files.

The most significant change is adding <Item Options> in <RVF Item>.

There are two new record types: -7 (background) and -8 (version information)

RVF reader reads version number from version information. If there is no version information item, reader understand the file as RVF version 1.0

RVF version 1.3 (current version for Delphi 2007 or older):

•	allows saving space characters in tag strings (for Delphi 3+); tags strings are saved in double quotes;

•	in text mode, Unicode text is saved as a hexadecimal string (each byte is saved as two characters – hexadecimal digits)

RVF version 1.3.1 (current version for Delphi 2009 or newer):

•	DocProperties, extra string properties, tag strings (if rvoTagsArePChars in Options), style names (if rvfoUseStyleNames in RVFOptions) are saved as UTF-8 (with CR and LF characters changed to #1 and #2)

More Detailed Information about Changes in RVF

Changes in RichView version 1.3:

RVF now can contain Unicode text (for text items). Older versions will be unable to load files with Unicode. Version number in RVF header was not changed, because there are no changes in the specification (additions only).

Note: Unicode is used only for saving Unicode text items, so file contains a mix of ANSI and Unicode text. Such files must be considered as binary, do not edit them in text editors.

Changes in RichView version 1.4:

Added: tables (rvsTable). This is not a change in RVF, but an addition.

Tables are saved in binary or hexadecimal text form, similar to pictures or controls.

Changes in RichView version 1.5:

RVF now can contain text and paragraph styles (rvsDocProperty). This is not a change in RVF, but addition.

Styles are saved in binary or hexadecimal text form, similar to pictures or controls.

Changes in RichView version 1.7:

RVF now can contain layout information and collection of list styles (rvsDocProperty). This is not a change in RVF, but addition.

Changes in RichView version 1.8

RVF version number is changed to 1.3

Syntax

{x}	– zero or more repetitions of item x;

{x}+	– one or more repetitions of item x;

[x]	– item x is optional;

xy	– item x is followed by item y;

x | y	– item x or item y;

'c'	– a literal;

<n>	– a nonterminal.

Data Types in RVF

<int> – an integer number, ['-']{<digit>}+;

<digit> ::= '0' | … | '9';

Integer number is either finished by ' ' (space character) or it is followed by the end of line; for the simplification, this space character will be omitted (i.e. it will be included in <int>).

<crlf> – end of line characters; usually it is a CR+LF, CR or LF characters; before binary data or Unicode it is required to use both CR and LF characters (#13#10).

<string> – string of ANSI characters (without CR, LF and #0 characters)

<Unicode string> – string of Unicode characters. Last character in string must be a paragraph separator (code $2029).

<special string> – string containing ANSI text if RVF version is 1.3 or lower, and UTF-8 text if RVF version is 1.3.1. In this string, character #1 represents character #13, character #2 represents character #10.

<quoted string> – <special string> enclosed in double quotes; double quotes inside the string are doubled.

RVF Structure

<RVF> ::= [<Version Info>]{<RVF Record>}

Version Info

<Version Info> := <Version Record Type><Version><SubVersion>[<SubSubVersion>]<crlf>

<Version Record Type> ::= '-8'

<Version> ::= <int>

<SubVersion> ::= <int>

<SubSubVersion> ::= <int>

Currently, <Version> = 1, <SubVersion> = 3. If there is no <Version Info> in RVF, reader implies version 1.0 (no <Item Options> in <RVF Item>)

<SubSubVersion> = 1 for Delphi 2009+, and omitted for older versions of Delphi.

RVF Record Structure

RVF file consists of records. The most of records represent items (one record = one item), but there are some special record types.

<RVF Record> ::= <Record Header><crlf>({<string><crlf>}|{<Unicode sting>})[<Binary Data>]

<Record Header> ::= <Record Type><Strings Count><Paragraph><Item Options><Query><Tag><Rest of Header>

<Record Type> ::= <int>

<Strings Count> ::= <int>

<Paragraph> ::= <int>

<Item Options>::=<int>

<Query> ::= '0' | '1' | '2' | '3'

<Tag> ::= <int> | <quoted string>

<Record Type> is a type of <RVF Record>

<Record Type>	Constant	Meaning
>=0	—	text; <Item Type> is an index in the collection of styles (RVStyle.TextStyles)
-1,-3..-6, -10..-12, -60, ...	rvs*** constants	non-text item
-2	rvsCheckpoint	invisible label ("checkpoint")
-7	rvsBack	background (image, color)
-8	rvsVersionInfo	RVF version (only in <Version Info>)
-9	rvsDocProperty	text, paragraph, list styles,layout information, DocProperties, DocParameters
<Strings Count> is a number of lines between this <Record Header> and the next <Record Header> (or the end of file). If RVF reader does not understand this record type it should skip this number of lines. <Binary Data> (if present) is counted as one of strings after the header..

<Paragraph> is an index in the collection of paragraph styles (RVStyle.ParaStyles) (if this item starts a paragraph) or -1 (if the record  represents item, and this item continues paragraph).

<Item Options> is a set of bits, converted to integer.

Bit Number	Meaning
0	Set if the item continues paragraph (<Paragraph>=-1); it's a redundant data;
1	Page break. Set if this item must start a new page (<Paragraph><>-1)
2	Set if the item should be displayed from the new line, but it does not start a new paragraph (in this case <Paragraph><>-1, but should be equal to the paragraph style of the previous non "-1" item)
3	Set if it is a text item containing Unicode.
<Tag>

If rvoTagsArePChars is in RichView.Options then<Tag> is a string associated with this item. RichView saves this string in double quotes. If  the tag is equal to 0 (i.e. nil) then '0' will be saved. For Delphi 2009+, tag strings are saved as UTF-8, for older versions of Delphi they are saved as ANSI strings. On saving, #13 and #10 are changed to #1 and #2, on loading, there are restored back.

if rvoTagsArePChars is not in RichView.Options then <Tag> is an integer value associated with this item. If RVF reader cannot convert <Tag> to integer it returns False (reading failed). So it's impossible to read RVF file saved with string tags in RichView with integer tags (except for the case when all tags are empty (0 or nil)).

See also tags.

<Query> can be 0, 1, 2, or 3.

<Query>	Meaning
0	Component or image is saved in text format (rvfoSaveBinary is excluded from RichView.RVFOptions)
1	The item is requested from program on loading, see below.
2	Component or image is saved in binary format (rvfoSaveBinary is in RichView.RVFOptions).
3	Special value for saving Unicode text as hexadecimal string
If <Query>=1, then the next line after the header is a name of item (picture or control).

Data is requested in events: OnRVFPictureNeeded, OnRVFControlNeeded.

The saving mode (to save full information about images or controls / to save only name and request it when reading) is determined by RichView.RVFOptions (for the request mode, rvfoSavePicturesBody and/or rvfoSaveControlsBody options should be cleared). You need to create control or image in this event and assign it to gr or ctrl parameters. For example:

procedure TMyForm.MyRichViewRVFControlNeeded(

  Sender: TCustomRichView; Name: String;

  Tag: Integer; var ctrl: TControl);

begin

  ctrl := TButton.Create(nil);

  TButton(ctrl).Caption := 'Demo';

  TButton(ctrl).OnClick := MyClickProcedure;

end;

<Rest of Header> varies for different item types. Some new parameters can be added in future to <Rest of Header>. RVF reader should ignore all parameters in header after last parameter it can understand.

If <Query> is equal to 1 then <Rest of Header> is empty.

The next section is for <Query>=0 | 2 | 3.

RVF Records

Checkpoints

<Record Type> = rvsCheckpoint

<Paragraph> is ignored.

<String Count> = 1

<Rest of Header> ::= <Raise Event>

<Raise Event> ::= '0' | '1'

If Raise Event is equal to '1' then OnCheckPointVisible event occurs when the checkpoint appears in visible area of RichView

Strings after the header:

•	<Checkpoint name>

<Checkpoint name> ::= <special string>

"Checkpoint" is not an item, but it's convenient to save it like an item. "Checkpoints" are saved before the associated items.

Text (Items)

<Record Type> >= 0

<Rest of Header> := [<Hint>]

<Hint> := <special string>, value of rvespHint property.

<Strings Count> is a number of paragraphs in this item. All paragraphs will be of the given text and paragraph style. If <Paragraph>=-1 then this item continues the paragraph of the previous item.

Strings after the header are text lines (paragraphs). Stings can be in Unicode encoding (determined by <Item Options>). If <Query=0, Unicode is saved as UTF-16 (WideString). If <Query=3, Unicode is saved as hexadecimal string

Break (Item)

<Record Type> = rvsBreak

<Paragraph> is ignored

<Rest of Header> ::= <Break Color><Break Style><Break Width>

<Break Color> ::= <int>

<Break Style> ::= <int>

<Break Width> ::= <int>

<Break Color> is a color of horizontal line; if Break Color=clNone then line will be of color of the 0th text style.

<Break Style> is TRVBreakStyle value converted to integer.

<Break Width> is a width of line.

<String Count> >= 0.

Picture (Item)

<Record Type> = rvsPicture

<String Count> >= 3

<Rest of Header> = <Vertical Align>

<Vertical Align> ::=  <int>

<Vertical Align> is a vertical alignment of picture (TRVVAlign value converted to integer)

Strings after the header:

•	<Picture Name>

•	<Picture Delphi Type>

•	<Picture Data>

<Picture Name> ::= <string>, it is an item text.

<Picture Delphi Type> is a name of picture class (such as 'TBitmap', 'TIcon', 'TMetafile', 'TJPEGImage').

<Picture Data> can be in text or binary format.

In text format, each byte is represented as two hexadecimal digits, so all data is encoded in one string.

In binary format, <crlf> after <Picture Delphi Type> must be CR+LF (both characters). Binary data consists of <Data Size> and <Data>. Data Size is a binary 4-byte number, the number of bytes in <Data>.

Note 1: In order to load picture of the given class from RVF, its class must be registered with RegisterClasses procedure. You need not to register TBitmap, TIcon, TMetafile, because they are registered by RichView. For Delphi 3+ RichView also registers TJpegImage  (if the conditional define RVDONOTUSEJPEGIMAGE is not defined) In order to use third party graphics formats (descendants of TGraphic) in RVF you need to register them yourself with RegisterClasses procedure.

Note 2: Behavior of RichView when loading unregistered graphics format is defined in RVFOptions property. If rvfoIgnoreUnknownPicFmt option is defined then this picture will be just skipped. If this option is not defined then the function returns False (reading failed). In both cases RVFWarnings property will contain rvfwUnknownPicFmt.

Control (Item)

<Record Type> = rvsComponent

See the previous section, adjusted for: rvfoIgnoreUnknownCtrls, rvfwUnknownCtrls.

Bullet (Item)

<Record Type> = rvsBullet

<String Count> >= 1

<Rest of Header> = <ImageList#><ImageIndex>

<ImageList#> ::= <int>

<ImageIndex> ::= <int>

Strings after the header:

•	<Bullet Name>

<Bullet Name> ::= <string>, it is an item text.

<ImageList#> is the Tag property of the corresponding ImageList (do not confuse it with RichView item tags! It is TImageList.Tag property). On reading, OnRVFImageListNeeded occurs. You need to assign your imagelist to il parameter. Otherwise, the bullet will be skipped. The behavior of RichView when loading too large image index is defined in RVFOptions property. If rvfoConvLargeImageIdxToZero option is defined then index is set to 0. Otherwise the function returns False (reading failed). In both cases RVFWarnings property will contain rvfwConvLargeImageIdx.

Hotspot (Item)

<Record Type> = rvsHotspot

<String Count> >= 1

<Rest of Header> = <ImageList#><ImageIndex><HotImageIndex>

<ImageList#> ::= <int>

<ImageIndex> ::= <int>

<HotImageIndex> ::= <int>

Strings after the header:

•	<Hotspot Name>

<Hotspot Name> ::= <string>, it is an item text.

See the previous section for details.

Collections of styles, layout, DocProperties

<Record Type> = rvsDocProperty

<Paragraph> is ignored

<Query> can be 0 (data will be saved as a hexadecimal text) or 2 (in a binary form)

<Rest of Header> ::= '1' | '2' | '3' | '4' | '5' | '6'

<Rest of Header>	Meaning
1	Collection of text styles
2	Collection of paragraph styles
3	Layout
4	Collection of list styles
5	DocProperties
6	Special information, written by TRVReportHelper when saving page
7	DocParameters
<String Count> = 2 for 1..4 and 6. The first line contains name of TRVStyle object for 1,2,4, or empty for 3,6. Hexadecimal text or binary data follow next.

When saving DocProperties, <String Count>=DocProperties.Count. Each item in DocProperties is saved as <special string>.

DocParameters are saved as lines like property=value (only for properties with non-default values).

Background

<Record Type> = rvsBackground

This item is similar to rvsPicture, but has differences:

•	<Rest of Header> is a background color and style

•	there is no <Picture Name> line;

•	<Picture Delphi Type> is always TBitmap

•	<Query>=1 is not supported

<String Count> = 2 | 0

<Paragraph> and <Tag> are ignored (0).

<Rest of Header>=<Background Style><Color>

<Background Style>::= <int> (TRVBackgroundStyle value converted to integer)

<Color>::=<int> (background color)

If background style is bsNoBitmap (or background bitmap is empty), there are no strings after header  (and <Query>=0).

Strings after the header:

•	<Picture Delphi Type>

•	<Picture Data>

List Markers (Item)

<Record Type> = rvsMarker

<String Count> >= 0

<Rest of Header> ::= <List Index> <Level> <Start From> <Reset>

All items in <Rest of Header> are <int> (<Reset> is ord(boolean value))

Label (Item)

<Record Type> = rvsLabel

<String Count> >= 6

Strings after the header:

•	<Text>

•	<Text Style>

•	<Min Width>

•	<Alignment>

•	'protect' | 'no protect'

•	<Item Name>

<Text> ::= <special string>, it is Text property. <Text Style> ::= <int>, it is TextStyleNo property. <Min Width> ::= <int>, it is MinWidth property. <Alignment> ::= <int>, it is ord(Alignment). The next line depends on ProtectTextStyleNo. <Item Name> ::= <string>.

Sequence (Item)

<Record Type> = rvsSequence

<String Count> >= 10

Strings after the header:

•	<Sequence Id>

•	<Numbering Type>

•	<Reset>

•	<Start From>

•	<Text Style>

•	<Min Width>

•	<Alignment>

•	'protect' | 'no protect'

•	<Item Name>

•	<Formatting String>

<Sequence Id> ::= <special string>, it is SeqName property. <Numbering Type> ::= <int>, it is NumberType property. <Reset> ::= <int>, it is ord(Reset). <Start From> ::= <int>, it is Reset property. <Text Style>. The next five lines have the same meaning as for labels. <Formatting String> ::= <special string>, it is FormatString property.

Footnote and EndNote (Item)

<Record Type> = rvsFootnote | rvsEndnote

<String Count> >= 8

Strings after the header:

•	<Text Style>

•	<Min Width>

•	<Alignment>

•	'protect' | 'no protect'

•	<Reset>

•	<Start From>

•	<Item Name>

•	<Document>

The first seven lines have the same meaning as in sequences.

<Document> can be in text or binary format. It is Document saved in RVF format.

In text format, each byte is represented as two hexadecimal digits, so all data is encoded in one string.

In binary format, <crlf> after <Item Name> must be CR+LF (both characters). Binary data consists of <Data Size> and <Data>. Data Size is a binary 4-byte number, the number of bytes in <Data>.

Reference to Footnote or Endnote (Item)

<Record Type> = rvsNoteReference

<String Count> >= 5

Strings after the header:

•	<Text Style>

•	<Min Width>

•	<Alignment>

•	'protect' | 'no protect'

•	<Item Name>

Meanings of these lines are the same as for labels.

Extra Item Properties

Some items may contain extra integer and string properties. They are saved as lines after the header (one line per property) in the form:

name=value

If the property has the default value, it is not saved. The list of names can be found in RVItem.pas, arrays RVFExtraItemIntPropNames and RVFExtraItemStrPropNames.

Since TRichView v11, values are saved as <special string>

This specifications does not cover a case of saving style names instead of style indices (this feature is deprecated)


Overview of Item Types
 TRichView Reference

Item Types Overview

Item types

•	RichView Item Types

•	Text Items

•	Tabulators

•	Pictures

•	Hot-Pictures

•	Breaks

•	Controls

•	Bullets (images from image-lists)

•	Hotspots

•	Tables

•	List markers (paragraph bullets & numbering)

•	Labels (non-text item looking like text)

•	Numbered sequences

•	Endnotes

•	Footnotes

•	References to parent footnotes and endnotes

•	Custom Item Types


Overview
 TRichView Reference | Item Types

 RichView Item Types

Items

RichView documents consist of items. Items are indexed from 0 to ItemCount-1. Some items (tables) contain subdocuments (cells) which in their order contain items.
Items of subdocuments are not items of the main document, the are not included in the item range from 0 to ItemCount-1.

Item Types

Type ("style") of the given item is returned by the method GetItemStyle (in editor, a style of the item at the position of caret is returned by CurItemStyle).

If the returned value is 0 or positive, this is a text item. In this case, the returned value defines a style of this text: it is an index in the TextStyles collection of the the linked TRVStyle component.

If the returned value is negative, this is a constant identifying the item class.

The standard RichView item types are:

•	text

•	tabulators

•	pictures

•	hot-pictures (pictures with hyperlink)

•	breaks (horizontal lines)

•	controls (any Delphi/C++Builder control)

•	bullets (images from image-list)

•	hotspots (bullets with hyperlink)

•	tables

•	list markers (paragraph bullets & numbering)

•	labels (non-text item looking like text)

•	numbered sequences

•	endnotes

•	footnotes

•	references to parent footnotes and endnotes.

Below is the overview of properties which are common for all item types.

Text

Each item has associated text. For text items, this text is displayed. For non-text items, this text is not used by the component itself; you can store any information in it. Text must not contain characters: CR (#13), LF (#10),  #0.

For text-items, text can be in traditional (ANSI) or in Unicode encoding. ANSI text must not contain characters (CR (#13), LF (#10),  #0, TAB (#9), FF (12).

See GetItemText, SetItemText methods of TRichView and related methods of TRichViewEdit.

Tag

Tag is an additional value associated with each item. Tag is not displayed and not used by the component itself. Depending on Options, tags can store integers or strings (Unicode for Delphi/C++Builder 2009+, ANSI for older versions).

Default value of tags - 0/nil.

For example, you can use tags to store targets of hyperlinks.

See also: Tags in RichView

Checkpoint

Checkpoint marks the item and can be used to find this item quickly. Checkpoints are exported in RTF as bookmarks, in HTML as anchors.

See also: Checkpoints in RichView

Pagebreak-before Flag

If this flag is set, this item starts a new page when printing.

See PageBreaksBeforeItems.

Paragraph Attributes

Items are organized in paragraphs. Paragraph attributes are defined in the ParaStyles collection of the linked TRVStyle component.

GetItemPara returns an index of paragraph style for the given item. This method returns the same value for all items in the same paragraph.

IsParaStart returns True, if the given item starts a new paragraph.

IsFromNewLine returns True, if this item starts a new paragraph or a new line in this paragraph.

Vertical Alignment

These properties can be applied only to non-text item types which are positioned like a character of text. They cannot be applied to items occupying a full line (such as tables and breaks).

By default, bottom of item is aligned to the base line of text (items of some types can be aligned differently, see TRVVAlign).

You can move item up or down by the specified number of pixels or percents. See the following extra item properties: rvepVShift, rvepVShiftAbs.

For text items, see VShift property of text style.

Spacing

You can define spacing around the item. See the following extra item properties: rvepSpacing

Coordinates

GetItemCoords returns coordinates of the top left corner of the given item relative to the beginning of the document.

GetItemClientCoords returns coordinates of the left top corner of the given item relative to the top left corner of RichView window.

Protection

Text have several option of protection, see Protection properties of text style.

You can protect non-text items from deletion. See the following extra item integer properties: rvepDeleteProtect.

Popup Hints

The component can show a hint message when the mouse pointer is above the item.

See the following extra item string properties: rvespHint.

Hint message can be dynamically customized in OnItemHint event.

Events

OnItemAction occurs when item is inserted, deleted, moved to undo list, or when item text is modified.

OnSaveItemToFile occurs when saving item in HTML, RTF or text file or stream. This is a "low level" event. It allows you to change how the item is saved.


Text Items
 TRichView Reference | Item Types

Text Items

Text Item

Text item displays text in traditional (ANSI) or Unicode encoding.

Style of this item type: >=0 (index in the TextStyles collection of the linked TRVStyle).

Item of this collection (TFontInfo object) completely defines all properties of this text.

Main properties of TFontInfo:

•	Unicode - determines if this text is Unicode or not;

•	Jump - determines if this text is hypertext or not;

•	properties defining font, colors, background, hypertext cursors, protection, bi-di mode, and others.

Text item cannot contain:

•	CR and LF (#13 and #10) characters;

•	TAB (#09) characters (they are inserted as tabulators or replaced with several space characters, depending on SpacesInTab);

•	#0 characters;

•	FF (#12) characters (see PageBreaksBeforeItems property of TCustomRichView).

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	single item: AddNLTag (and shortcuts AddNL, AddTag, Add), AddFmt

•	multiple items: AddTextNL;

•	multiple items, can be used in Unicode applications: AddTextNLA, AddTextNLW;

The following viewer-style methods change text of the given item

•	SetItemText -A -W

The following methods return text of the given item:

•	GetItemText -A -W

Appending text from file/stream:

•	LoadText, LoadTextW,

•	LoadTextFromStream, LoadTextFromStreamW

Methods of TCustomRichViewEdit

The following editor-style methods insert item of this type in the position of caret:

•	single item: InsertStringTag, InsertStringATag, InsertStringWTag;

•	multiple items: InsertText, -A, -W.

The following editor-style methods change text of the given item:

•	SetItemTextEd -A -W, SetCurrentItemText -A -W

The following methods return text of item at the position of caret:

•	GetCurrentItemText -A -W

The following editor-style methods insert text from files in the position of caret:

•	InsertTextFromFile, InsertTextFromFileW

See Also...

See also methods for copying and pasting, selecting text.

Some of the methods above can insert tabulators as well.

See also: classes for item types.


Tabulators
 TRichView Reference | Item Types

Tabulators

Tabulators

A special item used to align the subsequent text to the next tab stop.

Tab stops are measured from the LeftMargin and defined by the following properties:

•	paragraph's LeftIndent (for paragraph with hanging (negative) FirstIndent);

•	paragraph's collection of Tabs

•	TRVStyle.DefTabWidth.

Style of this item type: rvsTab (-12)

Properties of this item type are defined by:

•	its text style (the same properties as for text items)

•	corresponding tab stop (item in the paragraph's collection of Tabs: TRVTabInfo)

Item of this type can be inserted in document using keyboard ( Tab  key), or together with text or RTF (Rich Text Format).

Value of SpacesInTab property of the linked TRVStyle component must be 0 (default). If it is positive, several spaces are inserted instead of tabulator.

Editor accepts  Tab  keys only if rvoWantTabs is included in EditorOption property.

Tabulators are read from RVF (RichView Format) files and streams regardless of value of SpacesInTab property.

Normally, tabulators are invisible (they can have background color and underline defined by its text style, though). They can be displayed as small arrows if rvoShowSpecialCharacters is included in TRichView.Options.

Methods of TCustomRichView

Methods that add one text item cannot insert tabulators. They always replace them with several space characters or delete.

The following viewer-style methods can add tabulators (if text contains #09 characters):

•	AddTextNL, AddTextNLA, AddTextNLW;

•	LoadText, LoadTextW, LoadTextFromStream, LoadTextFromStreamW;

•	AddTab – adds tabulator regardless of SpacesInTab mode.

Methods of TCustomRichViewEdit

Methods that add one text item cannot insert tabulators. They always replace them with several space characters or delete.

The following editor-style methods can insert tabulators (if text contains #09 characters):

•	InsertText, -A, -W, InsertTextFromFile, InsertTextFromFileW

•	InsertTab – inserts tabulator regardless of SpacesInTab mode

See also methods for pasting.


Pictures
 TRichView Reference | Item Types

Pictures

Pictures

Picture item displays a picture stored in TGraphic object.

Delphi has the following standard graphic classes:

•	TBitmap (stores bitmap (*.bmp), probably with transparency);

•	TMetafile (stores 32-bit (*.emf) or 16-bit (*.wmf) metafile);

•	TIcon (stores icon; this class does not work with icons having more than 16 colors properly);

•	TJpegImage (D3+; stores Jpegs (*.jpg));

•	TGifImage (D2007+, stores Gifs (*.gif));

•	TPngImage (D2009+, stores Png (*.png)).

In addition, you can use third-party graphic classes.

Style of this item type: rvsPicture (-3)

For hypertext pictures, see hot-pictures item type.

Additional Properties

This item type has the following specific extra integer properties:

•	rvepImageWidth, rvepImageHeight stretch the image;

•	rvepTransparent, rvepTransparentMode, rvepTransparentColor define transparency in bitmap;

•	rvepAnimationInterval – interval for bitmap animations;

•	rvepMinHeightOnPage allows printing this image on multiple pages (cannot be applied to metafiles);

•	rvepSpacing – spacing around the picture;

•	rvepResizable allows resizing (ignored for TIcon).

This item type has the following specific extra string properties:

•	rvespAlt – text representation of the image, saved in HTML as <IMG alt> attribute;

•	rvespImageFileName – this property can be saved in HTML file as image location.

This item type has the following properties affecting vertical position:

•	VAlign;

•	extra properties: rvepVShift, rvepVShiftAbs.

Resizing

In editor, pictures can be resized with the mouse (except for TIcon). You can forbid mouse resizing by including rvoNoImageResize in EditorOptions. You can forbid resizing for the specific image by assigning 0 to rvepResizable extra integer property.

Resizing with mouse does not modify the image itself, it changes rvepImageWidth and rvepImageHeight.

OnItemResize event occurs after resizing.

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddPictureEx,

•	AddPictureExTag

The following viewer-style method changes the main properties of item of this type:

•	SetPictureInfo

The following method returns main properties of the given item of this type:

•	GetPictureInfo

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertPicture

The following editor-style methods modify main properties of the item of this type:

•	SetCurrentPictureInfo,

•	SetPictureInfoEd

The following method returns main properties of the item of this type at the position of caret:

•	GetCurrentPictureInfo

Memory Usage

RichView owns this graphic object, and it will destroy it when clearing document. Do not free memory for graphic object inserted in RichView yourself. Do not insert the same graphic object twice.

Saving and Loading

RichView Format (RVF)

In order to load these items from RVF, you need to register a class of the graphics. RichView does it automatically for the standard item classes. But if you use third-party graphic classes, register them.

For example:

•	Delphi: RegisterClass(TGifImage);

•	C++Builder: RegisterClass(__classid(TGifImage));

If rvfoSavePicturesBody is excluded from RVFOptions, graphic data is not saved in RVF. When loading such RVF files, OnRVFPictureNeeded event occurs. You can use this feature to store images in database or files.

Export to HTML

By default, all pictures are saved as jpegs (or as bitmaps). If you want to save pictures of some graphic class without conversion, call RV_RegisterHTMLGraphicFormat.

For example:

•	Delphi: RV_RegisterHTMLGraphicFormat(TGifImage);

•	C++Builder: RV_RegisterHTMLGraphicFormat(__classid(TGifImage));

If you want to save pictures in another format, use OnHTMLSaveImage or OnSaveImage2 events.

RTF export

RTFOptions contain options for saving pictures in RTF. Pictures are embedded in RTF, external image files are not created.

Bitmaps are stored as bitmaps. 32-bit metafiles (EMF) are stored as 32-bit or 16-bit (WMF) metafiles.

PNG images are stored as PNG images, if PNG class is specified.

All other graphic formats are stored as bitmaps, WMF or PNG (except for Jpegs which can be stored as Jpegs).

RTF Import

You can set RTFReadProperties.IgnorePictures to True, and pictures in RTF will not be added in RichView.

RTF can have embedded images and external images (in separate files). In order to load external images, a proper graphic class must be associated with the file extension.

Delphi does it for standard graphic classes automatically, but for some third-party classes you need to do it yourself.

For example:

TPicture.RegisterFileFormat('gif','Gif Image',TGifImage);

Read more information in the topic about third-party graphic classes.

See Also...

•	Working in 256-color display mode;

•	Animation.


Hot-Pictures
 TRichView Reference | Item Types

 Hot-Pictures

"Hot-picture" is a picture - hypertext link.

Style of this item type: rvsHotPicture (-10)

All methods working with pictures work with hot-pictures. The difference is only in methods that insert hot-picture in the document.

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddHotPicture,

•	AddHotPictureTag

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

•	InsertHotPicture

ConvertToHotPicture, ConvertToPicture convert picture to hot-picture and vice versa.


Breaks
 TRichView Reference | Item Types

Breaks

Break is a horizontal line (or rectangle) of the specified width and color.

It always occupies a full line.

Style of this item type: rvsBreak (-1)

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddBreakExTag (also AddBreak, AddBreakEx, AddBreakTag)

•	The following viewer-style method changes the main properties of item of this type:

•	SetBreakInfo

The following method returns main properties of the given item of this type:

•	GetBreakInfo

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

•	InsertBreak

The following editor-style methods modify main properties of the item of this type:

•	SetCurrentBreakInfo,

•	SetBreakInfoEd

The following method returns main properties of the item of this type at the position of caret:

•	GetCurrentBreakInfo

Export to HTML

Breaks are exported as <HR>. Color of break is retained only in CSS version (SaveHTMLEx, or SaveHTML with rvsoForceNonTextCSS in Options parameter)

RTF

Breaks are exported as two paragraphs, one of them with border at bottom. Not imported (i.e. imported back as two paragraphs, one of them with border at bottom)

Export to Text

When saving/copying selection, breaks are not included in text. When saving to file (SaveText), saved as a sequence of LineWidth  '-' characters.


Controls
 TRichView Reference | Item Types

Controls

You can insert any Delphi/C++Builder control in the document.

Style of this item type: rvsComponent (-5)

Additional Properties

This item type has the following specific extra integer properties:

•	rvepSpacing – spacing around the control;

•	rvepResizable allows resizing;

•	rvepVisible allows to hide the control (to set its Visible property to False).

This item type has the following properties affecting vertical position:

•	VAlign;

•	extra properties: rvepVShift, rvepVShiftAbs.

Vertical Position

This item type has the following properties affecting vertical position:

•	VAlign;

•	extra integer properties: rvepVShift, rvepVShiftAbs.

Resizing

You can allow resizing this control in editor by assigning non-zero value to its rvepResizable extra property.

You can forbid mouse resizing of all images and controls in the editor by including rvoNoImageResize in EditorOptions.

Resizing with mouse changes Width and Height properties of the control.

Resizing is activated if this control is selected. You can select this control (for example, in its OnClick event) by calling RichView.SelectControl.

OnItemResize event occurs after resizing.

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddControlEx,

•	AddControlExTag

The following viewer-style method changes the main properties of item of this type:

•	SetControlInfo

The following method returns main properties of the given item of this type:

•	GetControlInfo

See also

•	FindControlItemNo

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

•	InsertControl

The following editor-style methods modify main properties of the item of this type:

•	SetCurrentControlInfo,

•	SetControlInfoEd

The following method returns main properties of the item of this type at the position of caret:

•	GetCurrentControlInfo

Also

•	ResizeControl,

•	ResizeCurrentControl,

•	AdjustControlPlacement2

Events:

•	OnControlAction – occurs when the control is loaded from RVF, deleted, moved to/from undo buffer, saved to RVF.

Memory Usage

RichView owns this control, and it will destroy it when clearing document. Do not free memory for controls inserted in RichView yourself. Do not insert the same control twice.

Note about Tags of controls

RichView uses tags of inserted controls (TComponent.Tag) for its own needs. Please do not use and do not modify tags of controls.

(this note is about Tag property of component, not about tags of items; you can use item's tag as you wish)

Saving and Loading

RVF

In order to load these items from RVF, you need to register a class of the control.

For example:

•	Delphi: RegisterClass(TButton);

•	C++Builder: RegisterClass(__classid(TButton));

If rvfoSaveControlsBody is excluded from RVFOptions, control itself is not saved in RVF. When loading such RVF files, OnRVFControlNeeded event occurs.

Export to text, RTF, and HTML

By default, controls are not exported. Use OnSaveComponentToFile event to save controls.

Printing

RichView creates a temporal bitmap, draws the control in it, then prints this bitmap.

It's not possible to create an universal procedure for drawing all possible controls. If you are not satisfied with the results, override the default printing with OnPrintComponent event.

Special Width Mode

Width of controls can be set in percent:

var Item: TRVControlItemInfo;

  ...

Item := RichView.GetItem(ItemNo) as TRVControlItemInfo;

Item.PercentWidth := 50; // 50% of document width (minus paragraph indents)

The effect will be after reformatting.

See also...

BeginOleDrag


Bullets
 TRichView Reference | Item Types

 Bullets

"Bullet" is an image from TImageList. Bullets are useful if you want to create document where the same (small) image is used many times.

For example, they can be used for smiles in chats.

This item type has no relation to paragraph bullets and numbering.

Style of this item type: rvsBullet (-6)

For hypertext bullets, see hotspot item type.

Additional Properties

This item type has the following specific extra integer properties:

•	rvepSpacing – spacing around the picture;

This item type has the following properties affecting vertical position:

•	VAlign;

•	extra properties: rvepVShift, rvepVShiftAbs.

Vertical Position

This item type has the following properties affecting vertical position:

•	extra integer properties: rvepVShift, rvepVShiftAbs.

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddBulletEx, AddBulletExTag

The following viewer-style method changes the main properties of item of this type:

•	SetBulletInfo

The following method returns main properties of the given item of this type:

•	GetBulletInfo

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

•	InsertBullet

The following editor-style methods modify main properties of the item of this type:

•	SetCurrentBulletInfo,

•	SetBulletInfoEd

The following method returns main properties of the item of this type at the position of caret:

GetCurrentBulletInfo

Memory Usage

RichView does not own this image-list, and it will not destroy it when clearing document.

Saving and Loading

RVF

ImageLists themselves are not saved in RVF. RichView stores TImageList.Tag. When loading, OnRVFImageListNeeded occurs allowing you to provide image-lists for bullets and hotspots.

Export to RTF and HTML

Bullets are exported as pictures. If you want to write special code for exporting bullets in HTML, use OnHTMLSaveImage event.


Hotspots
 TRichView Reference | Item Types

 Hotspots

"Hotspot" is a bullet (image from TImageList) with hypertext link.

Hotspots can change their image under the mouse pointer.

Style of this item type: rvsHotspot (-4)

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddHotspotEx,

•	AddHotspotExTag

The following viewer-style method changes the main properties of item of this type:

•	SetHotspotInfo

The following method returns main properties of the given item of this type:

•	GetHotspotInfo,

•	GetBulletInfo

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

•	InsertHotspot

The following editor-style methods modify main properties of the item of this type:

•	SetCurrentHotspotInfo,

•	SetHotspotInfoEd

The following method returns main properties of the item of this type at the position of caret:

•	GetCurrentHotspotInfo,

•	GetCurrentBulletInfo

Memory Usage

RichView does not own this image-list, and it will not destroy it when clearing document.


Tables
 TRichView Reference | Item Types

Tables

Tables arrange content in rows and columns. Each table cell is a subdocument containing its own items. Tables can be nested.

More details:

•	Overview of tables,

•	TRVTableItemInfo (see for detailed information).

Style of this item type: rvsTable (-60)

Extra Properties

This item type has the following specific extra string properties:

•	rvespImageFileName – value of this property can be saved in HTML file as table background image location; also accessible as table.BackgroundImageFileName.

Methods of TCustomRichView

The following viewer-style methods add item of this type to the end of the document:

•	AddItem (create TRVTableItemInfo object, add it using AddItem)

The following method returns TRVTableItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVTableItemInfo.object, insert it using InsertItem)

The following methods return TRVTableItemInfo object at the position of caret:

•	GetCurrentItem,

•	GetCurrentItemEx.

Resizing

Users can resize table rows and columns, if rvtoRowSizing and/or rvtoColSizing are included in table.Options.

Resizing changes BestWidth and BestHeight properties of table cells.

OnItemResize event occurs after resizing.

Saving and Loading

Export to HTML

The TRichView's model of tables is very similar to the HTML model of tables, so tables are saved to HTML as they are.

The most of table visual properties can be saved only with use of CSS (use SaveHTMLEx method, or SaveHTML with rvsoForceNonTextCSS in Options parameter).

RTF Import

You can set RTFReadProperties.IgnoreTables to True, and tables in RTF will not be added in RichView (contents of cells will be added in the main document).

RTF tables have different structure, TRichView does a smart work for converting them.

Text export

See the following properties of TRVTableItemInfo:

•	TextColSeparator;

•	TextRowSeparator.


List Markers
 TRichView Reference | Item Types

List Markers (Paragraph Bullets & Numbering)

This is a very special item type representing paragraph bullet or number.

Style of this item type:  rvsListMarker (-11)

See also: numbered sequences.

Properties of List Markers

TRVStyle component has a collection of list styles (ListStyles). Each list style contains a collection of list levels (Levels property). List level defines the most of list properties.

List markers is a special kind of items. They are inserted with special functions. They are always inserted at the beginning of paragraph.

They have the following properties:

•	ListNo – index of list style in the collection of list styles;

•	LevelNo – list level;

•	StartFrom – starting value for list counter, if UseStartFrom=True;

•	UseStartFrom – if True, list counter value for this marker is defined by StartFrom. If False, numbering is continued.

List Markers Operations

Methods of TCustomRichView:

•	SetListMarkerInfo,

•	GetListMarkerInfo,

•	RefreshListMarkers.

Methods of TCustomRichViewEdit:

•	ApplyListStyle,

•	RemoveLists,

•	ChangeListLevels.

Saving and Loading

RVF

For list levels with ImageLists: ImageLists themselves are not saved in RVF. RichView stores TImageList.Tag. When loading, OnRVFImageListNeeded occurs allowing you to provide an image-list.

HTM Export, rvsoMarkersAsText is not in Options of SaveHTML or SaveHTMLEx

Lists are saved using <ul> and <ol> HTML tags.

Export using CSS (SaveHTMLEx):

CSS of lists are inserted directly in HTML.

•	rvlstBullet, rvlstUnicodeBullet are exported as bullets with default markers (disc, circle or square). FormatString and Font are ignored;

•	rvlstDecimal,rvlstLowerAlpha,rvlstUpperAlpha,rvlstLowerRoman,rvlstUpperRoman are exported as lists with corresponding numbering. FormatString and Font are ignored;

•	rvlstPicture,rvlstImageList,rvlstImageListCounter are exported as bullets with picture. It's possible to change default image saving by OnHTMLSaveImage.

Indents are saved, but not very accurately.

Export without CSS (SaveHTML)

•	rvlstBullet, rvlstUnicodeBullet,rvlstPicture,rvlstImageList are exported as bullets with default markers (disc, circle or square). FormatString, Picture, ImageList and Font are ignored;

•	rvlstDecimal,rvlstLowerAlpha,rvlstUpperAlpha,rvlstLowerRoman,rvlstUpperRoman are exported as lists with corresponding numbering. FormatString and Font are ignored;

•	rvlstImageListCounter is saved as a decimal numbering.

Indents are not saved.

HTML Export, rvsoMarkersAsText is in Options

Markers are saved without using special HTML keywords for lists (like <ol>, <ul>, <li>).

Font and format strings settings are respected.

Saving with CSS (SaveHTMLEx): LeftIndent and MarkerIndent are retained. FirstIndent are retained for non-hanging markers only (MarkerIndent>=LeftIndent).

Saving without CSS (SaveHTML): all indents are ignored.

Generally, HTML files saved with this option look closer to the original.

Demo Projects

•	Demos\Delphi\Assorted\ListStyles\

•	Demos\CBuilder\Assorted\ListStyles\


Labels
 TRichView Reference | Item Types

Labels

"Label" is a non-text item looking like text. This text cannot be wrapped (always displayed on one line).

For Delphi/C++Builder 2009 or newer, this text is Unicode. For older versions, it is ANSI.

Class for this item type is TRVLabelItemInfo (see for detailed information).

Style of this item type: rvsLabel (-200)

Related Properties of TRVStyle

•	FieldHighlightColor – color for highlighting label items.

•	FieldHighlightType specifies when to highlight label items.

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

•	AddItem (create TRVLabelItemInfo object, add it using AddItem)

The following method returns TRVLabelItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVLabelItemInfo object, insert it using InsertItem)

The following method returns TRVLabelItemInfo object at the position of caret:

•	GetCurrentItem.


Numbered Sequences
 TRichView Reference | Item Types

Numbered Sequences

Numbered sequence is a non-text item looking like text and displaying number. For example, this item type can be used for numbering pictures, tables or formulas. This text cannot be wrapped (always displayed on one line).

Class for this item type is TRVSeqItemInfo  (see for detailed information).

Style of this item type: rvsSequence (-202)

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

•	AddItem (create TRVSeqItemInfo object, add it using AddItem)

The following method returns TRVSeqItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVSeqItemInfo object, insert it using InsertItem)

The following method returns TRVSeqItemInfo object at the position of caret:

•	GetCurrentItem.

Saving and Loading

Export to HTML and text

Numbered sequences are exported as a plain text.

RTF

Numbered sequences can be exported in RTF (all main properties are saved except for FormatString).

You can set RTFReadProperties.IgnoreSequences to True, and numbered sequences will not be imported (imported as a plain text) from RTF.


Endnotes
 TRichView Reference | Item Types

Endnotes

Endnote looks like number (numbering type is specified in TRVStyle.EndnoteNumbering). Endnote contains subdocument. This subdocument is not displayed in TCustomRichView where the endnote is inserted, but it can be printed. Subdocuments for all endnotes are printed after the main document.

Class for this item type is TRVEndnoteItemInfo  (see for detailed information).

Style of this item type: rvsEndnote (-204)

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

•	AddItem (create TRVEndnoteItemInfo object, add it using AddItem)

The following method returns TRVEndnoteItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVEndnoteItemInfo object, insert it using InsertItem)

The following method returns TRVEndnoteItemInfo object at the position of caret:

•	GetCurrentItem.

Saving and Loading

Export to HTML

Subdocuments for all endnotes are saved after the main document. Before each subdocument, <a name="endnoteN"></a> is inserted, where N is an index of this endnote (in the list of all numbered sequences, footnotes and endnotes). Endnotes are saved as hyperlinks to this anchor.

RTF

Endnotes can be exported in RTF.

You can set RTFReadProperties.IgnoreNotes to True, and endnotes will not be imported from RTF.


Footnotes
 TRichView Reference | Item Types

Footnotes

Footnote looks like number (numbering type is specified in TRVStyle.FootnoteNumbering). Footnote contains subdocument. This subdocument is not displayed in TCustomRichView where the footnote is inserted, but it can be printed. Subdocuments for all footnotes are printed at the bottom of page where this footnote occurs. TRichView cannot print text for footnote on several pages.

Class for this item type is TRVFootnoteItemInfo  (see for detailed information).

Style of this item type: rvsFootnote (-203)

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

•	AddItem (create TRVFootnoteItemInfo object, add it using AddItem)

The following method returns TRVFootnoteItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVFootnoteItemInfo object, insert it using InsertItem)

The following method returns TRVFootnoteItemInfo object at the position of caret:

•	GetCurrentItem.

Saving and Loading

Export to HTML

Subdocuments for all footnotes are saved after the main document. Before each subdocument, <a name="footnoteN"></a> is inserted, where N is an index of this footnote (in the list of all numbered sequences, footnotes and endnotes). Footnotes are saved as hyperlinks to this anchor.

RTF

Footnotes can be exported in RTF.

You can set RTFReadProperties.IgnoreNotes to True, and footnotes will not be imported from RTF.


References to Endnotes and Footnotes
 TRichView Reference | Item Types

References to the Parent Endnotes and Footnotes

When inserted in footnote's/endnote's Document, the note reference displays the same text as the parent footnote/endnote.

When inserted in TCustomRichView, it displays NoteText.

Class for this item type is TRVNoteReferenceItemInfo  (see for detailed information).

Style of this item type: rvsNoteReference (-205)

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

•	AddItem (create TRVNoteReferenceItemInfo object, add it using AddItem)

The following method returns TRVNoteReferenceItemInfo object

•	GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type in the position of caret:

•	InsertItem (create TRVNoteReferenceItemInfo object, insert it using InsertItem)

The following method returns TRVNoteReferenceItemInfo object at the position of caret:

•	GetCurrentItem.

Saving and Loading

Export to HTML

Note references are saved as a plain text. In future, they may be saved as hyperlinks to the parent footnote/endnote.

RTF

Note references can be exported in RTF.

You can set RTFReadProperties.IgnoreNotes to True, and note references will not be imported from RTF.


Custom Item Types
 TRichView Reference | Item Types

Custom Item Types

You can create your own item types.

Overview of custom item types is beyond the scope of this help file.

See examples in Demos\Addins\


Overview of Tables
 TRichView Reference | Tables

Overview of Tables

	I want to thank EQL International (the UK's leading provider of e-learning and assessment systems) and personally Dr. David G Wild. Without them I could spend years implementing tables.
Overview of Tables

•	Tables in RichView

•	Addressing Items in Table Cells (important information)

•	Table Cells

•	Colors and Layout of Tables

•	Selection in Table

•	Cell Editing

•	Cell Merging

•	Table Operations

•	Undo/redo in Tables

•	Export of Tables

•	Table Resizing

Examples

•	Converting table to text

•	Dividing table

Main Classes

•	TRVTableItemInfo – table

•	TRVTableCellData – table cell


Tables in RichView
 TRichView Reference | Tables

Tables in RichView

Table is a special kind of RichView items, like images, controls, breaks, etc. But tables are much more complicated, because they contain RichView document in each cell. Moreover, tables can contain other tables inside, so RichView documents can be nested on any depth.

How to Create and Insert a Table

Creating table

uses RVTable;

...

var table:TRVTableItemInfo;

...

table := TRVTableItemInfo.CreateEx(RowCount,ColumnCount,

  RVData);

where RVData is a richview document where you wish to insert table. Usually this is richview.RVData or richviewedit.RVData.

How to append table to RichView

table.ParaNo := <Paragraph Style Index>

richview.AddItem(<Table name>, table)

where <table name> is any string associated with table, <paragraph style index> is the index in the collection of paragraph styles. This paragraph style is used for the table itself, not for each cells.

This method does not perform reformatting and requires explicit call of Format before displaying the document.

How to insert table in RichViewEdit

richviewedit.InsertItem(<Table name>, table)

This method inserts table in the position of caret, even if caret is in a cell of another table.

This method can return False, if document is read-only or insertion is impossible because of text protection. In this case table was freed by InsertItem method.

Table Placement

Table always occupies the whole line, no items are possible to the left or to the right of it (if you need this effect, use nested tables), including list markers.

The table's paragraph style defines its position: Alignment, LeftIndent, RightIndent (FirstIndent is ignored). The paragraph style can define border around the table and background. All these properties are applied to the table itself, not to its cells.


Addressing Items in Table Cells
 TRichView Reference | Tables

Addressing Items in Table Cells

Main Methods

RichViewEdit.Insert*** methods insert item(s) in the position of caret, even if the caret is in cell of other table.

RichViewEdit.GetCurrent***Info and SetCurrent***Info methods differ from their analogs with names without "Current"

(for example GetCurrentPictureInfo and GetPictureInfo)

Get/SetCurrent***Info methods work with the current item (item at the position of caret) either in parent editor or in cell inplace-editor, depending on where the caret is located.

Get/Set-without-Current methods cannot work with cells (because item in cell cannot be addressed using only ItemNo parameter).

If you used TRichView version 1.3 and you want to work with tables, you should check your code and replace such methods with their "Current" alternatives, or to call them for TopLevelEditor.

All methods (and properties) of editor working with current or selected item(s) can work with cell inplace editors

(for example, ApplyTextStyle, SetCurrentTag, CurTextStyleNo, etc.). Programmer does not need to know if the current item or selection is in root editor or in inplace editor.

Methods with ItemNo Parameter

Methods working with the Item-th item cannot work with cells (because item in cell cannot be addressed using only ItemNo parameter). They must be called for the document containing this item (usually, for editing operations, it's TopLevelEditor).

There are some methods which do not have ItemNo parameter:

•	ResizeCurrentControl (alternative to ResizeControl)

•	AdjustControlPlacement2(Control) (alternative to AdjustControlPlacement(ItemNo))

•	SetCurrentItemText(text); (alternative to SetItemTextEd(ItemNo, text));

•	GetCurrentItemText (alternative to GetItemText);

Events with ItemNo Parameter

For events without RVData parameter: when events occur inside cell inplace editor, ItemNo is an index of table inside the root editor (for example OnRVMouseDown)

For events having both RVData and ItemNo parameter: ItemNo is an index of item in this RVData

Selection

SelectionExists returns True, if something is selected inside cell, or several cells are selected in table. In this case GetSelectionBound can returns -1s.

In editor, you can use TopLevelEditor.GetSelectionBounds to get information about selection in the edited cell.

Hypertext

Hypertext items can be not only in main document, but in subdocuments (cells or cell inplace-editor).

Use GetJumpPointLocation instead of GetJumpPointItemNo to access hypertext item.

Hypertext links are numbered sequentially through the document, including all hyperlinks cells. This number is passed as id parameter in hypertext events

Checkpoints

Unlike hypertext links, each subdocument (main document, table cell) has its own list of checkpoints. So methods for checkpoints enumeration cannot find checkpoints in table cell (if called for the main document).

Page Breaks

Mandatory page breaks inside tables are not supported yet.


Table Cells
 TRichView Reference | Tables

Table Cells

Table Cells

The main property of table is Cells[<Row>,<Col>].

<Row>,<Col> are indices of row and column, from 0.

Attention: The Borland's grids use Cells[<Col>,<Row>] instead!

The type of Cell[r,c] is TRVTableCellData. Each RichView control has a similar class inside (richview.RVData). Cell and richview.RVData are descendants from the same class designed to store formatted RichView document.

Cells also have additional table-related properties (discussed below).

Table Rows

Tables have another property: Rows.

It is a list of table rows. Each row is a list of cells.

Each row has the same number of cells (important!)

So:

•	number of rows in table = table.Rows.Count;

•	number of columns in table = table.Rows[0].Count (each row has the same number of cells as the 0-th)

•	table.Cells[r,c] is the same as table.Rows[r][c].

Accessing and Modifying Cells

In editor, you need no special processing to access cells.

Methods working with current/selected item(s) do it automatically (see more info).

Cells have the most of the methods which RichView (not RichViewEdit!) has.

For example:

with table.Cells[r,c] do begin

  Clear;

  AddNLATag('hello!',0,0,0);

end;

Read more about methods of cell.

Initially every cell contains one empty line of the 0-th text and paragraph style.

Cells do not have editor-style methods. RichViewEdit creates special inplace editor to edit cell.

Read more about cell editing.


Colors and Layout of Tables
 TRichView Reference | Tables

Colors and Layout of Tables

Table Colors

Almost all color properties of tables (Color, BorderColor, BorderLightColor, CellBorderColor, CellBorderLightColor) are shown on the figure above.

There are some more color properties related to rules (lines between cells), see below.

Cells can be individually colored.

Table can be transparent, if its Color is set to clNone.

Borders can be hidden, if their widths are set to 0 (see BorderWidth and CellBorderWidth). These are default values.

Cell borders can be 3d, like on this figure, or flat (see BorderStyle and CellBorderStyle).

You can hide some sides of borders of some cells (see cells' VisibleBorders) and set individual color for cell border (cell.BorderColor and cell.BorderLightColor).

When table with invisible border is inserted in TRichViewEdit, such borders are shown as dotted gray lines (see also table Options).

Background Images

Tables and cells can have background images.

See properties of table: BackgroundImage, BackgroundStyle.

See properties of cell: BackgroundImage, BackgroundStyle.

Borders and Spacing

The figure above shows properties affecting the table layout:

•	CellHSpacing, CellVSpacing,

•	BorderHSpacing, BorderVSpacing,

•	BorderWidth,

•	CellBorderWidth,

•	CellHPadding, CellVPadding.

(The dotted red line around the cell contents is imaginary).

Rules

Rules are horizontal and/or vertical lines between cells, and may be also between table borders and outermost cells.

By default rules are invisible.

Rules are defined with properties: HRuleWidth, HRuleColor, HOutermostRule, VRuleWidth, VRuleColor, VOutermostRule.

Tip: How to make 1 pixel border

RichView tables have HTML-style layout, so making one-pixel width borders is a trick.

Even if you set CellBorderWidth=1, CellHSpacing=CellVSpacing=0, 1-pixel width borders of adjacent cells will be visually combined in 2-pixel width borders.

Recommended solution:

setting CellBorderWidth=1, CellHSpacing=CellVSpacing=-1. These values are specially supported by SaveHTMLEx (and SaveHTML with rvsoForceNonTextCSS in the Options parameter).

Other solutions (not recommended):

•	hiding cells border and using rules; disadvantages: rules cannot be saved in HTML and RTF;

•	using VisibleBorders to hide one of adjacent border sides


Selection in Table
 TRichView Reference | Tables

Selection in Table

Types of Selection

Table can be:

•	not selected or

•	selected completely (as a part of larger selection) or

•	selected partially (multicell selection) or

•	some part of cell content (in cell or in inplace editor) selected.

RichView does not support selection started somewhere else and finished at the middle of a table. Selection containing several items can contain tables only completely (or it does not contain them).

Any method working with selection must be called only when the document is formatted.

Tables in Larger Selection

To determine if the table is selected completely, as a part of larger selection, use RichView.GetSelectionBounds (and compare its results with GetItemNo for table).

Multicell Selection

Table can be selected partially: selection can starts on one cell of table, and ends on another cell.

You can determine if the table selected partially using the methods TRVTableItemInfo.GetSelectionBounds or GetNormalizedSelectionBounds (the latter is more convenient).

You can select some cells in table using TRVTableItemInfo.Select and remove the selection using TRVTableItemInfo.Deselect.

You can select some rows or columns completely: TRVTableItemInfo.SelectRows and SelectCols.

You can determine if the given cell is selected or not with the method IsCellSelected.

Selection Inside Cell

You can get inplace-editor and position for currently edited cell: GetEditedCell.

See also: TRichViewEdit TopLevelEditor.

Before making selection inside cells, you need to activate inplace editor for it (TRichView does not have inplace editors, but the same code must be called in TRichView too, not only in TRichViewEdit).

Example 1 (selecting table.Cells[0,0]):

table.EditCell(0,0);

table.Cells[0,0].GetRVData.SelectAll;

Example 2 (does the same)

uses CRVData, CRVFData;

var RVData: TCustomRVData;

...

RVData := table.Cells[0,0];

RVData := RVData.Edit;

TCustomRVFormattedData(RVData).SelectAll;

The method in the second example (calling RVData := RVData.Edit, then selecting) can be used for any type of RVData, not only for table cells.

Editing Operations

Some RichViewEdit methods can be applied to the selected cells (regardless the type of selection):

•	ApplyTextStyle

•	ApplyParaStyle

•	ApplyStyleConversion

•	ApplyParaStyleConversion

•	DeleteSelection.


Editing Cells
 TRichView Reference | Tables

Editing Cells

Editing Cells

Then the user clicks some cell in table with the mouse, or enter to some cell using keyboard, RichViewEdit creates a special editor for this cell. This editor is referred in this documentation as cell inplace editor.

(this editor will be created only if rvtoEditing is in table Options)

This editor does not have borders and located in place of cell, creating an illusion of editing directly in main RichViewEdit.

Inplace editing is possible only when table was inserted in TRichViewEdit, not in TRichView.

When inplace editor is initiated, RichViewEdit moves all content of the cell to this editor. When editor is destroyed, RichViewEdit moves modified data back to the cell (this procedure is transparent for user).

So if you wish to access directly to cell contents, use methods of cell's  GetRVData instead of methods of the cell itself.

You can initiate editing of cell from code: EditCell (see the example in the topic about selection in tables)

Position of edited cell can be returned by method GetEditedCell and GetNormalizedSelectionBounds.

Limitations

This mechanism of cell editing adds some limitations:

You must not destroy inplace editor from inside the following events: OnKeyDown, OnKeyUp, OnKeyPress, OnRVMouseMove, OnStartDrag, OnDragOver.

Inplace editor can be destroyed by calling RichViewEdit.Clear, or by the methods placing caret/selection outside the editing cell (RichViewEdit.SetSelectionBounds, table.EditCell, etc.). You must avoid calling these methods in these events.

If you need to perform such operation, use the following technique:

•	from the event, post a window message to the form (PostMessage)

•	in the handler procedure  for this message, perform this operation.

Example 1 (reloading on double click)

Define some constant > WM_USER:

const WM_RELOADDOC = WM_USER+5;

In the form's declaration:

procedure WMReloadDoc(var Msg: TMessage); message WM_RELOADDOC;

Implementation:

procedure TForm1.WMReloadDoc(var Msg: TMessage);

begin

  { code for loading here }

end;

Double click:

procedure TForm3.RichViewEdit1DblClick(Sender: TObject);

begin

  PostMessage(Handle, WM_RELOADDOC, 0, 0);

end;

Example 2:

•	Demos\Delphi\Assorted\Graphics\DragImg\ or

•	Demos\CBuilder\Assorted\Graphics\DragImg\


Cell Merging
 TRichView Reference | Tables

Cell Merging

Cells have read-only ColSpan and RowSpan properties, similar to html <td colspan rowspan>, 1 by default.

If Cells[r,c].ColSpan>1, this cell spans over (ColSpan-1) cells to the right:

Cell[r,c], Cell[r,c+1], ..., Cell[r,c+Cell[r,c].ColSpan-1].

In this case, all overlapped cells  (Cell[r,c+1], ..., Cell[r,c+Cell[r,c].ColSpan-1]) are destroyed and equal to nil.

Number of cells in the row is still equal to the number of cells in all other rows, even with merging.

The same is with RowSpan: cell with RowSpan>1 spans over (RowSpan-1) cells below.

Example: iterating through all cells of table:

for r := 0 to table.Rows.Count-1 do

 for c := 0 to table.Rows[r].Count-1 do

   if table.Cells[r,c]<>nil then

     table.Cells[r,c].Color := clRed;

// ( Cells[r,c]=nil if it is overlapped by the top left cell)

You can get the top left cell which overlaps given cell with table.Rows.GetMainCell method:

function GetMainCell(ARow,ACol: Integer;

  var MRow, MCol: Integer): TRVTableCellData;

Methods for merging cells:

•	MergeCells,

•	MergeSelectedCells

Inverse operation:

•	UnmergeCells,

•	UnmergeSelectedCells

Splitting cells:

•	SplitSelectedCellsHorizontally,

•	SplitSelectedCellsVertically


Table Operations
 TRichView Reference | Tables

Table Operations

Operations on Selection

Inserting rows and columns:

•	InsertColsLeft,

•	InsertColsRight,

•	InsertRowsAbove,

•	InsertRowsBelow.

Deleting rows can columns:

•	DeleteSelectedCols,

•	DeleteSelectedRows,

Cell merging and unmerging:

•	MergeSelectedCells (see also CanMergeSelectedCells),

•	UnmergeSelectedCells,

•	SplitSelectedCellsHorizontally,

•	SplitSelectedCellsVertically

Other Operations

Inserting rows and columns:

•	InsertCols,

•	InsertRows.

Deleting rows can columns:

•	DeleteCols,

•	DeleteRows.

Cell merging and unmerging:

•	MergeCells (also CanMergeCells)

•	UnmergeCells,

•	DeleteEmptyRows, DeleteEmptyCols (use after cell merging).

Assigning Table Properties (As Editing Operations)

Methods for assigning table properties:

•	SetTableVisibleBorders.

Methods for assigning row properties:

•	SetRowVAlign.

Methods for assigning cell properties:

•	SetCellColor, SetCellBorderColor, SetCellBorderLightColor;

•	SetCellVAlign;

•	SetCellBestWidth, SetCellBestHeight;

•	SetCellBackgroundImage, SetCellBackgroundImageFileName, SetCellBackgroundStyle;

•	SetCellHint;

•	SetCellVisibleBorders.

Operations in Viewer and Editor

If the operations above are performed before inserting the table, no addition actions are required.

If these operations are performed on table inserted in TRichView, you need to call Format method after to update the document view.

If these operations are performed on table inserted in TRichViewEdit, a special sequence of steps is required:

1.	checking RichViewEdit.CanChange (especially important for data-aware versions of components);

2.	obtaining table object and its position in editor;
(position is defined as item index + editor where this table is inserted (can be root editor or cell inplace-editor, referred below as rve)

3.	calling rve.BeginItemModify for table

4.	performing operations

5.	calling rve.EndItemModify

6.	calling rve.Change

The example is below.

You can group several actions so that they will be undone/redone as whole, using SetUndoGroupMode

In order to perform operation(s) on table, you need to get table object.You can do it using method

function TRichView.GetItem(ItemNo: Integer): TCustomRVItemInfo;

TCustomRVItemInfo is an ancestor class for all items of RichView, including table (TRVTableItemInfo). This method can be used for item of any type, so you need to check if it is a table (using "is" operator, or checking RichView.GetItemStyle(ItemNo)=rvsTable)

But usually, when you need to perform operations on the item at the position of caret in editor, you do not know if the current item is in "root" editor, or inside cell, or inside cell of table inside other cell, and so on.

In any case, you can get item in position of caret with method

function TRichViewEdit.GetCurrentItem: TCustomRVItemInfo;

But even if the caret is inside table, the current item will be not a table, but some other item in cell-inplace editor!

The problem can be solved with the method

function TRichViewEdit.GetCurrentItemEx(

  RequiredClass: TCustomRVItemInfoClass;

  var ItemRichViewEdit: TCustomRichViewEdit;

  var Item: TCustomRVItemInfo): Boolean;

In this method,

•	RequiredClass – set it to TRVTableItemInfo (for C++Builder: __classid(TRVTableItemInfo)).

•	Return value: True if there is item of the given class at the position of caret (i.e. the caret is to the left or to the right of table), or if the caret is inside item the given class (i.e. the caret is in table cell).

•	Item receives the top-level item of the given class (i.e. table).

•	ItemRichViewEdit receives the parent editor for Item  (this Item is in this editor).

This editor can be "root" RichViewEdit or cell inplace editor.

Example

// MyRichViewEdit:TRichViewEdit is an editor

// placed on the form at design time.

// Note: the most of operations are performed in

// rve (editor returned by GetCurrentItemEx),

// not in MyRichViewEdit.

var item: TCustomRVItemInfo;

    table: TRVTableItemInfo;

    Data: Integer;

    rve: TCustomRichViewEdit;

    ItemNo: Integer;

begin

  if not MyRichViewEdit.CanChange or

     not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, item) then

    exit;

  table := TRVTableItemInfo(item);

  ItemNo := rve.GetItemNo(table);

  rve.BeginItemModify(ItemNo, Data);

  // performing some operation, for example

  // table.InsertRowsBelow(1);

  // or table.CellPadding := 10

  rve.EndItemModify(ItemNo, Data);

  rve.Change;

end;


Undo/redo in Tables
 TRichView Reference | Tables

Undo/redo in Tables

Undo and Redo

All table operations (adding/deleting rows, merging/unmerging, assignment of table properties) can be undone/redone if table was inserted into RichViewEdit.

Operations will not be undone if:

•	table was created, but not inserted yet;

•	table was inserted in RichView;

•	table was inserted in RichViewEdit with UndoLimit=0.

Example 1

Two operations: (inserting table and changing its color) will be undone in two steps

table := TRVTableItemInfo.CreateEx(4,3, RichViewEdit1.RVData);

if RichViewEdit1.InsertItem('', table) then

  table.Color := clRed;

Example 2

One operation (inserting red table) will be undone in one step

table := TRVTableItemInfo.CreateEx(4,3, RichViewEdit1.RVData);

table.Color := clRed; // table is not inserted yet

RichViewEdit1.InsertItem('', table);

About Using Non-Editor-Style Operations in Editor for Modifying Documents

(AddNL, for example)

These methods must not be mixed with editor-style methods (such as InsertText) because they will conflict with undo mechanism. Result of undo-redo operations is unpredictable if non-editor operations were used after editor-style one.

This rule relates not only to contents of the main document, but to cells also.

There are some cases when non-editor-style methods may be useful in editor:

•	After Clear method, before any editor-style methods (for generating a document before editing). Clear method clears undo and redo buffers.

•	In table cells before inserting a table.

•	if UndoLimit of editor = 0 (undo mechanism turned off). But Format must be called before calling any editor-style method.

•	After ClearUndo method. But Format must be called before calling any editor-style method.

Undo of Assignment to Properties

Assigning values to cell properties (and to VAlign property of rows) will not be undone.

But there are some special methods.

table.Cells[r,c].Color := clRed; // will not be undone

table.SetCellColor(clRed, r,c);  // will be undone.

(the complete list of these methods is below)

This was made because of efficiency reasons.

These methods do not update editor view. Use them together with BeginItemModify/EndItemModify.

For example

var item: TCustomRVItemInfo;

    table: TRVTableItemInfo;

    Data: Integer;

    rve: TCustomRichViewEdit;

    ItemNo: Integer;

begin

  if not RichViewEdit1.CanChange or

     not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, item) then

    exit;

  table := TRVTableItemInfo(item);

  ItemNo := rve.GetItemNo(table);

  rve.BeginItemModify(ItemNo, Data);

  table.SetRowVAlign(rvcBottom, 1);

  table.SetCellColor(clRed,1,1);

  rve.EndItemModify(ItemNo, Data);

  rve.Change;

end;

Assignments to all table properties can be undone (but still the sequence BeginItemModify-operations-EndItemModify-Change is required). The only exception is VisibleBorders property, use SetTableVisibleBorders if you want to implement an undoable operation.

Direct assignment to cells and rows properties cannot be undone, so use the methods below to implement an undoable operation.

Methods for assigning table properties:

•	SetTableVisibleBorders.

Methods for assigning row properties:

•	SetRowVAlign.

Methods for assigning cell properties:

•	SetCellColor, SetCellBorderColor, SetCellBorderLightColor;

•	SetCellVAlign;

•	SetCellBestWidth, SetCellBestHeight;

•	SetCellBackgroundImage, SetCellBackgroundImageFileName, SetCellBackgroundStyle;

•	SetCellHint;

•	SetCellVisibleBorders.


Export of Tables
 TRichView Reference | Tables

Export of Tables

Tables can be exported with document in the following formats:

•	text (including Unicode),

•	HTML,

•	RTF.

Text Export

Tables have the properties:

•	TextRowSeparator – string to write after each row;

•	TextColSeparator – string  to write between cells.

By default, the both of them are equal to CR+LF (#13#10).

MS Word 2000+ saves tables as text in the same way.

You can set TextColSeparator to TAB character (#09), if you wish, but do not forget that there can be CR+LFs inside cells.

RTF

RichView saves tables in RTF according to the MS Word 2000+ standard.

MS Word 2000 introduces many new RTF keywords to store HTML-like formatting. Also, Word 2000 supports nested tables (Word 97 does not). Also, Word 2000  correctly works with non standard colors (Word 97 does not, it converts to the closest of 16 standard colors).

MS Word6/95 does not support row merging; there can be other problems with it.

RichView, like Word 2000, saves tables in RTF using both Word 97 and Word 2000 keywords, so tables may look very different when read by different Words.

For Word 97 keywords, RichView uses sizes of table in document (depends on width of RichView window).

For Word 2000, RichView saves html-style properties like BestWidths of cells (in % or twips).

Although generally RichView tables in Word 2000 look much better than in Word 97, table size in Word 2000 can differs from an original, because of Word 2000's way of processing of html-related properties. For example, it sets widths of cells to exactly the width specified (Cells[r,c].BestWidth), if it was set in pixels (twips). RichView and browsers do not set widths of cells less than required to display all their contents.

You can turn off saving cells' BestWidth for Word2000 by excluding rvtoRTFSaveCellPixelBestWidth from table.Options.

HTML

Some properties can be saved only with CSS (with SaveHTMLEx, or SaveHTML with rvsoForceNonTextCSS in Options parameter). See comments for table properties.

See Also...

RichView methods for saving and loading


Table Resizing
 TRichView Reference | Tables

Table Resizing

Table Layout Algorithm

Tables do not have column widths and row heights specified explicitly.

Widths are calculated basing on:

•	minimal width required to display document inside cell (if rvtoIgnoreContentWidth is not in table.Options)

•	table.BestWidth

•	cells BestWidth

Heights are calculated basing on:

•	heights of cells content (if rvtoIgnoreContentHeight is not in table.Options)

•	cells BestHeight

Rules for calculations table width:

1.	cells always have widths large enough to contain the widest of their item (if rvtoIgnoreContentWidth is not in table.Options);

2.	if table.BestWidth<>0,  it defines width of the table (but table can be wider because of the rule 1)

3.	if table.BestWidth=0 then

•	if all columns have cells with BestWidths in pixels (and do not have cells with BestWidths in %), width of table is calculated basing on cells BestWidths and minimal widths required to show cells contents without overlapping (in this case mouse resizing works the most similar to MS Word)

•	otherwise, width of table is the same as with BestWidth=-100 (100%) (in this version RichView cannot calculate width of table basing on optimal widths of cells)

Rules for calculating widths of cells are quite complicated.

The most important rules (when widths of cells are conflicting):

•	widths of cells to the left have higher priority than widths of cells to the right;

•	widths of cells in % have higher priority than widths in pixels.

Resizing with Mouse

Resizing with mouse is possible only in editor.

If you include rvtoRowSizing and rvtoColSizing in table.Options, users will not be able to resize it.

When user resizes table with mouse, he/she actually changes values of BestWidth or BestHeight properties of cells.

When resizing columns with mouse, and columns to the left and to the right do not have cells with BestWidths in %, RichViewEdit adjusts BestWidths of cells of column to the right and to the left, trying to keep their total width unchanged.

When resizing with pressed  Shift  key, RichView sets only BestWidths of the column to the left.


Example: table to text
 TRichView Reference | Tables

Example: table to text

This example "removes" the table at the caret position without removing its content.

This is an editing operation, it can be undone by the user.

procedure ConvertTableToText(RichViewEdit: TCustomRichViewEdit);

var table: TRVTableItemInfo;

    rv: TRichView;

    rve: TCustomRichViewEdit;

    Stream: TMemoryStream;

    ItemNo,r,c: Integer;

begin

  if not RichViewEdit.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(table)) then

    exit;

  rv := TRichView.Create(nil);

  try

    rv.Visible := False;

    rv.Parent := RichViewEdit.Parent;

    rv.Style := RichViewEdit.Style;

    rv.RVFTextStylesReadMode := rvf_sIgnore;

    rv.RVFParaStylesReadMode := rvf_sIgnore;

    for r := 0 to table.RowCount-1 do

      for c := 0 to table.ColCount-1 do

        if table.Cells[r,c]<>nil then begin

          Stream := TMemoryStream.Create;

          try

            table.Cells[r,c].GetRVData.SaveRVFToStream(Stream, False, clNone, nil, nil);

            Stream.Position := 0;

            rv.InsertRVFFromStream(Stream, rv.ItemCount)

          finally

            Stream.Free;

          end;

        end;

    ItemNo := table.GetMyItemNo; // like rve.GetItemNo(table), but faster

    Stream := TMemoryStream.Create;

    try

      rv.SaveRVFToStream(Stream, False);

      Stream.Position := 0;

      rve.SetSelectionBounds(ItemNo, 0, ItemNo, 1);

      rve.InsertRVFFromStreamEd(Stream);

    finally

      Stream.Free;

    end;

  finally

    rv.Free;

  end;

end;

The same for C++Builder:

void ConvertTableToText(TCustomRichViewEdit* RichViewEdit)

{

  TCustomRVItemInfo   *item;

  TCustomRichViewEdit *rve;

  if (! RichViewEdit->GetCurrentItemEx(__classid(TRVTableItemInfo), rve, item))

    return;

  TRVTableItemInfo*table = (TRVTableItemInfo*)item;

  TRichView* rv = new TRichView((TComponent*)NULL);

  rv->Visible = false;

  rv->Parent  = RichViewEdit->Parent;

  rv->Style   = RichViewEdit->Style;

  rv->RVFTextStylesReadMode = rvf_sIgnore;

  rv->RVFParaStylesReadMode = rvf_sIgnore;

  for (int r=0; r<table->RowCount; r++)

    for (int c=0; c<table->ColCount; c++)

      if (table->Cells[r][c])

      {

        TMemoryStream*Stream = new TMemoryStream;

        table->Cells[r][c]->GetRVData()->SaveRVFToStream(Stream, false, clNone, NULL, NULL);

        Stream->Position = 0;

        rv->InsertRVFFromStream(Stream, rv->ItemCount);

        delete Stream;

      }

  int ItemNo = table->GetMyItemNo();

  TMemoryStream*Stream = new TMemoryStream;

  rv->SaveRVFToStream(Stream, false);

  Stream->Position = 0;

  rve->SetSelectionBounds(ItemNo, 0, ItemNo, 1);

  rve->InsertRVFFromStreamEd(Stream);

  delete Stream;

  delete rv;

}


Example: dividing table
 TRichView Reference | Tables

Example: dividing table

function SplitTable(rve: TCustomRichViewEdit; table: TRVTableItemInfo;

  RowCountInFirstTable: Integer; PageBreak: Boolean): Boolean;

var r, c, mr, mc: Integer;

    newtable: TRVTableItemInfo;

    Stream: TMemoryStream;

begin

  Result := False;

  if RowCountInFirstTable>=table.RowCount then

    exit;

  for c := 0 to table.RowCount-1 do

    if table.Cells[RowCountInFirstTable, c] = nil then begin

      table.Rows.GetMainCell(RowCountInFirstTable, c, mr, mc);

      if mr<RowCountInFirstTable then

        exit;

    end;

  Stream := TMemoryStream.Create;

  table.SaveRowsToStream(Stream, RowCountInFirstTable,

    table.RowCount-RowCountInFirstTable);

  Stream.Position := 0;

  newtable := TRVTableItemInfo.CreateEx(0, 0, rve.RVData);

  newtable.LoadFromStream(Stream);

  if PageBreak then

    newtable.PageBreakBefore := True;

  Stream.Free;

  rve.BeginUndoGroup(rvutModifyItem);

  rve.SetUndoGroupMode(True);

  try

    table.DeleteRows(RowCountInFirstTable, table.RowCount-RowCountInFirstTable, True);

    // table.GetMyItemNo is the same as rve.GetItemNo(table), but faster

    rve.SetSelectionBounds(table.GetMyItemNo, 1, table.GetMyItemNo, 1);

    rve.InsertItem('', newtable);

  finally

    rve.SetUndoGroupMode(False);

  end;

  Result := True;

end;

Parameters:

rve – editor directly containing table;

table – the table to divide.

These two parameters are usually a result of RichViewEdit1.GetCurrentItemEx.

The table will be divided into two tables.

The first resulting table will have row count = RowCountInFirstTable, the second table will have row count = table.RowCount-RowCountInFirstTable.

If PageBreak parameter is True, a page break will be inserted between tables.

Return value: True if the table was divided.

This is an editing operation, it can be undone and redone by the user.


Components
 TRichView Reference

Components

Components

TRVStyle	Component for defining visual appearance of RichView, RichViewEdit, DBRichView, DBRichViewEdit. It contains some properties which can be used by several RichViews.

TRichView	Component for displaying hypertext documents (containing pictures, controls, tables)

TRichViewEdit	Component for editing hypertext documents (containing pictures, controls, tables)

TDBRichView	Data-aware version of RichView

TDBRichViewEdit	Data-aware version of RichViewEdit

TRVPrint	Component for printing documents contained in the components above

TRVPrintPreview	Component allowing to show document as it will be printed by RVPrint

TRVReportHelper	Component for drawing documents on different canvas (screen, printer, image, etc.)

TRVOfficeConverter	Component allowing to use Microsoft Office text converters (import and export in different file formats)


TRichView
 TRichView Reference | TRichView

 TRichView

Properties   Methods   Events

TRichView is a control for displaying documents with pictures, tables, Delphi controls and hyperlinks.

Unit RichView;

Syntax

TCustomRichView = class(TRVScroller)

TRichView = class(TCustomRichView)

TRichView does not display its content if it is not linked to TRVStyle component via Style property.

The most important property settings can be done in the component editor for TRichView. In Delphi (C++Builder) IDE, right click the RichView object on the form, choose "Settings" in the context menu.

Hierarchy

 TObject

 TPersistent

 TComponent

 TControl

 TWinControl

 TCustomControl

 TRVScroller

 TCustomRichView

List of properties, events and methods

grouped in several categories (some entries can be in several groups)

General  Background  Appending Items  Hypertext  Scrolling, margins, sizes  Selection and Clipboard  Saving and loading as RVF  Other methods for saving and loading  Information about items	Modifying items  Checkpoints  Mouse events  Unicode  Live spelling check  Picture animation  Working in palette mode  Other properties, methods and events  Obsolete properties and methods
General properties

•	Style – link to RVStyle component defining a lot of properties which can be used in several RichViews;

•	Options – some important options;

•	ItemCount – number of items in the document.

Properties defining background

•	BackgroundBitmap;

•	BackgroundStyle;

•	Color.

Appending items (Add*** methods)

Main methods for appending items:

•	AddNL adds one text item;

•	AddBreakEx adds break (horizontal line);

•	AddBulletEx adds bullet (image from ImageList);

•	AddHotspotEx adds hotspot (image from ImageList - hypertext link);

•	AddPictureEx adds picture;

•	AddHotPicture adds picture - hypertext link;

•	AddControlEx adds Delphi/C++Builder control;

•	AddTab adds tabulator;

•	AddItem – general method for appending items (usually used for tables);

•	also AddNamedCheckpointEx – adds checkpoint which will be associated with next added item.

"Tagged" analogs of the methods above (Add***Tag methods) (the same methods, but have additional Tag parameter):

•	AddNLTag;

•	AddBreakExTag;

•	AddBulletExTag;

•	AddHotspotExTag;

•	AddPictureExTag;

•	AddHotPictureTag;

•	AddControlExTag;

•	also AddNamedCheckpointExTag and AddNLATag, AddNLWTag.

Additional methods for appending items:

•	Add adds one text item in last paragraph;

•	AddFmt adds one formatted string assembled from a Pascal format string and an array arguments;

•	AddTextNL, -A -W add several text items from text, separated by CR+LF characters;

•	AddBreak provides a subset of functionality of AddBreakEx;

•	also: AddCheckpoint provides subset of functionality of AddNamedCheckpointEx;

•	also Unicode-enabled methods.

"Tagged" analogs of the methods above:

•	AddTag;

•	AddBreakTag;

•	also AddCheckpointTag.

Also

•	AppendFrom copies content from another RichView;

•	InsertRVFFromStream,

•	AppendRVFFromStream.

See also

•	Clear clears document;

•	SetAddParagraphMode;

•	Format, FormatTail format the document;

•	Reformat reformats the document.

Hypertext

•	event OnJump occurs when user clicks hyperlink;

•	event OnRVMouseMove occurs when mouse pointer moves over hyperlink;

•	property FirstJumpNo – use to set hypertext id for the first hypertext item;

•	GetJumpPointItemNo (deprecated) returns index of item with the specified hypertext id;

•	GetJumpPointLocation should be used instead of GetJumpPointItemNo in applications working with tables;

•	GetJumpPointY returns Y coordinate of item with the specified hypertext id.

Scrolling, margins and sizes

Properties:

•	LeftMargin, RightMargin, TopMargin, BottomMargin – margins;

•	MaxTextWidth – maximal width for word wrapping;

•	MinTextWidth – minimal width for word wrapping (minimal width of scrollable area, not including margins);

•	DocumentHeight – height of document (height of scrollable area);

•	VAlign – vertical alignment of document;

•	VScrollVisible – hides/shows vertical scrollbar;

•	HScrollVisible – hides/shows horizontal scrollbar;

•	VSmallStep – number of pixels in one step of vertical scrollbar;

•	FirstItemVisible – the first visible item;

•	LastItemVisible – the last visible item;

•	MaxLength – maximal count of characters per line;

•	WordWrap allows to disable word wrapping;

•	Tracking – whether RichView repaints while its scrollbar thumb tab is dragged with the mouse.

Methods:

•	ClientToDocument converts client coordinates to document coordinates

Events:

•	OnVScrolled occurs when document is scrolled vertically

•	OnHScrolled occurs when document is scrolled horizontally

Also:

•	property CPEventKind

•	event OnCheckPointVisible

•	method GetItemCoords

Methods for working with selection and the Clipboard

•	SelectionExists returns "is something selected?"l

•	Copy copies selection to the Clipboard in all available formatsl

•	CopyDef copies selection to the Clipboard using formats specified in Options;

•	CopyImage copies selected image to the Clipboard;

•	CopyTextA copies selection as text to the Clipboard;

•	CopyTextW copies selection to the Clipboard as Unicode text;

•	CopyRVF copies selection as RVF to the Clipboard;

•	CopyRTF copies selection as RTF (Rich Text Format);

•	GetSelectedImage returns selected image

•	GetSelText returns selection as text

•	GetSelTextW returns selection as Unicode string;

•	GetOffsBeforeItem, GetOffsAfterItem return offset before/after the given item; useful with SetSelectionBounds;

•	SelectAll selects the whole document for copying to the Clipboard;

•	SetSelectionBounds selects the specified items;

•	SelectWordAt selects the word at (X,Y);

•	SelectControl selects a visual control;

•	Deselect clears selection (not contents, but bounds);

•	GetSelectionBounds returns bounds of selection;

•	event OnSelect occurs when selection bounds are changed;

•	event OnCopy allows to copy selection to the Clipboard in custom formats.

Properties, methods and events for loading and saving RVF

Properties:

•	RVFOptions – options for saving and loading RVF;

•	RVFWarnings describes warnings or errors occurred during the last reading of RVF.

Events:

•	OnRVFControlNeeded requests inserted control when reading RVF, if RVF was saved without controls' "bodies";

•	OnRVFImageListNeeded requests ImageList when reading bullet or  hotspotfrom RVF;

•	OnRVFPictureNeeded requests image when reading RVF, if RVF was saved without images' "bodies".

Methods:

•	SaveRVF saves document or selection as RVF to the file;

•	SaveRVFToStream saves document or selection as RVF to the stream;

•	LoadRVF loads RVF from the file;

•	LoadRVFFromStream loads RVF from the stream;

•	CopyRVF copies selection as RVF to the Clipboard;

•	InsertRVFFromStream inserts RVF from the stream;

•	AppendRVFFromStream appends RVF from the stream using the specified paragraph style for the first RVF item.

Also:

•	methods Copy, CopyDef.

Other saving and loading

Methods:

•	LoadFromStream loads document in RVF, RTF or text formats;

•	LoadText appends text form the file;

•	LoadTextW appends text from the file in Unicode encoding;

•	LoadRTF, LoadRTFFromStream appends the file or the stream in RTF (Rich Text Format);

•	SaveHTML saves the document in the HTML file;

•	SaveHTMLEx saves the document in the HTML file using CSS;

•	SaveHTMLToStream, SaveHTMLToStreamEx – the same as the methods above, but save HTML to the stream;

•	SaveText saves the document in the text file;

•	SaveTextW saves the Unicode file;

•	SaveTextToStream, SaveTextToStreamW – the same for streams (can save selection only);

•	SaveRTF saves the document (or selection) in the RTF file;

•	SaveRTFToStream saves the document (or selection) in the RTF stream.

Properties:

•	RTFOptions – options for RTF export.

Events:

•	OnSaveComponentToFile allows to save inserted controls in HTML and text files;

•	OnWriteHyperlink, OnReadHyperlink allow to save/load hypertext links in HTML and RTF files;

•	OnHTMLSaveImage, OnSaveImage2 allow to save images with HTML in custom formats and with custom file names;

•	OnSaveItemToFile allows to save any item in RTF, HTML or text files in your own format;

•	OnImportPicture allows custom processing of external images when importing RTF.

Information about items (Get***Info methods)

•	GetItemStyle returns a type of item;

•	GetTextInfo – information about text item;

•	GetBreakInfo – about "break";

•	GetBulletInfo – about "bullet";

•	GetHotspotInfo – about "hotspot";

•	GetPictureInfo – about picture or "hot-picture";

•	GetControlInfo – about inserted control;

•	GetItemExtraIntProperty,
GetItemExtraStrProperty return value of extra item property;

•	GetItem – general method for obtaining items (usually used for tables);

•	GetItemCheckpoint – about item's "checkpoint";

•	GetItemVAlign – about item's position relative to line;

•	GetItemTag – about item's "tag";

•	GetItemText – about text/name of item;

•	IsParaStart returns "is this item a first item in paragraph?";

•	IsFromNewLine returns "is this item a first item in paragraph?";

•	GetItemPara returns an index of paragraph containing a specified item;

•	GetItemNo returns item index for object representing item (usually used for tables);

•	GetItemCoords returns coordinates of item relative to document area;

•	GetItemClientCoords returns coordinates of item relative to client area of RichView window;

•	properties PageBreaksBeforeItems, ClearLeft, ClearRight.

Modifying items  (Set***Info methods)

•	SetBreakInfo changes break;

•	SetBulletInfo changes bullet;

•	SetHotspotInfo changes hotspot;

•	SetPictureInfo changes picture or hot-picture;

•	SetControlInfo changes inserted control;
also

•	SetItemTag changes item's "tag";

•	SetItemVAlign – change the item position relative to the line;

•	SetItemText changes text/name of item;

•	SetItemExtraIntProperty,
SetItemExtraStrProperty sets value of extra item property;

•	SetCheckpointInfo sets or changes item's "checkpoint";

•	RemoveCheckpoint removes item's "checkpoint";

•	see also properties PageBreaksBeforeItems, ClearLeft, ClearRight.

Working with checkpoints

Obtaining checkpoint data:

•	GetFirstCheckpoint, GetNextCheckpoint allow to receive full list of checkpoints;

•	GetLastCheckpoint, GetPrevCheckpoint – the same in backward direction;

•	GetCheckPointByNo returns a checkpoint with the specified index;

•	GetItemCheckpoint returns the item's checkpoint;

•	event OnCheckPointVisible occurs when checkpoint (or "section", marked by this checkpoint) becomes visible as a result of vertical scrolling;

•	FindCheckPointByName searches for checkpoint with the specified name;

•	FindCheckPointByTag searches for checkpoint with the specified tag.

Extracting properties from checkpoint data:

•	GetCheckpointInfo returns main properties of the checkpoint;

•	GetCheckpointItemNo returns an index of item which owns the checkpoint;

•	GetCheckpointNo returns an index of the checkpoint;

•	GetCheckpointYEx, GetCheckpointXY returns coordinates of the checkpoint.

Also:

•	GetCheckPointY returns Y coordinate of checkpoint by its index.

See also methods for obtaining information about items and for modifying document.

Mouse events

•	OnRVDblClick occurs on double click;

•	OnRVMouseDown occurs when user presses mouse button;

•	OnRVMouseUp occurs when user releases mouse button;

•	OnRVRightClick occurs on right click.

•	OnItemHint allows customizing hints displayed when the mouse pointer moves above an item.

•	OnGetItemCursor allows customizing cursors displayed when the mouse pointer moves above an item.

See also hypertext events.

Live spelling check

•	StartLiveSpelling starts live spelling thread;

•	ClearLiveSpellingResults clears live spelling underlines and stops the thread;

•	LiveSpellingValidateWord removes live spelling underlines from the specified word;

•	OnSpellingCheck event – the place to check word spelling.

Picture animation

Properties:

•	AnimationMode specifies when image animation starts.

Methods:

•	StartAnimation starts all animations;

•	StopAnimation stops all animations;

•	ResetAnimation rewinds all animations to the first frame.

Unicode

•	AddNLATag adds one text item in ANSI encoding;

•	AddNLWTag adds one text item in Unicode encoding;

•	AddTextNLW adds one or more text items in Unicode encoding;

•	LoadTextW, LoadTextFromStreamW appends text from file/stream in Unicode encoding;

•	SaveTextW, SaveTextToStreamW saves Unicode file/stream;

•	GetSelTextW returns selection as Unicode string;

•	CopyTextW copies selection to the Clipboard as Unicode.

Working in palette mode

•	property DoInPaletteMode;

•	method UpdatePaletteInfo.

Others

Properties:

•	RVData – object representing document;

•	Cursor – cursor;

•	Delimiters – characters not belonging to words;

•	TabNavigation sets mode for navigation through hypertext links and controls;

•	AnimationMode defines when animated images starts animation;

•	DocProperties – additional information for saving in RVF;

•	DocParameters – store document page parameters;

•	NoteText – text for references to parent notes.

Methods:

•	DeleteUnusedStyles deletes unused text, paragraph and list styles from TRVStyle;

•	MarkStylesInUse, DeleteMarkedStyles – advanced methods for deleting unused styles;

•	SearchText, -A, -W search for the text string;

•	GetWordAt returns a word at the specified point;

•	DeleteItems, DeleteSection delete the specified range of items from document;

•	DeleteParas deletes the specified range of paragraphs, updates the document;

•	FindControlItemNo returns index of item which owns the specified inserted control;

•	GetFocusedItem returns the item in the focus;

•	GetLineNo returns line number in the specified position;

•	BeginOleDrag starts drag&drop.

Events:

•	OnItemAction;

•	OnControlAction.

Obsolete properties and methods:

AddBullet, AddCenterLine, AddControl, AddFromNewLine, AddHotspot, AddNamedCheckPoint, AddPicture, AllowSelection, AddText, AddTextFromNewLine, LineCount, SingleClick.


TRichView: Component editor
 TRichView Reference | TRichView

TRichView Component Editor

Component editor for TCustomRichView
(and all inherited components: TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit).

To display the component editor dialog in Delphi (C++Builder) IDE, right click RichView object on the form, choose "Settings" in the popup menu.

The dialog consists of 3 pages: Styles, Tags, RVF.

Styles

This page allows to select one of two style modes:

•	Use a predefined set of styles.

•	Allow adding styles dynamically.

This setting changes the properties: RVFTextStylesReadMode, RVFParaStylesReadMode, RVFOptions, RTFReadProperties.TextStyleMode, .ParaStyleMode. Changes are shown in the light yellow box below.

"Use a predefined set of styles" mode

In this mode, the component:

•	does not add new items in the collection of text, paragraph and list styles of the linked TRVStyle component;

•	does not save these styles in RVF files or streams.

"Allow adding styles dynamically" mode

In this mode, the component:

•	adds new items in the collection of text, paragraph and list styles, if necessary; new styles can be added as a result of RVF and RTF loading;

•	saves these styles in RVF files and streams.

If you want to display RTF files close to the original, or use commands for adding styles (for example, inside OnStyleConversion or OnParaStyleConversion, or RichViewActions), you must set this mode.

Since version 1.8, "Allow adding styles dynamically" is set by default for all new TRichViews created at design time (placed on forms from the Component Palette), if the defaults were not overridden.

Tags

This page allows to set one of two tag modes:

•	Tags store integers.

•	Tags store string.

This setting includes or excludes rvoTagsArePChars in Options.

"Tags store integers" mode

In this mode, tags (4-byte values associated with each document item) are treated as integer values.

"Tags store strings" mode

In this mode, tags are treated as pointers to dynamically allocated strings.

Typical using of tags - storing hyperlink targets. If you want to store target URLs in tags, use this mode.

RVF

Defines options for saving and loading RVF (RichView Format) files and strings. These settings change RVFOptions.

Storing The Component Editor's Options

Set "Default" checkbox to store settings on the given page. Settings are stored in the Registry. They will be applied to new components created in Delphi/C++Builder IDE from the Component Palette. Stored settings do not affect component creation at run time (from your code), and components that already were added on forms.


TRichView.AllowSelection
 TRichView Reference | TRichView

TCustomRichView.AllowSelection

property AllowSelection: Boolean;

This property still works, but obsolete, please use rvoAllowSelection in Options


TRichView.AnimationMode
 TRichView Reference | TRichView

TCustomRichView.AnimationMode

Specifies when image animation starts.

type

  TRVAnimationMode = (rvaniDisabled, rvaniManualStart, rvaniOnFormat);

property AnimationMode: TRVAnimationMode;

(introduced in version 10)

Mode	Meaning
rvaniDisabled	Animation is completely disabled. If images are added/updated in this mode, they cannot be animated (even if different mode is set later). This mode saves system resources.
rvaniManualStart	Animation starts when calling StartAnimation and stops when calling StopAnimation.
rvaniOnFormat	Animation starts when calling Format and stops when calling Clear. StartAnimation and StopAnimation work as well.
Default value:

rvaniManualStart

See also:

•	Animation in TRichView;

•	Pictures;

•	Hot-Pictures.


TRichView.BackgroundBitmap
 TRichView Reference | TRichView

TCustomRichView.BackgroundBitmap

Background image shown below the document

property BackgroundBitmap: TBitmap;

Assignment to this property copies the image, so you still need to free the source image yourself.

Example 1 (assigning image)

bmp := TBitmap.Create;

bmp.LoadFromFile('c:\image.bmp');

MyRichView.BackgroundBitmap := bmp;

bmp.Free;

Example 2 (doing the same work)

MyRichView.BackgroundBitmap.LoadFromFile('c:\image.bmp');

Example 3 (clearing the image)

MyRichView.BackgroundBitmap := nil;

See also properties:

•	BackgroundStyle.


TRichView.BackgroundStyle
 TRichView Reference | TRichView

TCustomRichView.BackgroundStyle

Defines how BackgroundBitmap is displayed

type

  TBackgroundStyle = (bsNoBitmap, bsStretched,

    bsTiled, bsTiledAndScrolled, bsCentered,

    bsTopLeft, bsTopRight,

    bsBottomLeft, bsBottomRight);

property BackgroundStyle : TBackgroundStyle;

Note: TBackgroundStyle is declared in RVScroll unit.

Style	Meaning
bsNoBitmap	Colored background (bitmap is not used)
bsStretched	Bitmap is stretched to fit RichView window
bsTiled	Repeats bitmap until the entire RichView window is covered
bsTiledAndScrolled	Repeats bitmap until the entire scrollable area is covered (tiles are scrolled together with content)
bsCentered	Centers bitmap in RichView window
bsTopLeft,	Bitmap is in the top left corner
bsTopRight	Bitmap is in the top right corner
bsBottomLeft	Bitmap is in the bottom left corner
bsBottomRight	Bitmap is in the bottom right corner
See also properties:

•	BackgroundBitmap;

•	Color.

See also:

•	TRVItemBackgroundType type.


TRichView.BiDiMode
 TRichView Reference | TRichView

TCustomRichView.BiDiMode

Specifies the default bidirectional mode for the control

property BiDiMode: TRVBiDiMode;

(introduced in version 1.6)

Value	Meaning
rvbdUnspecified	Turns off support of right-to-left languages. Bidirected text will not be processed correctly. Text output is more efficient in this mode, so, if you do not plan to work with Arabic or Hebrew, use this mode
rvbdLeftToRight	Sets default text flow to left-to-right
rvbdRightToLeft	Sets default text flow to right-to-left; if version of Windows allows it, vertical scrollbar will be to the left side of the RichView window.
BiDiMode can be overridden with  BiDiMode of paragraph style.and BiDiMode of text style.

See also:

•	Bidirectional text in RichView.

Default value:

rvbdUnspecified


TRichView.BottomMargin
 TRichView Reference | TRichView

TCustomRichView.BottomMargin

Bottom margin of document

property BottomMargin: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, and margins on pages look like margins on the screen.

See also properties:

•	LeftMargin;

•	RightMargin;

•	TopMargin.

See also properties of TRVPrint:

•	LeftMarginMM;

•	RightMarginMM;

•	TopMarginMM;

•	BottomMarginMM.

See also:

Additional information about horizontal scrolling, margins, indents, etc.


TRichView.ClearLeft
 TRichView Reference | TRichView

TCustomRichView.ClearLeft

Specifies whether a text flow around left-aligned items should be cleared for the paragraph started from the Index-th item.

property ClearLeft[Index: Integer]: Boolean

(Introduced in version 12)

Set ClearLeft[ItemNo] to True if you want the ItemNo-th item to be placed below any left-aligned object.

This property is illustrated on the picture above. At the left side, you can see two paragraphs ("aaa" and "bbb") flow around left-aligned picture. At the right side, you can see how it looks if the first item in the "bbb" paragraph has ClearLeft[] = True.

This item must start a new paragraph (IsParaStart(ItemNo)) or a new line inside a paragraph (IsFromNewLine(ItemNo)), otherwise assignment will be ignored.

You need to reformat RichView after this assignment (using Format).

In editor you can change value of this property as an editing operation, using ClearTextFlow method.

See also:

•	ClearRight,

•	PageBreaksBeforeItems,

•	TRVVAlign type (rvvaLeft).


TRichView.ClearRight
 TRichView Reference | TRichView

TCustomRichView.ClearRight

Specifies whether a text flow around right-aligned items should be cleared for the paragraph started from the Index-th item.

property ClearRight[Index: Integer]: Boolean

(Introduced in version 12)

Set ClearRight[ItemNo] to True if you want the ItemNo-th item to be placed below any right-aligned object.

This item must start a new paragraph (IsParaStart(ItemNo)) or a new line inside a paragraph (IsFromNewLine(ItemNo)), otherwise assignment will be ignored.

You need to reformat RichView after this assignment (using Format).

In editor you can change value of this property as an editing operation, using ClearTextFlow method.

See also:

•	ClearLeft,

•	PageBreaksBeforeItems,

•	TRVVAlign type (rvvaRight).


TRichView.Color
 TRichView Reference | TRichView

TCustomRichView.Color

Background color

property Color: TColor;

This property allows to override the default background color specified in RichView.Style.Color.

RichView paints background with this color, if it is not equal to clNone, otherwise RichView uses the default color.

Background color is used if BackgroundBitmap is empty, or BackgroundStyle is not equal to bsStretched, bsTiled or bsTiledAndScrolled.

Default value:

clNone

See also properties:

•	BackgroundStyle;

•	BackgroundBitmap.

See also properties of TRVStyle:

•	Color.


TRichView.CPEventKind
 TRichView Reference | TRichView

TCustomRichView.CPEventKind

Specifies the mode of generating OnCheckpointVisible event.

type

  TCPEventKind =

   (cpeNone, cpeAsSectionStart, cpeWhenVisible);

property CPEventKind: TCPEventKind;

Note: TCPEventKind is declared in RVScroll unit.

Value	Meaning
cpeNone	OnCheckpointVisible does not occur
cpeAsSectionStart	OnCheckpointVisible is called for visible checkpoint or the nearest checkpoint above the visible area (so that the last event is always called for checkpoint located in or above the visible area)
cpeWhenVisible	OnCheckpointVisible is generated for visible checkpoint
This event occurs only for checkpoints having "raise event" flag.

This event never occurs in TRichViewEdit (in this version)

See also events:

•	OnCheckpointVisible.

See also:

•	Checkpoints for details.


TRichView.Cursor
 TRichView Reference | TRichView

TCustomRichView.Cursor

Specifies the image used to represent the mouse pointer when it passes into the region covered by the control.

property Cursor: TCursor;

Default value:

•	crDefault for TRichView;

•	crIBeam for TRichViewEdit.

See also:

•	RichViews' cursors.


TRichView.Delimiters
 TRichView Reference | TRichView

TCustomRichView.Delimiters

Set of delimiters for specifying a "word" in document

property Delimiters: String;

Each character of this string is one delimiter.

 Unicode note: in Delphi/C++Builder 2009 or newer, this property contains Unicode text. For older versions, it contains ANSI text.

Default value (changed in version 10)

' .;,:(){}"/\<>!?[]'#$91#$92#$93#$94'-+*='#$A0#$84

See also methods:

•	SelectWordAt;

•	GetWordAt;

•	SearchText.

See also events:

•	OnRVDblClick;

•	OnRVRightClick.

See also methods of TRichViewEdit:

•	SelectCurrentWord.

See also:

•	Live spelling check.


TRichView.DocParameters
 TRichView Reference | TRichView

TCustomRichView.DocParameters

Page properties.

property DocParameters: TRVDocParameters;

(introduced in version 10)

Subproperties of this property are not used by TRichView itself, but can be written and read in RVF and RTF.

Besides, they can be assigned to TRVPrint using the method AssignDocParameters.

RVF

DocParameters are stored with DocProperties.

How to save to RVF: include rvfoSaveDocProperties in RVFOptions.

How to load from RVF: include rvfoLoadDocProperties in RVFOptions.

RTF

How to save to RTF: include rvrtfSaveDocParameters in RTFOptions.

How to load from RTF: set RTFReadProperties.ReadDocParameters = True.

See also events:

•	OnSaveRTFExtra.


TRichView.DocProperties
 TRichView Reference | TRichView

TCustomRichView.DocProperties

Text strings to store in RVF file or stream

property DocProperties: TStringList;

(introduced in v1.8)

This property is public,so it is not available at design time.

Items of this list can contain line break characters (#13 and #10), but cannot contain #01 and #02 characters.

If rvfoSaveDocProperties is in RVFOptions, these strings are saved in RVF.

If rvfoLoadDocProperties is in RVFOptions, methods for loading RVF load these strings. Methods for inserting RVF ignore these strings.

Method TRichView.Clear clears DocProperties.

See also methods for saving RVF (they can save this property):

•	SaveRVF;

•	SaveRVFToStream.

See also methods for loading RVF (they can load this property):

•	LoadRVF;

•	LoadRVFFromStream.

See also methods of TRichViewEdit for inserting RVF in the caret position (they ignore this property):

•	InsertRVFFromFileEd;

•	InsertRVFFromStreamEd;

•	PasteRVF.

See also methods for inserting RVF (they ignore this property):

•	InsertRVFFromStream;

•	AppendRVFFromStream.

See also properties:

•	RVFOptions.

See also:

•	Saving and loading RichView documents;

•	RVF.


TRichView.DocumentHeight
 TRichView Reference | TRichView

TCustomRichView.DocumentHeight (read-only)

Height of document (height of scrollable area)

property DocumentHeight: Integer;

Document must be formatted to obtain correct value.

This value is multiple of VSmalStep.

Example:

if MyRichView.DocumentHeight>Screen.Height then

  MyRichView.Height := Screen.Height

else

  MyRichView.Height := MyRichView.DocumentHeight;

See also:

•	Scrolling.


TRichView.DoInPaletteMode
 TRichView Reference | TRichView

TCustomRichView.DoInPaletteMode

Defines behavior of RichView when drawn in 256-color mode display.

type

  TRVPaletteAction =

    (rvpaDoNothing, rvpaAssignPalette,

     rvpaCreateCopies, rvpaCreateCopiesEx);

property DoInPaletteMode: TRVPaletteAction.

Note: TRVPaletteAction is declared in RVScroll unit.

Please always set DoInPaletteMode to rvpaDoNothing under Delphi 2 and C++Builder 1.Palette mode improvements are not available for these versions.

This property affects only displaying in-256 color mode and does nothing in highcolor and truecolor modes.

Windows XP does not support 256-color mode.

Mode	Meaning
rvpaDoNothing	RichView does nothing with palette. Use if you have no pictures in RichView, or all pictures are in VGA 16-color palette.
rvpaAssignPalette	When working in 256-color mode, RichView creates palette and assigns it to all pictures (including background). This will affect all pictures that already in RichView, and all pictures that will be inserted later (when in 256-color mode). This is also not very good option, because pictures lose their quality, and it can't be restored when switching to highcolor/truecolor mode. Output to RVF, HTML, clipboard, printer will lose quality of pictures. So use this option if you want only to display document.
rvpaCreateCopies	(default and preferred option) In 256-color mode, RichView creates copies of all pictures (including background) and assign palette to them. This will affect all pictures that already in RichView, and all pictures that will be inserted later (when in 256-color mode). This work is absolutely "transparent" for you, you will work with source pictures that remain unchanged.
rvpaCreateCopiesEx	For future versions, do not use (idea: copies of pictures may be created not in format of source picture, but in some better format)
Notes:

1.	If you have other controls on form which also change palette (such as TImage, or buttons with multicolor glyphs), you can not achieve required results.

2.	If you use multicolor hotspots or bullets in RichView, it's recommended to have two sets of them: 16color for 16- and 256-color modes, and multicolor for others.

3.	RichView can't change palette of bitmaps inside metafiles; do not use TMetafile containing multicolor bitmaps in 256-color mode.

4.	RichView can't update information about palette when user switches color resolution without restarting Windows. Please do it yourself, as it's shown below.

5.	If you create RichViews, RichViewEdits, RVPrintPreviews, RVPrints at run-time (such as MyRichView := TRichView.Create(Self)), you need to call UpdatePaletteInfo methods of such controls after you have created them.

In the main form write...

In interface section:

procedure WMDisplayChange(var Message: TWMDisplayChange); message WM_DISPLAYCHANGE;

In implementation:

procedure TMyForm.WMDisplayChange(var Message: TWMDisplayChange);

begin

  // Call UpdatePaletteInfo methods of all your

  // RichViews, RichViewEdits, and RVPrints (if you use print preview)

  // for example:

  MyRichViewEdit.UpdatePaletteInfo;

  MyRVPrint.UpdatePaletteInfo;

end;

Default value:

rvpaCreateCopies

(or rvpaDoNothing in Delphi 2 and C++Builder 1)

RichView uses the palette displayed below (the same as Microsoft Internet Explorer uses):

If you need to use you own palette, let me know, I will create a public property for it. Now you can override the protected dynamic method GenerateLogPalette (introduced in TRVScroller).

See also methods:

•	UpdatePaletteInfo.

See also methods of TRVPrint:

•	UpdatePaletteInfo.


TRichView.FirstItemVisible
 TRichView Reference | TRichView

TCustomRichView.FirstItemVisible (read-only)

Index of the first visible (in window) item, or -1 if the document is empty.

property FirstItemVisible: Integer;

You can use this property (for example, in OnVScrolled event handler) to get the index of the first visible item.

This property does not take horizontal scrolling into account, only vertical one.

Note: returning value of this property requires some calculations; so if you need to use it several times in the same procedure, assign its value to some temporary variable and then use this variable.

See also properties:

•	LastItemVisible.

See also:

•	Vertical scrolling.


TRichView.FirstJumpNo
 TRichView Reference | TRichView

TCustomRichView.FirstJumpNo

Hypertext id for the first hyperlink in the document.

property FirstJumpNo: Integer;

When you append hypertext items (hotspots, hot-pictures or text of hypertext style), RichView assigns hypertext identifiers to them. The first such item has id=FirstJumpNo, the next one – FirstJumpNo+1 and so on.

All hypertext items have hypertext ids. Ids are incremented according to their order in the document, from top to bottom.

This property is useful if you want to use one OnJump event handler for several RichViews.

Default value:

0

See also:

•	RichView hypertext.


TRichView.ItemCount
 TRichView Reference | TRichView

TCustomRichView.ItemCount (read only)

Number of items in RichView

property ItemCount: Integer;

See also:

•	Item types;

•	Adding items;

•	Obtaining items;

•	Modifying items.


TRichView.LastItemVisible
 TRichView Reference | TRichView

TCustomRichView.LastItemVisible (read only)

Index of the last visible (in window) item, or -1 if the document is empty.

property LastItemVisible: Integer;

You can use this property (for example, in OnVScrolled event handler) to get the index of the last visible item.

This property does not take horizontal scrolling into account, only vertical one.

Note: returning value of this property requires some calculations; so if you need to use it several times in the same procedure, assign its value to some temporary variable and then use this variable.

See also properties:

•	FirstItemVisible.

See also:

•	Vertical scrolling.


TRichView.LeftMargin
 TRichView Reference | TRichView

TCustomRichView.LeftMargin

Left margin of document

property LeftMargin: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, and margins on the page look like margins on the screen.

Left margin can be used for selecting lines with the mouse.

See also properties:

•	RightMargin;

•	TopMargin;

•	BottomMargin.

See also indents in paragraph style.

See also properties of TRVPrint:

•	LeftMarginMM;

•	RightMarginMM;

•	TopMarginMM;

•	BottomMarginMM.

See also properties of TRVStyle:

•	LineSelectCursor.

See also:

Additional information about horizontal scrolling, margins, indents, etc.


TRichView.LineCount
 TRichView Reference | TRichView

TCustomRichView.LineCount

Obsolete, use ItemCount.

property LineCount : Integer;

See also

•	GetLineNo.


TRichView.MaxLength
 TRichView Reference | TRichView

TCustomRichView.MaxLength

Allows to to limit a number of characters per line.

property MaxLength: Integer;

(introduced in version 10)

Set this property to positive value to limit a number of characters per line. Non-text items are treated like one character.

This property affects only word wrapping.

This property is ignored if WordWrap = False. This property is ignored for paragraphs having rvpaoNoWrap in Options.

Default value:

0


TRichView.MaxTextWidth
 TRichView Reference | TRichView

TCustomRichView.MaxTextWidth

If set to positive value, it is a maximal width for text wrapping (text wraps when its length in pixels exceeds this value)

property MaxTextWidth: Integer;

This property does not affect printing.

Default value:

0

See horizontal scrolling for details.

See also properties:

•	MaxLength.


TRichView.MinTextWidth
 TRichView Reference | TRichView

TCustomRichView.MinTextWidth

Minimum width for text wrapping. This value allows to increase width of scrollable area in TRichView.

property MinTextWidth : Integer;

This property does not affect printing.

Default value:

0

See horizontal scrolling for details.


TRichView.NoteText
 TRichView Reference | TRichView

TCustomRichView.NoteText

Text for references to the parent footnote/endnote.

property NoteText: String;

(introduced in version 10)

Normally, references must be placed in Document for footnotes or endnotes. In this case, they display the same text as their parent note.

References should not appear in TCustomRichView, but the user can copy them here. In this case, they display text specified in this property.

If this TCustomRichView is used for displaying/editing Document for some footnote or endnote, you should set value of this property to Text of this note.

 Unicode note: in Delphi/C++Builder 2009 or newer, this property contains Unicode text. For older versions, it contains ANSI text.

Default value:

'?'


TRichView.Options
 TRichView Reference | TRichView

TCustomRichView.Options

Options

type

  TRVOption = (rvoAllowSelection, rvoSingleClick, rvoScrollToEnd,

    rvoClientTextWidth,

    rvoShowCheckpoints, rvoShowPageBreaks,rvoShowSpecialCharacters,

    rvoTagsArePChars,

    rvoAutoCopyText,  rvoAutoCopyUnicodeText

    rvoAutoCopyRVF, rvoAutoCopyImage,

    rvoAutoCopyRTF,

    rvoFormatInvalidate,

    rvoDblClickSelectsWord, rvoRClickDeselects,

    rvoDisallowDrag, rvoShowItemHints, rvoFastFormatting);

  TRVOptions = set of TRVOption;

property Options: TRVOptions;

Note: TRVOption and TRVOptions are declared in RVScroll unit.

Default value

For Delphi/C++Builder 2009 or newer: [rvoAllowSelection, rvoScrollToEnd, rvoAutoCopyUnicodeText, rvoAutoCopyImage, rvoAutoCopyRVF, rvoAutoCopyRTF, rvoDblClickSelectsWord, rvoRClickDeselects, rvoFormatInvalidate, rvoShowPageBreaks, rvoFastFormatting]

For older versions: the same, but with rvoAutoCopyText instead of rvoAutoCopyUnicodeText.

General Options

Option	Meaning
rvoTagsArePChars	If cleared (default), items tags are treated as integer values. If set, items tags are treated as pointers to dynamically allocated strings. See details Can be changed: when document is empty or does not contain nonzero tags.
rvoClientTextWidth	If set, text always wraps to fit client width of RichView. Also affects breaks and tables. See details. Can be changed: any time, but you need to reformat and repaint RichView after changing this option, if the document was already formatted.
rvoScrollToEnd	If set (default), RichView scrolls to the end of document when FormatTail method is called. If cleared, document does not scroll in this case Can be changed: any time.
rvoSingleClick	If set, OnRVDblClick event is generated on single mouse click If cleared (default), it is generated on double mouse click Can be changed: any time.
rvoFormatInvalidate	If set (default), Format and FormatTail methods repaint component. Can be changed: any time.
rvoDisallowDrag	If set, dragging from this TRichView is not allowed. Can be changed: any time.
rvoFastFormatting	Increase performance in WinNT-based OS at the cost of some resources
Selection Options

Can be changed: any time.

Option	Meaning
rvoAllowSelection	If set (default), user can select content of RichView using mouse or keyboard. Please do not clear this option for TRichViewEditor! See: working with selection.
rvoDblClickSelectsWord	If set (default), double click on word selects it (and double click on non-text item selects this item)
rvoRClickDeselects	If set (default), right click outside the selected area deselects (and moves caret to the clicked position in TRichViewEdit)
Show/Hide Options

Option	Meaning
rvoShowCheckpoints	If set, all checkpoints are shown (as dotted vertical lines, or by OnDrawCheckpoint). See details. Can be changed: any time, you need to repaint RichView after changing this option
rvoShowPageBreaks	If set (default), page breaks are shown as horizontal lines. Can be changed: any time, you need to repaint RichView after changing this option
rvoShowSpecialCharacters	If set, nonprinting characters are displayed as special marks: spaces, nonbreaking spaces, paragraph breaks, line breaks, tabs, soft hyphens in Unicode text. Can be changed: any time, you need to reformat RichView after changing this option, if the document is already formatted. See also: RVVisibleSpecialCharacters, RichViewShowGhostSpaces typed constants.
rvoShowItemHints	If set, items' hints are shown. Popup hints are shown only if ShowHints property is set to True. See item properties and OnItemHint event.
Clipboard Options (See Details)

If set , RichView copies selection to the Clipboard in the specified format when user presses  Ctrl + Insert  or  Ctrl + C . These options also affect CopyDef. These options can be changed any time.

Option	Format to Copy
rvoAutoCopyText	ANSI text
rvoAutoCopyUnicodeText	Unicode text
rvoAutoCopyRVF	RVF (RichView Format)
rvoAutoCopyRTF	RTF (Rich Text Format)
rvoAutoCopyImage	Bitmap or metafile (if the image is selected)


TRichView.PageBreaksBeforeItems
 TRichView Reference | TRichView

TCustomRichView.PageBreaksBeforeItems

Specifies if the Index-th item must start a new page when printing

property PageBreaksBeforeItems[Index: Integer]: Boolean

(Introduced in version 1.2)

Set PageBreaksBeforeItems[ItemNo] to True if you want the ItemNo-th item to start a new page. This assignment forces the item to start a new paragraph.

If PageBreaksBeforeItems[ItemNo]=True, a text flow for this item is cleared for both left and right side, i.e. such item is placed as if ClearLeft[ItemNo] and ClearRight[ItemNo] = True. Because of this, assignment to this property requires reformatting.

RichView never prints blank pages. So, for example, PageBreaksBeforeItems[0] has no effect (because it will start a new page in any case).

Editor has additional methods for working with explicit page breaks.

See also:

•	Options (rvoShowPageBreaks).

See also methods:

•	AssignSoftPageBreaks.

See also properties and events of TRVStyle:

•	PageBreakColor;

•	OnDrawPageBreak.

See also methods of TRichViewEdit:

•	InsertPageBreak;

•	RemoveCurrentPageBreak.


TRichView.RightMargin
 TRichView Reference | TRichView

TCustomRichView.RightMargin

Right margin of document

property RightMargin: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, and margins on pages look like margins on the screen.

See also properties:

•	LeftMargin;

•	TopMargin;

•	BottomMargin.

See also indents in paragraph style

See also properties of TRVPrint:

•	LeftMarginMM;

•	RightMarginMM;

•	TopMarginMM;

•	BottomMarginMM.

See also properties of TRVStyle:

•	LineSelectCursor.

See also:

Additional information about horizontal scrolling, margins, indents, etc.


TRichView.RTFOptions
 TRichView Reference | TRichView

TCustomRichView.RTFOptions

Options for saving RTF (Rich Text Format).

type

  TRVRTFOption = (rvrtfSaveStyleSheet,

    rvrtfDuplicateUnicode, rvrtfSaveEMFAsWMF,

    rvrtfSaveJpegAsJpeg, rvrtfSaveBitmapDefault,

    rvrtfSaveEMFDefault, rvrtfSavePicturesBinary,

    rvrtfPNGInsteadOfBitmap,

    rvrtfSaveDocParameters, rvrtfSaveHeaderFooter);

  TRVRTFOptions = set of TRVRTFOption;

property RTFOptions: TRVRTFOptions;

(introduced in versions 1.3, 10, 11)

Note: TRVRTFOption and TRVRTFOptions are declared in RVStyle unit.

Option	Meaning
rvrtfSaveStyleSheet	If set (not recommended), RichView saves style sheet in RTF. Usually it's not needed, many RTF readers just skip style sheet.
rvrtfDuplicateUnicode	If set, RichView saves ANSI equivalent of Unicode text. Conversion is based on Charset property of text styles. Turning off this option causes speed up and generates much smaller RTF file. Unicode-enabled RTF readers just ignore ANSI equivalent of Unicode characters.
rvrtfSaveEMFAsWMF	If set, RichView saves EMF (enhanced (Win32) metafiles) as WMF (Windows (Win3.1) metafiles). Some RTF readers do not understand EMF in RTF.
rvrtfSaveJpegAsJpeg	If set, RichView saves Jpegs (Delphi 3+ required) as Jpegs. Some RTF readers do not understand Jpegs in RTF. Otherwise, RichView saves Jpegs in other formats (see below).
rvrtfSaveBitmapDefault	If set, RichView saves graphics formats other than bitmaps, metafiles (and optionally Jpegs) as bitmaps. If not set, as WMF or EMF (see below). See also rvrtfPNGInsteadOfBitmap below. (unfortunately, many RTF reader do not understand WMF with mapping mode = MM_TEXT, which RichView uses for saving other formats; some other RTF readers do not understand bitmaps).
rvrtfSaveEMFDefault	If set (and rvrtfSaveBitmapDefault is not set), RichView saves graphics formats other than bitmaps (and optionally Jpegs) as EMF. If not set, as WMF
rvrtfSavePicturesBinary	If set, pictures are saved in binary format. Less in size (twice), but such RTF becomes a binary file (and cannot be stored in MEMO field of data bases)
rvrtfPNGInsteadOfBitmap	If included, and PNG class is registered with RV_RegisterPngGraphic, bitmaps are saved as PNG (including saving of non-RTF picture types, if rvrtfSaveBitmapDefault is included). Not all RTF readers understand PNG.
rvrtfSaveDocParameters	If included, properties of DocParameters are saved in RTF.
rvrtfSaveHeaderFooter	If included, documents assigned by RTFReadProperties.SetHeader and .SetFooter are saved as a header and footer in RTF. Affects only SaveRTF method (not SaveRTFToStream).
Default value

[rvrtfDuplicateUnicode, rvrtfSaveEMFAsWMF, rvrtfSaveJpegAsJpeg]

See also methods:

•	SaveRTF;

•	SaveRTFToStream;

•	CopyRTF.

See also:

•	Saving and loading in RichView;

•	Pictures.


TRichView.RTFReadProperties
 TRichView Reference | TRichView

TCustomRichView.RTFReadProperties

Properties    Methods

A set of properties controlling RTF (Rich Text Format) import.

property RTFReadProperties: TRVRTFReaderProperties;

Read the help on TRVRTFReaderProperties for details.

Subproperties of this class affect the following methods:

•	TRichView.LoadRTF;

•	TRichView.LoadRTFFromStream;

•	TRichViewEdit.PasteRTF (and Paste);

•	TRichViewEdit.InsertRTFFromStreamEd;

•	TRichViewEdit.InsertRTFFromFileEd;

•	drag&drop when dropping RTF file.

See also:

•	RTFOptions (options for RTF export).


TRichView.RVData
 TRichView Reference | TRichView

TCustomRichView.RVData (read-only)

This read-only property points to an object containing RichView document.

Each TRichView control owns one such object.

Similar objects represent cells in tables.

Many RichView methods actually call methods of this object inside, for example:

procedure TRichView.AddNL(const s: String; StyleNo, ParaNo: Integer);

begin

  RVData.AddNL(s, StyleNo, ParaNo);

end;

A class of RVData is derived from the abstract base class TCustomRVFormattedData, which is in its order derived from TCustomRVData.

This object can be used for creating procedures working with any document object (main TRichView or cells).

For example, see AllUpperCase procedure in Controls, Documents, Items.


TRichView.RVFOptions
 TRichView Reference | TRichView

TCustomRichView.RVFOptions

Options for reading and saving RVF (RichView Format)

type

  TRVFOption =

    (rvfoSavePicturesBody, rvfoSaveControlsBody,

    rvfoIgnoreUnknownPicFmt, rvfoIgnoreUnknownCtrls,

    rvfoIgnoreUnknownCtrlProperties

    rvfoConvUnknownStylesToZero,

    rvfoConvLargeImageIdxToZero,

    rvfoSaveBinary,

    rvfoUseStyleNames,

    rvfoSaveBack, rvfoLoadBack,

    rvfoSaveTextStyles, rvfoSaveParaStyles,

    rvfoSaveLayout, rvfoLoadLayout,

    rvfoSaveDocProperties, rvfoLoadDocProperties);

  TRVFOptions = set of TRVFOption;

property RVFOptions: TRVFOptions;

Note: TRVFOption and TRVFOptions are defined in RVStyle unit.

Options for Saving

Option	Meaning
rvfoSavePicturesBody	• If set, full information about all pictures in RichView are saved in RVF. • If not set, OnRVFPictureNeeded event occurs on loading.
rvfoSaveControlsBody	• If set, full information about all controls in RichView are saved in RVF. • If not set, OnRVFControlNeeded event occurs loading.
rvfoSaveBinary	• If set, all non-text data are saved in RVF as they are (pictures, controls, tables, background, styles, Unicode text). • If not set, all binary data are converted to text (hexadecimal string); RVF becomes a plain text format, like RTF, but file size is increased.
rvfoSaveBack	(since version 1.2) If set, background (color and image) is saved in RVF. This flag affects only saving the whole document; selection is never saved (or copied to the Clipboard) with background. (see rvfoLoadBack below)
rvfoUseStyleNames (almost obsolete)	If set, TRichView saves quoted names of text and paragraph styles instead of their indices Pluses: • content of file remains synchronized with collections of styles even if you delete or insert new styles; Minuses: • increased file size; • names of styles must be unique; • files become sensitive to changing style names. It's not recommended to use this options together with rvfoSaveTextStyles and rvfoSaveParaStyles.
rvfoSaveTextStyles	If set, collection of text styles associated with this RichView (TextStyles property of the linked TRVStyle component) is saved in RVF. See RVFTextStylesReadMode property.
rvfoSaveParaStyles	If set, collections of paragraph and list styles associated with this RichView  (ParaStyles and ListStyles properties of the linked TRVStyle component)  are saved in RVF. See RVFParaStylesReadMode property.
rvfoSaveLayout	If set, the following properties are stored in RVF: Left-, Right-, Top-, BottomMargin, MinTextWidth, MaxTextWidth, BiDiMode. Layout is saved only when saving the whole document (not selection). (see rvfoLoadLayout below)
rvfoSaveDocProperties	If set, DocProperties and DocParameters are saved in RVF. (see rvfoLoadDocProperties below)
Options for Loading

Option	Meaning
rvfoLoadBack	If not set, RichView ignores background information, saved in RVF. (see rvfoSaveBack above)
rvfoIgnoreUnknownPicFmt	• If set, RichView skips pictures of unknown (unregistered) classes. • if not set, RVF reading methods return False (failure value) if pictures of unknown classes exist in RVF
rvfoIgnoreUnknownCtrls	The same as rvfoIgnoreUnknownPicFmt, but for controls
rvfoIgnoreUnknownCtrlProperties	If set, RichView ignores errors occurred while reading inserted controls
rvfoConvLargeImageIdxToZero	• If set, too large (>=Imagelist.Count) image indices for bullets and hotspots are converted to 0. • if not set, RVF reading methods return False (failure value) in such case.
rvfoConvUnknownStylesToZero	• If set, RichView converts too large (>= RichView.Style.TextStyles.Count, or RichView.Style.ParaStyles.Count) style indices to 0. • If not set, RVF reading methods return False (failure value) in such case.
rvfoLoadLayout	If not set, RichView ignores layout information saved in RVF (see rvfoSaveLayout above)
rvfoLoadDocProperties	If set, DocProperties and DocParameters are loaded from RVF (but not by methods for RVF insertion) (see rvfoSaveDocProperties above)
See RVF Overview for details.

Default value:

[rvfoSavePicturesBody, rvfoSaveControlsBody, rvfoSaveBinary, rvfoSaveDocProperties, rvfoLoadDocProperties];

Default value for components, placed on form at design time (can be changed in TRichView component editor):

[rvfoSavePicturesBody, rvfoSaveControlsBody, rvfoSaveBinary, rvfoSaveDocProperties, rvfoLoadDocProperties, rvfoSaveTextStyles, rvfoSaveParaStyles];

See also:

•	RVFWarnings


TRichView.RVFParaStylesReadMode
 TRichView Reference | TRichView

TCustomRichView.RVFParaStylesReadMode

Specifies how paragraph styles and list styles are loaded from RVF files or streams.

property RVFParaStylesReadMode: TRVFReaderStyleMode;

(Introduced in version 1.5)

See topic on TRVFReaderStyleMode type for details.

Paragraph styles are saved in RVF optionally.

Default value:

rvf_sInsertMerge

See properties:

•	RVFTextStylesReadMode;

•	RVFOptions.

See also:

•	RVF Overview


TRichView.RVFTextStylesReadMode
 TRichView Reference | TRichView

TCustomRichView.RVFTextStylesReadMode

Specifies how text styles are loaded from RVF files or streams.

property RVFTextStylesReadMode: TRVFReaderStyleMode;

(Introduced in version 1.5)

See topic on TRVFReaderStyleMode type for details.

Text styles are saved in RVF optionally.

Default value:

rvf_sInsertMerge

See properties:

•	RVFParaStylesReadMode;

•	RVFOptions.

See also:

•	RVF Overview.


TRichView.RVFWarnings
 TRichView Reference | TRichView

TCustomRichView.RVFWarnings (read-only)

Information about the last performed RVF reading operation.

type

  TRVFWarning = (

    rvfwUnknownPicFmt, rvfwUnknownCtrls,

    rvfwConvUnknownStyles, rvfwConvLargeImageIdx,

    rvfwConvToUnicode, rvfwConvFromUnicode,

    rvfwInvalidPicture, rvfwUnknownCtrlProperties);

  TRVFWarnings = set of TRVFWarning;

property RVFWarnings: TRVFWarnings;

Note: TRVFWarning and TRVFWarnings are defined in RVStyle unit.

You can use this property to know about warnings or errors that may be occurred during the last reading from RVF.

Depending on RichView.RVFOptions some cases could be considered as warnings (and reading method was successfully finished) or errors.

Warning	Meaning
rvfwUnknownPicFmt	Pictures of unknown classes exist in RVF. See rvfoIgnoreUnknownPicFmt.
rvfwUnknownCtrls	Controls of unknown classes exist in RVF. See rvfoIgnoreUnknownCtrls.
rvfwConvLargeImageIdx	Bullets or hotspots with too large image indices exist in RVF. See rvfoConvLargeImageIdxToZero.
rvfwConvUnknownStyles	Text, paragraph or list styles with too large indices exist in RVF. See rvfoConvUnknownStylesToZero.
rvfwConvToUnicode rvfwConvFromUnicode	There was a conversion from ANSI text in RVF file to Unicode in RichView or vice versa. This is a result of loading RVF file with set of styles different from one which was used when saving. Conversion is performed automatically, without generating errors.
rvfwInvalidPicture	Some pictures were replaced with InvalidPicture.
rvfwUnknownCtrlProperties	There was error when reading inserted controls (for example, unknown properties)
See RVF Overview for details.

Methods reading RVF:

•	LoadRVFFromStream;

•	InsertRVFFromStream;

•	AppendRVFFromStream;

•	LoadRVF.

Methods of RichViewEdit reading RVF:

•	InsertRVFFromFileEd;

•	InsertRVFFromStreamEd;

(also PasteRVF and Paste, but in this version you can't detect when Clipboard reading operation is finished).


TRichView.SingleClick
 TRichView Reference | TRichView

TCustomRichView.SingleClick

property SingleClick : Boolean;

Obsolete, please use rvoSingleClick in Options;


TRichView.Style
 TRichView Reference | TRichView

TCustomRichView.Style

Style of TRichView:

property Style : TRVStyle;

This property provides link to TRVStyle component.

TRVStyle define many properties for document appearance, and, the most important, it contains collections of text, paragraph and list styles for TRichView document.

RichView can display its contents only if its style is defined.


TRichView.TabNavigation
 TRichView Reference | TRichView

TCustomRichView.TabNavigation

Mode of  Tab  and  Shift + Tab  navigation

type

  TRVTabNavigationType =

    (rvtnNone, rvtnTab, rvtnCtrlTab)

property TabNavigation: TRVTabNavigationType;

(introduced in version 1.3)

Mode	Meaning
rvtnNone	No special actions for  Tab  (default for TRichViewEdit). A focus (dotted) rectangle is not drawn around hyperlinks, it's impossible to open hyperlink with  Enter .
rvtnTab	Tab-navigation through links and controls using  Tab  and  Shift + Tab  (default for TRichView);
rvtnCtrlTab	Tab navigation through links using  Ctrl + Tab  and  Ctrl + Shift + Tab . Has a limited application since users still need to use  Tab  and  Shift + Tab  when the focus is set on inserted control.
Note: a special tab navigation is not supported in editor. Although it has TabNavigation property, it's impossible to change its value from rvtnNone.

See also:

•	GetFocusedItem method.


TRichView.TopMargin
 TRichView Reference | TRichView

TCustomRichView.TopMargin

Top margin of document

property TopMargin: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, and margins on pages look like margins on the screen.

See also properties:

•	LeftMargin;

•	RightMargin;

•	BottomMargin.

See also properties of TRVPrint:

•	LeftMarginMM;

•	RightMarginMM;

•	TopMarginMM;

•	BottomMarginMM.

See also:

Additional information about horizontal scrolling, margins, indents, etc.


TRichView.VAlign
 TRichView Reference | TRichView

TCustomRichView.VAlign (Delphi3+)

Vertical align of the document relative to the control window: top, center, or bottom.

property VAlign: TTextLayout;

(introduced in v1.9)

This property is in effect if height of the document is less than height of the TRichView window.

See also:

•	ClientToDocument method.


TRichView.VSmallStep
 TRichView Reference | TRichView

TCustomRichView.VSmallStep

Number of pixels in one step of vertical scrollbar

property VSmallStep: Integer;

When VScrollPos is changes by 1, the window is scrolled by VSmallStep pixels.

This is one "RVSU", see Scrolling in RichView

Default value:

10

See also properties:

•	VScrollPos;

•	VScrollMax;

•	VScrollVisible.


TRichView.WordWrap
 TRichView Reference | TRichView

TCustomRichView.WordWrap

Allows to disable word wrapping.

property WordWrap: Boolean;

(introduced in version 10)

If True, documents are formatted normally.

If False, all word wrapping is disabled. Unlike rvpaoNoWrap option of paragraph style, this property should be considered as a control (view) property, not as a document property. It is not stored in RVF.

Default value:

True


TRichView.AddBreakExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag

These methods add break (horizontal line) to the end of document.

procedure AddBreakExTag(Width: Byte; Style: TRVBreakStyle;

  Color: TColor; Tag: Integer);

procedure AddBreak;

procedure AddBreakEx(Width: Byte; Style: TRVBreakStyle;

  Color: TColor);

procedure AddBreakTag(Tag:Integer);

AddBreak, AddBreakEx, AddBreakTag provide subsets of functionality of AddBreakExTag method:

•	AddBreak is equivalent to AddBreakExTag(1, rvbsLine, clNone, 0).

•	AddBreakEx(...) is equivalent to AddBreakExTag(..., 0).

•	AddBreakTag(Tag) is equivalent to AddBreakExTag(1, rvbsLine, clNone, Tag).

Parameters:

Width – width of line (can be in range from 1 to 10);

Style – break type;

Color – color of line. If it is equal to clNone, the break has the color of the 0th text style.

Tag – tag of this break.

For default HTML <hr> appearance, parameters must be: Style=rvbs3d, Width=2.

Methods type:  viewer-style.

See also methods:

•	Format;

•	FormatTail.

See also methods of TRichViewEdit:

•	InsertBreak.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags".


TRichView.AddBulletExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddBulletEx, AddBulletExTag

TCustomRichView.AddBullet (deprecated)

These methods add bullet (image from TImageList) to the end of document.

procedure AddBulletExTag(const Name: TRVAnsiString;

  ImageIndex: Integer; ImageList: TCustomImageList;

  ParaNo,Tag: Integer);

procedure AddBulletEx(const Name: TRVAnsiString; ImageIndex: Integer;

  ImageList: TCustomImageList; ParaNo: Integer);

procedure AddBullet(ImageIndex: Integer; ImageList: TCustomImageList;

  fromnewline: Boolean); deprecated;

AddBulletEx provides a subset of functionality of AddBulletExTag:

•	AddBulletEx(...) is equivalent to AddBulletExTag(..., 0).

AddBullet is deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0):

•	AddBullet(ImageIndex, ImageList, True) is equivalent to AddBulletEx('', ImageIndex, ImageList, 0).

•	AddBullet(ImageIndex, ImageList, False) is equivalent to AddBulletEx('', ImageIndex, ImageList,  -1).

Alternatives:

•	If you want to add a hyperlink-picture from image list, add a hotspot instead.

•	If you want to add a TGraphic picture, add a picture instead.

•	If you want to add a TGraphic picture-hyperlink, add a hot picture instead.

Parameters:

Name – name of bullet, any string. Name must not contain CR and LF characters. RichView does not use Names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

ImageIndex – index of image in ImageList.

ImageList – image list for this bullet. RichView does not own, does not copy and does not destroy imagelists, it just holds pointers to them. So this image list is not destroyed when the document is cleared.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this bullet.

Methods type:  viewer-style.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertBullet.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags".


TRichView.AddCenterLine, AddFromNewLine
 TRichView Reference | TRichView

TCustomRichView.AddCenterLine, AddFromNewLine (deprecated)

These methods add one text item using the StyleNo-th text style to the end of document.

procedure AddCenterLine(const s: String; StyleNo:Integer); deprecated;

procedure AddFromNewLine(const s: String; StyleNo:Integer); deprecated;

AddFromNewLine and AddCenterLine are deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0):

•	AddCenterLine(s, StyleNo) is equivalent to AddNL(s, StyleNo, 1).

•	AddFromNewLine(s, StyleNo) is equivalent to AddNL(s, StyleNo, 0).

Parameters:

s is a text string to add. It must not contain CR, LF, TAB, FF characters (#13, #10, #9, #12). To add several lines of text use AddTextNL.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

Methods type:  viewer-style

See also methods:

•	AddNL.


TRichView.AddControlExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddControlEx, AddControlExTag

TCustomRichView.AddControl (deprecated)

These methods add Delphi control to the end of document.

procedure AddControlExTag(const Name: TRVAnsiString; ctrl: TControl;

  ParaNo: Integer; VAlign: TRVVAlign; Tag: Integer);

procedure AddControlEx(const Name: TRVAnsiString; ctrl: TControl;

  ParaNo: Integer; VAlign: TRVVAlign);

procedure AddControl(ctrl: TControl; center: Boolean); deprecated;

AddControlEx provides a subset of functionality of AddControlExTag:

•	AddControlEx(...) is equivalent to AddControlExTag(..., 0)

AddControl is deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0):

•	AddControl(ctrl, True) is equivalent to AddControlEx('', ctrl, 1, rvvaBaseline);

•	AddControl(ctrl, False) is equivalent to AddControlEx('', ctrl, 0, rvvaBaseline).

Parameters:

Name – name of this control item, any string. Name must not contain CR and LF characters. RichView does not use Names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles. Do not confuse with ctrl.Name property.

ctrl – control to insert.

VAlign – vertical align of this control, relative to its line, see TRVVAlign for possible values.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this control item. Do not confuse with ctrl.Tag property.

Methods type:  viewer-style.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertControl.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags".


TRichView.AddFmt
 TRichView Reference | TRichView

TCustomRichView.AddFmt

Adds a formatted string assembled from a Pascal format string and an array arguments, using the StyleNo-th text style and the ParaNo-th paragraph style to the end of document.

procedure AddFmt(const FormatStr: String;

  const Args: array of const; StyleNo, ParaNo: Integer);

AddFmt(FormatStr, Args, StyleNo, ParaNo) is equivalent to AddNL(Format(FormatStr,Args), StyleNo, ParaNo).
(where Format is not a method of TRichView, but SysUtils.Format)

Note: TRichView allows empty text strings only in empty paragraphs (may be with list makers). See Valid documents.

Parameters:

FormatStr – format string. See "Format function" in the Delphi help file for syntax. FormatStr must not contain CR, LF and TAB characters. To add several lines of text use AddTextNL.

Args – arguments for format string.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Method type:  viewer-style.

 Unicode note: the parameter of this method is Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for older versions of Delphi/C++Builder.

Example:

MyRichView.AddFmt('X=%d and Y=%d', [X,Y], 0, 0);

See also methods:

•	AddNL;

•	AddTextNL;

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	Other methods for appending items.


TRichView.AddHotPicture and AddHotPictureTag
 TRichView Reference | TRichView

TCustomRichView.AddHotPicture, AddHotPictureTag

These method add picture-hyperlink (gr) with the specified Name and vertical alignment (VAlign) to the end of document.

procedure AddHotPictureTag(const Name: TRVAnsiString;

  gr: TGraphic; ParaNo: Integer;

  VAlign: TRVVAlign; Tag: Integer);

procedure AddHotPicture(const Name: TRVAnsiString;

  gr: TGraphic; ParaNo: Integer; VAlign: TRVVAlign);

(introduced in version 1.5)

AddHotPicture provides a subset of functionality of AddHotPictureTag:

•	AddHotPicture(...) is equivalent to AddHotPictureTag(..., 0)

The same as AddPictureEx and AddPictureExTag, but this picture will be a hypertext link.

Parameters:

Name – name of this hot-picture item, any string. Name must not contain CR and LF characters. RichView does not use Names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

gr – picture to insert.

VAlign – vertical align of this picture, relative to its line, see TRVVAlign for possible values.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this hot-picture item..

Alternatives:

•	If you want to add a simple (not a hyperlink) TGraphic picture, add a picture instead.

•	If you want to add a hyperlink-picture from image list, add a hotspot instead.

•	If you want to add a simple (not a hyperlink) picture from image list, add a bullet instead.

Methods type:  viewer-style.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertHotPicture.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags";

•	Hypertext in RichView.


TRichView.AddHotspotExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddHotspotEx, AddHotspotExTag

TCustomRichView.AddHotspot (deprecated)

These methods add hotspot (image from TImageList – hypertext link) to the end of document.

procedure AddHotspotExTag(const Name: TRVAnsiString;

  ImageIndex, HotImageIndex: Integer;

  ImageList: TCustomImageList; ParaNo, Tag: Integer);

procedure AddHotspotEx(const Name: TRVAnsiString;

  ImageIndex, HotImageIndex: Integer;

  ImageList: TCustomImageList; ParaNo: Integer);

procedure AddHotspot(ImageIndex: Integer;

  ImageList: TCustomImageList; fromnewline: Boolean); deprecated;

AddHotspotEx provides a subset of functionality of AddHotspotExTag:

•	AddHotspotEx(...) is equivalent to AddHotspotExTag(..., 0).

AddHotspot is deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0):

•	AddHotspot(ImageIndex, ImageList, True) is equivalent to AddHotspotEx('', ImageIndex, ImageIndex, ImageList, 0).

•	AddHotspot(ImageIndex, ImageList, False) is equivalent to AddHotspotEx('', ImageIndex, ImageIndex, ImageList, -1).

Alternatives:

•	If you want to add a simple (not a hyperlink) picture from image list, add a bullet instead.

•	If you want to add a TGraphic picture-hyperlink, add a hot picture instead.

•	If you want to add a TGraphic picture, add a picture instead.

Parameters:

Name – name of hotspot, any string. Name must not contain CR and LF characters. RichView does not use Names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

ImageIndex – index of image in ImageList.

HotImageIndex – index of "hot" image in ImageList. It is displayed when the mouse pointer is above this hotspot.

ImageList – image list for this hotspot. RichView does not own, does not copy and does not destroy imagelists, it just holds pointers to them. So this image list is not destroyed when the document is cleared.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this hotspot.

Methods type:  viewer-style.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertHotspot.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags";

•	Hypertext in RichView.


TRichView.AddItem
 TRichView Reference | TRichView

TCustomRichView.AddItem

Adds one item to the end of document.

procedure AddItem(const Text: String; Item: TCustomRVItemInfo);

(introduced in version 1.4)

This is the most general method for appending items to the document. Using this method you can add items of custom types.

For items of standard types it's recommended to use other methods for appending items.

Usually this method is used for appending tables, labels, sequences, footnotes, endnotes, references to notes.

The detailed description of item types is beyond the scope of this help file. Briefly, standard item types are declared and implemented in RVItem unit. All item types are classes derived from one base class – TCustomRVItemInfo.

Parameters:

Text – item name, some text associated with this item. It must not contain CR and LF characters.

Item – the item itself. Item.ParaNo defines the paragraph style of item (index in Style.ParaStyles)

Method type:  viewer-style.

 Unicode note: for Delphi/Unicode 2009 or newer, Text is Unicode string; for the older versions of Delphi/C++Builder, Text is ANSI string. It is converted to ANSI/Unicode, if necessary. Names of non-text items are ANSI strings.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode;

•	GetItem.

See also methods of TRichViewEdit:

•	InsertItem.

See also:

•	Item types;

•	Other methods for appending items.


TRichView.AddNamedCheckpointExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag

These methods add checkpoint to the end of document.

function AddNamedCheckpointExTag(const CpName: String;

  RaiseEvent: Boolean; Tag: Integer): Integer;

function AddCheckpoint: Integer;

function AddCheckpointTag(Tag: Integer): Integer;

function AddNamedCheckpoint(const CpName: String): Integer;

function AddNamedCheckpointEx(const CpName: String;

  RaiseEvent: Boolean): Integer;

AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx provide subsets of functionality of AddNamedCheckpointExTag:

•	AddCheckpoint is equivalent to AddNamedCheckpointExTag('', False, 0)..

•	AddCheckpointTag(Tag) is equivalent to AddNamedCheckpointExTag('', False, Tag).

•	AddNamedCheckpoint(CpName) is equivalent to AddNamedCheckpointExTag(CpName, False, 0).

•	AddNamedCheckpointEx(CpName, RaiseEvent) is equivalent to AddNamedCheckpointExTag(CpName, RaiseEvent, 0).

Checkpoints are not items, but the methods for appending checkpoints are similar to methods for appending items. This checkpoint will be associated with the next appended item.

Parameters:

CpName – name of checkpoint. This is an ANSI string, regardless of Unicode mode of text styles. It must not contain #0, #1 and #2 characters.

RaiseEvent – "raise event" flag, see OnCheckpointVisible

Tag –  tag of checkpoint.

Return value:

Index of the added checkpoint

Methods type:  viewer-style.

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	SetCheckpointInfo;

•	RemoveCheckpoint.

See also methods of TRichViewEdit:

•	SetCheckpointInfoEd;

•	SetCurrentCheckpointInfo.

See also:

•	Methods for appending items;

•	Checkpoints;

•	Tags.


TRichView.AddNLTag -A- -W-
 TRichView Reference | TRichView

TCustomRichView.AddNLTag, AddNLATag, AddNLWTag, AddNL, Add, AddTag

These methods add one text item with the StyleNo-th text style and the ParaNo-th paragraph style, with the specified Tag to the end of document.

Methods with the full set of parameters:

procedure AddNLTag(s: String; StyleNo, ParaNo, Tag: Integer);

procedure AddNLATag(const s: TRVAnsiString; StyleNo, ParaNo, Tag: Integer);

procedure AddNLWTag(const s: TRVUnicodeString; StyleNo, ParaNo, Tag: Integer);

Methods with shortened set of parameters:

procedure AddNL(const s: String; StyleNo, ParaNo: Integer);

procedure Add(const s: String; StyleNo:Integer);

procedure AddTag(const s: String; StyleNo,Tag:Integer);

(introduced in version 1.3 and 1.4)

Parameters:

s is a text string to add.  It must not contain CR, LF, TAB, FF characters (#13, #10, #9, #12). To add several lines of text use AddTextNL.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this text item.

AddNL, Add, AddTag provide subsets of functionality of AddNLTag:

•	AddNL(...) is equivalent to AddNLTag(..., 0).

•	Add(...) is equivalent to AddNLTag(..., -1, 0).

•	AddTag(s, StyleNo, Tag) is equivalent to AddNLTag(s, StyleNo, -1, Tag).

In other words:

•	AddNL adds text string as a beginning of new paragraph or to the end of the last paragraph.

•	AddNLTag adds text string with tag as a beginning of new paragraph or to the end of the last paragraph.

•	Add adds text string to the end of the last paragraph.

•	AddTag adds text string with tag to the end of the last paragraph.

Note: TRichView allows empty text strings only in empty paragraphs (may be with list makers). See Valid documents.

 Unicode notes:

AddNLATag:

•	If the StyleNo-th style is ANSI style, s is added as it is.

•	If the StyleNo-th style is Unicode style, s is converted to Unicode (conversion is performed basing on the Charset of this style).

AddNLWTag:

•	If the StyleNo-th style is Unicode style, s is added as it is.

•	If the StyleNo-th style is ANSI style, s is converted to ANSI (conversion is performed basing on the Charset of this style).

AddNLTag works like AddNLWTag in Delphi/C++Builder 2009, and like AddNLATag in the older versions of Delphi/C++Builder.

Methods type:  viewer-style

See also methods:

•	AddTab;

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertStringTag, InsertStringATag, InsertStringWTag.

See also properties of TRVStyle:

•	TextStyles;

•	SpacesInTab.

See also:

•	Other methods for appending items;

•	Unicode in RichView.


TRichView.AddPictureExTag and Others
 TRichView Reference | TRichView

TCustomRichView.AddPictureEx, AddPictureExTag

TCustomRichView.AddPicture (deprecated)

These methods add picture (gr) with the specified Name and vertical alignment (VAlign) to the end of document

procedure AddPictureExTag(const Name: TRVAnsiString; gr: TGraphic;

  ParaNo: Integer; VAlign: TRVVAlign; Tag: Integer);

procedure AddPictureEx(const Name: TRVAnsiString; gr: TGraphic;

  ParaNo: Integer; VAlign: TRVVAlign);

procedure AddPicture(gr: TGraphic); deprecated;

AddPictureEx provides a subset of functionality of AddPictureExTag:

•	AddPictureEx(...) is equivalent to AddPictureExTag(..., 0).

The same as AddHotPicture and AddHotPictureTag, but this picture will not be a hypertext link.

AddPicture is deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0):

•	AddPicture(gr) is equivalent to AddPictureEx('', gr, 1, rvvaBaseline).

Parameters:

Name – name of this picture item, any string. Name must not contain CR and LF characters. RichView does not use Names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

gr – picture to insert.

VAlign – vertical align of this picture, relative to its line, see TRVVAlign for possible values.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

Tag – tag of this picture item.

Alternatives:

•	If you want to add a TGraphic picture-hyperlink, add a hot picture instead.

•	If you want to add a hyperlink-picture from image list, add a hotspot instead.

•	If you want to add a simple (not a hyperlink) picture from image list, add a bullet instead.

Methods type:  viewer-style.

 Unicode note: names of non-text items are ANSI strings.

Example:

procedure AddBitmapFromFile(rv: TCustomRichView;

  const FileName: String; ParaNo: Integer);

var bmp: TBitmap;

begin

  bmp := TBitmap.Create;

  bmp.LoadFromFile(FileName);

  rv.AddPictureEx('', bmp, ParaNo, rvvaBaseline);

end;

...

// creating document with 2 pictures

// in the same paragraph

rv.Clear;

AddBitmapFromFile(rv, 'd:\pic1.bmp', 0);

AddBitmapFromFile(rv, 'd:\pic2.bmp', -1);

rv.Format;

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertPicture.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items;

•	"Tags".


TRichView.AddTab
 TRichView Reference | TRichView

TCustomRichView.AddTab

Adds tabulator to the end of document.

procedure AddTab(TextStyleNo, ParaNo: Integer);

(introduced in v1.9)

Parameters:

TextStyleNo – text style of tabulator. It is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes.

If ParaNo=-1, the methods add the item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). It defines attributes for the new paragraph.

This method always adds a tabulator, regardless of RVStyle.SpacesInTab mode. If RVStyle.SpacesInTab=0, this method does the same work as AddTextNL(#9, TextStyleNo, ParaNo, ParaNo).

Methods type:  viewer-style.

See also methods:

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertTab.

See also properties of TRVStyle:

•	ParaStyles.

See also:

•	Item types;

•	Other methods for appending items.


TRichView.AddText, AddTextFromNewLine (deprecated)
 TRichView Reference | TRichView

TCustomRichView.AddText, AddTextFromNewLine (deprecated)

Obsolete, use AddTextNL

procedure AddText(const s: String; StyleNo:Integer); deprecated;

procedure AddTextFromNewLine(const s: String; StyleNo:Integer); deprecated;

These methods are deprecated and maintained for backward compatibility (with TRichView versions prior to 1.0).

AddText(...) is equivalent to AddTextNL(..., -1, 0).

AddTextFromNewLine(...) is equivalent to AddTextNL(..., 0, 0).

Methods type:  viewer-style.


TRichView.AddTextNL -A -W
 TRichView Reference | TRichView

TCustomRichView.AddTextNL, AddTextNLA, AddTextNLW

These methods add one or more text lines to the end of document.

procedure AddTextNL(s: String; StyleNo,

  FirstParaNo, OtherParaNo: Integer);

procedure AddTextNLA(const s: TRVAnsiString; StyleNo,

  FirstParaNo, OtherParaNo: Integer);

procedure AddTextNLW(const s: TRVUnicodeString;

  StyleNo, FirstParaNo, OtherParaNo: Integer;

  DefAsSingleParagraph: Boolean);

Parameters:

s is a text string to add. It may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

ParaNo defines paragraph attributes for the fist line of the added text. If ParaNo=-1, the methods add the first line to the end of the last paragraph. If ParaNo>=0, this line starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component).

OtherParaNo defines paragraph attributes for the subsequent lines of text. Must be >=0.

DefAsSingleParagraph: If False, AddTextNLW uses the current add-paragraph mode (see SetAddParagraphMode). If True, it treats #13 and #10 as line breaks, not paragraph breaks. WideChar($2029) ("paragraph separator") always initiates a new paragraph. WideChar($2028) ("line separator") always initiates a new line.

AddTextNLW supports the Unicode byte order marks characters (if it's present, it must be the first character in s).

Methods type:  viewer-style.

 Unicode notes:

AddTextNLA:

•	If the StyleNo-th style is ANSI style, s is added as it is.

•	If the StyleNo-th style is Unicode style, s is converted to Unicode (conversion is performed basing on the Charset of this style).

AddTextNLW:

•	If the StyleNo-th style is Unicode style, s is added as it is..

•	If the StyleNo-th style is ANSI style, s is converted to ANSI (conversion is performed basing on the Charset of this style).

AddTextNL: works like AddTextNLW in Delphi/C++Builder 2009 or newer, and like AddTextNLA in the older versions of Delphi/C++Builder.

See also methods:

•	AddNL and others;

•	AddTab;

•	LoadText, LoadTextW;

•	LoadTextFromStream, LoadTextFromStreamW;

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertText, -A, -W.

See also properties of TRVStyle:

•	TextStyles;

•	SpacesInTab.

See also:

•	Other methods for appending items;

•	Unicode in RichView;

•	Example how to load UTF-8 files.


TRichView.AppendFrom
 TRichView Reference | TRichView

TCustomRichView.AppendFrom

Adds content of another RichView component (Source) to the end of document.

procedure AppendFrom(Source: TCustomRichView);

This method does not copy inserted controls and tables (just ignores them).

Both source and target RichViews must have equal tag modes (see rvoTagsArePChars in Options).

This method is the fastest way to copy items from one TRichView to another, but it has the limitations listed above.

The recommended way of copying is:

var Stream: TMemoryStream;

begin

  Stream := TMemoryStream.Create;

  try

    Source.SaveRVFToStream(Stream, False);

    Stream.Position := 0;

    Dest.LoadRVFFromStream(Stream);

    Dest.Format;

  finally

    Stream.Free;

  end;

end;

Method type:  viewer-style.

See also methods:

•	Format;

•	FormatTail.

See also:

•	Other methods for appending items.


TRichView.AppendRVFFromStream
 TRichView Reference | TRichView

TCustomRichView.AppendRVFFromStream

Adds data from Stream in RichView Format (RVF) to the end of document.

function AppendRVFFromStream(Stream: TStream;

  ParaNo: Integer): Boolean;

This method appends content from RVF stream. It ignores the paragraph style of first paragraph in RVF and uses the ParaNo-th paragraph style instead of it.

Parameters:

Stream – stream containing document in RichView Format (RVF).

If ParaNo=-1, the method adds the first item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph with the ParaNo-th style. (ParaNo is an index in the ParaStyles collection of the linked RVStyle component). This parameter affects only the first paragraph of inserted data. Styles of other paragraphs are defined in RVF.

Method type:  viewer-style.

Setting for RVF loading can be changed in the TRichView component editor.

Return value:

"Was reading successful?"

See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF insertion);

•	RVFParaStylesReadMode (this method type: RVF insertion).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also methods:

•	InsertRVFFromStream;

•	LoadRVFFromStream;

•	LoadRVF;

•	Format;

•	FormatTail.

See also:

•	TRichView component editor;

•	Saving and loading;

•	RVF overview;

•	Paragraphs.


TRichView.AssignSoftPageBreaks
 TRichView Reference | TRichView

TCustomRichView.AssignSoftPageBreaks

Displays soft page breaks (i.e. page breaks that were made automatically)

procedure AssignSoftPageBreaks(RVPrint: TComponent);

(introduced in version 1.7)

Page breaks become visible after calling RichView.AssignSoftPageBreaks(RVPrint). RVPrint must be formatted (i.e. FormatPages must be called before this method). Page breaks are visible only if rvoShowPageBreaks is included in RichView.Options.

In editor, soft page breaks will be automatically cleared after any editing operation (any action invoking OnChange). Page breaks will also be cleared when you call Clear. In all other cases, you must call ClearSoftPageBreaks after each change in the document performed after calling AssignSoftPageBreaks.

Soft page breaks are drawn using RVStyle.SoftPageBreakColor (or in OnDrawPageBreak event).

See also:

•	ClearSoftPageBreaks.

See also properties:

•	PageBreaksBeforeItems.


TRichView.BeginOleDrag
 TRichView Reference | TRichView

TCustomRichView.BeginOleDrag

Starts dragging the selection.

procedure BeginOleDrag;

(introduced in v1.9)

This method is useful if you want to implement drag&drop of inserted controls.(all other content can be dragged automatically)

Example

This example implements drag&drop of inserted TButton controls.

1) Add the following variables in form:

ClickedControl: TObject;

ClickPoint: TPoint;

2) Add the following methods:

procedure TForm1.OnControlMouseDown(Sender: TObject;

  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

begin

  if Button = mbLeft then begin

    RichViewEdit1.SelectControl(TControl(Sender));

    ClickedControl := Sender;

    ClickPoint := Point(X, Y);

  end;

end;

procedure TForm1.OnControlMouseMove(Sender: TObject;

  Shift: TShiftState; X, Y: Integer);

begin

  if (ssLeft in Shift) and (ClickedControl=Sender) and

    (Sqr(ClickPoint.X-X)+Sqr(ClickPoint.Y-Y)>10) then

    RichViewEdit1.BeginOleDrag;

end;

3) Assign events to created controls:

  btn := TButton.Create(Self);

  btn.Caption := 'Button';

  btn.OnMouseDown := OnControlMouseDown;

  btn.OnMouseMove := OnControlMouseMove;

  RichViewEdit1.InsertControl('',btn,rvvaBaseline);

4) Events are not saved in RVF, so reassign them on loading. Use OnControlAction event:

procedure TForm1.RichViewEdit1ControlAction(Sender: TCustomRichView;

  ControlAction: TRVControlAction; ItemNo: Integer; var ctrl: TControl);

begin

  if ControlAction=rvcaAfterRVFLoad then begin

    if ctrl is TButton then begin

      TButton(ctrl).OnMouseDown := OnControlMouseDown;

      TButton(ctrl).OnMouseMove := OnControlMouseMove;

     end;

  end;

end;

The complete example can be downloaded here: http://www.trichview.com/forums/viewtopic.php?t=157


TRichView.Clear
 TRichView Reference | TRichView

TCustomRichView.Clear

Clears the document.

procedure Clear; virtual;

This method:

•	deletes all items;

•	turns off displaying soft page breaks;

•	clears DocProperties;

•	stops live spelling check;

•	stops animations, if AnimationMode = rvaniOnFormat.

This method does not change collections of text, paragraph and list styles. So, if your application adds styles while editing, call DeleteUnusedStyles after Clear.

Method type: generally, it's a [image] viewer-style method, but it is special, because it clears all editing and displaying history. It is a starting method for document generation.

This method is called by the methods: LoadRVF, LoadRVFFromStream.

See also methods:

•	Format.

See also method of TRichViewEdit:

•	Clear.

See also:

•	Methods for building documents.


TRichView.ClearLiveSpellingResults
 TRichView Reference | TRichView

TCustomRichView.ClearLiveSpellingResults

Clears all live spelling underlines and stops the live spelling thread.

procedure ClearLiveSpellingResults;

(introduced in v1.9)

Clear method calls this procedure automatically.

See also: Live spelling check in RichView.


TRichView.ClearSoftPageBreaks
 TRichView Reference | TRichView

TCustomRichView.ClearSoftPageBreaks

Turns off displaying soft page breaks

procedure ClearSoftPageBreaks;

See also:

•	AssignSoftPageBreaks.


TRichView.ClientToDocument
 TRichView Reference | TRichView

TCustomRichView.ClientToDocument

Translates client coordinates to document coordinates.

function ClientToDocument(const APoint: TPoint): TPoint;

(introduced in v1.9)

This method translates Point from the control’s coordinate system to the document coordinate system.

In client area coordinates, (0, 0) corresponds to the top left corner of the control's client area. For example, mouse events use this coordinate system.

In document coordinates, (0, 0) corresponds to the top left corner of the scrollable area. For example, GetItemAt uses this coordinate system.

Note:

This method must be used instead of adding HScrollPos to X and VScrollPos*VSmallStep to Y. The old method was used in some old example code, it is correct only if the document is top-aligned.

See also:

Example in OnRVMouseDown.


TRichView.Copy
 TRichView Reference | TRichView

TCustomRichView.Copy

Copies the selected fragment to the Clipboard in all available formats (as text, RVF, RTF and picture)

procedure Copy;

This procedure does nothing if there is nothing selected.

This procedure clears the Clipboard before copying.

This method must be called only when the document is formatted.

See also:

•	Working with selection;

•	Working with Clipboard.


TRichView.CopyDef
 TRichView Reference | TRichView

TCustomRichView.CopyDef

Copies the selected fragment to the Clipboard in several formats according to Options.

function CopyDef: Boolean;

This is the main method for copying to the Clipboard. It is executed automatically when user presses  Ctrl + C  or  Ctrl + Insert .

Calling CopyDef does the same thing as sending the control a WM_COPY message.

This procedure does nothing if there is nothing selected.

This procedure clears the Clipboard before copying.

•	if (rvoAutoCopyRVF in Options), it copies selection as RVF.

•	if (rvoAutoCopyText in Options), it copies selection as ANSI text. ANSI text is not copied under Windows NT based systems (Windows 2000, XP, Vista), if rvoAutoCopyUnicodeText is included in Options. In Windows NT, the Clipboard can convert ANSI and Unicode texts to each other.

•	if (rvoAutoCopyImage in Options), and there is only one picture selected, it copies selection as an image.

•	if (rvoAutoCopyUnicodeText in Options), it copies text as Unicode text.

•	if (rvoAutoCopyRTF in Options), it copies selection as RTF.

This method must be called only when the document is formatted.

Return value:

"Is the selection not empty?" and "Is at least one of rvoAutoCopy*** options set?"

See also:

•	Working with selection;

•	Working with Clipboard.


TRichView.CopyImage
 TRichView Reference | TRichView

TCustomRichView.CopyImage

Copies the selected image to the Clipboard.

procedure CopyImage;

This procedure does nothing if there is nothing selected.

This procedure clears the Clipboard before copying.

If selection contains something besides one image, this method just clears the Clipboard.

This method must be called only when the document is formatted.

See also:

•	Working with selection;

•	Working with Clipboard.


TRichView.CopyRTF
 TRichView Reference | TRichView

TCustomRichView.CopyRTF

Copies the selected part of the document to the Clipboard as RTF (Rich Text Format).

procedure CopyRTF;

This procedure does nothing if there is nothing selected.

This procedure clears Clipboard before copying.

Settings for RTF saving can be changed in the TRichView component editor.

Options for saving are in RTFOptions property.

By default, hyperlinks are not saved. You can save them using OnWriteHyperlink event.

This method must be called only when the document is formatted.

See also:

•	SaveRTF, SaveRTFToStream methods;

•	RTFOptions property;

•	Working with selection;

•	Working with Clipboard.


TRichView.CopyRVF
 TRichView Reference | TRichView

TCustomRichView.CopyRVF

Copies the selection to the Clipboard as RVF (RichView Format)

procedure CopyRVF;

This procedure does nothing if there is nothing selected.

This procedure clears the Clipboard before copying.

Settings for RVF saving can be changed in the TRichView component editor.

This method must be called only when the document is formatted.

See also:

•	Working with selection;

•	Working with Clipboard;

•	RVF.


TRichView.CopyText -W
 TRichView Reference | TRichView

TCustomRichView.CopyText, CopyTextA, CopyTextW

These methods copy the selected fragment to the Clipboard as text.

procedure CopyText;

procedure CopyTextA;

procedure CopyTextW;

These methods do nothing if there is nothing selected.

These methods clear the Clipboard before copying.

CopyTextA copies text in ANSI encoding. Text of Unicode styles is converted basing on TRVStyle.DefCodePage.

CopyTextW copies text in Unicode encoding. ANSI strings are converted basing on the corresponding Charsets. For  text of DEFAULT_CHARSET, TRVStyle.DefCodePage is used.

CopyText works like CopyTextW in Delphi/C++Builder 2009 or newer, and like CopyTextA in the older versions of Delphi/C++Builder.

These methods must be called only when the document is formatted.

See also:

•	Working with selection;

•	Working with Clipboard;

•	Unicode.


TRichView.Create
 TRichView Reference | TRichView

TCustomRichView.Create

Usual component constructor. Creates a new TRichView instance.

constructor Create(AOwner: TComponent);override;

Use Create to instantiate RichView at runtime. RichViews placed on forms at design time are created automatically. Specify the owner of the new RichView using the AOwner parameter.

Important note: initial values of several properties of components created in code may be different from initial values of components placed on form at design time. In the latter case, initial values of these properties can be overridden by the designtime component editor (and overridden by default!)


TRichView.DeleteItems
 TRichView Reference | TRichView

TCustomRichView.DeleteItems

Removes the specified number of items (Count) from the document, starting from the FirstItemNo-th item.

procedure DeleteItems(FirstItemNo, Count: Integer);

Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.DeleteItems.

Method type:  viewer-style.

Be careful: this method can produce invalid document.

Example 1: deleting all empty lines

procedure DeleteBlankLines(RVData: TCustomRVData);

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  for i := RVData.ItemCount-1 downto 0 do

    if RVData.IsParaStart(i) and (RVData.GetItemStyle(i)>=0) and

      (RVData.GetItemTextR(i)='') and (RVData.ItemCount>1) then

      RVData.DeleteItems(i,1)

    else if RVData.GetItemStyle(i)=rvsTable then begin

      table := TRVTableItemInfo(RVData.GetItem(i));

      for r := 0 to table.RowCount-1 do

        for c := 0 to table.ColCount-1 do

          if table.Cells[r,c]<>nil then

            DeleteBlankLines(table.Cells[r,c].GetRVData);

    end;

end;

DeleteBlankLines cannot be undone/redone. If called for editor, the editor's undo buffer becomes incorrect, so call ClearUndo.

Call:

DeleteBlankLines(RichViewEdit1.RVData);

RichViewEdit1.ClearUndo;

RichViewEdit1.Format;

Example 2: deleting empty lines at the end of document

procedure DeleteTrailingBlankLines(RVData: TCustomRVData);

var i: Integer;

begin

  for i := RVData.ItemCount-1 downto 1 do

    if RVData.IsParaStart(i) and (RVData.GetItemStyle(i)>=0) and

     (RVData.GetItemTextR(i)='') then

      RVData.DeleteItems(i,1)

    else

      break;

end;

See also:

•	DeleteSection;

•	DeleteParas.


TRichView.DeleteMarkedStyles
 TRichView Reference | TRichView

TCustomRichView.DeleteMarkedStyles

Deletes unused text, paragraph and list styles.

procedure MarkStylesInUse(Data: TRVDeleteUnusedStylesData);

(introduced in version 10)

This method is useful if collections of text, paragraph and list styles are not saved in RVF documents (but stored in file or in the Registry). In this case, several documents share the same collections of styles. Used styles are marked with MarkStylesInUse method, see TRVDeleteUnusedStylesData for the examples.

Usually it's much more simple (and recommended) to use one RVStyle per one RichView and store collections of styles inside RVF documents. In this case, use DeleteUnusedStyles instead.

See also methods:

•	MarkStylesInUse;

•	DeleteUnusedStyles.


TRichView.DeleteParas
 TRichView Reference | TRichView

TCustomRichView.DeleteParas

Deletes paragraph(s) containing items from FirstItemNo to LastItemNo, updates the document

procedure DeleteParas(FirstItemNo, LastItemNo: Integer);

(introduced in version 1.7)

This method is designed specially for chat/log windows. Together with FormatTail, it allows updating chat windows faster, without complete reformatting.

Items are indexed from 0 to ItemCount-1..

Method type: unique method. Unlike all other methods of TRichView, it quickly reformats RichView, so you do not need to call Format after it. Like editing-style methods, this method requires document to be formatted before calling, and leaves it formatted after. But it is still a viewer-style method, because it does not update undo buffers, does not check ReadOnly property, etc.

See also:

•	DeleteItems;

•	DeleteSection.


TRichView.DeleteSection
 TRichView Reference | TRichView

TCustomRichView.DeleteSection

Removes the "section" named CpName from documents

procedure DeleteSection(CpName: String);

"Section" is a part of document. The first item of "section" is the item having checkpoint with non empty name. This name is also a name of "section". If there is no another checkpoint with non empty name below, the last item in the document is also the last item of "section". Otherwise, item with that "checkpoint" starts a new section, and does not belong to the current section.

Method type:  viewer-style.

Be careful: this method can produce invalid document.

See also:

•	DeleteItems;

•	DeleteParas.


TRichView.DeleteUnusedStyles
 TRichView Reference | TRichView

TCustomRichView.DeleteUnusedStyles

Deletes text and/or paragraph and/or list styles which do not exist in document

procedure DeleteUnusedStyles(

  TextStyles, ParaStyles, ListStyles: Boolean);

(introduced in version 1.5, updated in version 1.6, 1.7)

This procedure deletes unused items from the collections of text (if TextStyles parameter is True), paragraph (if ParaStyles parameter is True), and list (if ListStyles parameter is True) styles (see TextStyles, ParaStyles, ListStyles) of the linked TRVStyle component).

Then it updates references to these styles in the component and other styles.

Warning: be careful when using this method. Use it only if RVStyle object is used exclusively by this RichView (this method updates references to styles only in one RichView)

This method deletes only non-standard styles (see Standard property of styles)

This method does not require reformatting.

See also methods:

•	MarkStylesInUse;

•	DeleteMarkedStyles.


TRichView.Deselect
 TRichView Reference | TRichView

TCustomRichView.Deselect

Removes the document selection (does not change document, just nothing becomes selected for copying to the Clipboard)

procedure Deselect;

This method does not repaint document (call Invalidate)

This method must be called only when the document is formatted.

The method generates OnSelect event.

See also methods:

•	SetSelectionBounds;

•	SelectAll.

See also:

•	Selecting in RichView document.


TRichView.Destroy
 TRichView Reference | TRichView

TCustomRichView.Destroy

Destroys an instance of TRichView

destructor Destroy;override;

Do not call Destroy directly in an application. Instead, call Free. Free verifies that the control is not nil, and only then calls Destroy.

Applications should only free controls explicitly when the constructor was called without assigning an owner to the control.


TRichView.FindCheckpointByName
 TRichView Reference | TRichView

TCustomRichView.FindCheckpointByName

Returns the first checkpoint having the specified Name, or nil if there is no such checkpoint

function FindCheckpointByName(const Name: String): TCheckpointData;

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	FindCheckpointByTag;

See also:

•	"Checkpoints".


TRichView.FindCheckpointByTag
 TRichView Reference | TRichView

TCustomRichView.FindCheckpointByTag

Returns the first checkpoint having the specified tag, or nil if there is no such checkpoint

function FindCheckpointByTag(Tag: Integer): TCheckpointData;

This function performs a smart searching: it takes "tags" mode into account.

If rvoTagsArePChars in Options, this method treats the specified tag as a pointer to string, and compares strings.

Example:

var s: String;

    CheckpointData: TCheckpointData;

...

  s := 'Tag_String_Example';

  CheckpointData := MyRichView.FindCheckpointByTag(Integer(PChar(s)));

If rvoTagsAPChars is not in Options, this method treats the specified tag as an integer value

Example:

var CheckpointData: TCheckpointData;

...

  CheckpointData := MyRichView.FindCheckpointByTag(1999);

See also methods:

•	FindCheckpointByName.

See also:

•	"Tags";

•	"Checkpoints".


TRichView.FindControlItemNo
 TRichView Reference | TRichView

TCustomRichView.FindControlItemNo

Returns an index of the RichView item which owns the control actrl, or -1 if actrl was not added in RichView.

function FindControlItemNo(actrl: TControl): Integer;

Note: This method contains some calculations inside (iterations through items, from the 0-th to the returned one)

See also:

•	RichView item types.


TRichView.Format
 TRichView Reference | TRichView

TCustomRichView.Format

Formats the document. Only formatted documents can be displayed or edited.

procedure Format;

If rvoFormatInvalidate in Options (default), this method also repaints RichView.

You need to call this method after you modified document (using any of viewer-style methods), its text or paragraph styles.

When resized, RichView is reformatted automatically.

Most of methods of RichViewEdit automatically quickly reformat the affected part of the document, but you still need this method in RichViewEdit when you use methods inherited from RichView (viewer-style methods).

See also methods:

•	FormatTail;

•	Reformat.

See also properties:

•	 Options.

See also:

•	Building document.


TRichView.FormatTail
 TRichView Reference | TRichView

TCustomRichView.FormatTail

Formats a part of document appended after the last call of Format or FormatTail.

procedure FormatTail;

This method works properly only if new items were added from new line (as new paragraphs) after the last call of Format or FormatTail.

It's much more efficient to reformat only a new part of the document than making a full reformatting.

This method is designed specially for chat/log windows. Together with DeleteParas, it allows updating chat windows faster, without complete reformatting.

If rvoFormatInvalidate in Options, this method also repaints RichView.

See also methods:

•	Format;

•	DeleteParas.

See also properties:

•	Options;

•	VScrollVisible.

See also:

•	Appending items.


TRichView.GetBreakInfo
 TRichView Reference | TRichView

TCustomRichView.GetBreakInfo

Returns main properties of item of break type

procedure GetBreakInfo(ItemNo: Integer; var AWidth: Byte;

  var AStyle: TRVBreakStyle; var AColor: TColor;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of break type (rvsBreak), otherwise the method raises ERichViewError exception. 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.GetBreakInfo.

Output parameters:

AWidth – line width (or rectangle height).

AStyle – visual style of this break, see TRVBreakStyle for possible values.

AColor – line color. If it is equal to clNone, Style.TextStyles[0].Color is used.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag or SetBreakInfo to change tag of item. This value can also be read using GetItemTag method.

Additional item properties are returned by the methods GetItemExtraIntProperty and GetItemExtraStrProperty.

See also methods:

•	SetBreakInfo;

•	GetItemStyle;

•	GetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also:

•	Obtaining RichView items;

•	Item types;

•	Tags.


TRichView.GetBulletInfo
 TRichView Reference | TRichView

TCustomRichView.GetBulletInfo

Returns main properties of item of bullet type

procedure GetBulletInfo(ItemNo: Integer; var AName: TRVAnsiString;

  var AImageIndex: Integer; var AImageList: TCustomImageList;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of bullet or hotspot type (rvsBullet or rvsHotspot), otherwise the method raises ERichViewError exception. 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.GetBulletInfo.

Output parameters:

AName – name of bullet. It can also be read using GetItemText method.

AImageList – image list (a reference to image list, do not free it).

AImageIndex – index in AImageList.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag or SetBulletInfo to change tag of item. This value can also be read using GetItemTag method.

Additional item properties are returned by the methods GetItemExtraIntProperty and GetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	SetBulletInfo;

•	GetItemStyle;

•	GetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also:

•	Obtaining RichView items;

•	Item types.

•	Tags.


TRichView.GetCheckpointByNo
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointByNo

Returns the No-th checkpoint.

function GetCheckpointByNo(No: Integer): TCheckpointData;

The first checkpoint has index = 0.

Note 1: this function contains some calculations inside (iterations through checkpoints, from the 0-th to the No-th checkpoint).

Note 2: this method does not work with checkpoints in subdocuments (table cells)

See also methods:

•	GetCheckpointNo;

•	GetItemCheckpoint.

See also:

•	"Checkpoints".


TRichView.GetCheckpointInfo
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointInfo

Returns information about the checkpoint CheckpointData

procedure GetCheckpointInfo(CheckpointData: TCheckpointData;

  var Tag: Integer; var Name: String;

  var RaiseEvent: Boolean);

Output parameters

Tag – tag of checkpoint; can be an integer value or a pointer to dynamically allocated string (see rvoTagsArePChars in RichView.Options)

Name – name of the checkpoint, any string

RaiseEvent – "raise event" flag; if set, RichView can generate OnCheckpointVisible event for this checkpoint.

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also properties:

•	CPEventKind.

See also events:

•	OnCheckpointVisible.

See also:

•	"Checkpoints";

•	"Tags".


TRichView.GetCheckpointItemNo
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointItemNo

Returns index of the RichView item which owns the checkpoint CheckpointData

function GetCheckpointItemNo(CheckpointData: TCheckpointData): Integer;

Note: this method does not work with checkpoints in subdocuments (table cells)

See also:

•	Item types;

•	"Checkpoints".


TRichView.GetCheckpointNo
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointNo

Returns index of the checkpoint CheckpointData

function GetCheckpointNo(CheckpointData: TCheckpointData): Integer;

The first checkpoint has index = 0.

Note 1: this function contains some calculations inside (iterations through checkpoints, from the 0-th to CheckpointData)

Note 2: this method does not work with checkpoints in subdocuments (table cells)

See also methods:

•	GetCheckpointByNo;

•	GetCheckpointItemNo.

See also:

•	"Checkpoints".


TRichView.GetCheckpointXY
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointXY

Returns X and Y coordinates of the checkpoint (relative the top left corner of the document, i.e. top left corner of scrollable area)

procedure GetCheckpointXY(CheckpointData: TCheckpointData;

  var X,Y: Integer);

You can use the returned Y to scroll document to this checkpoint.

These coordinates are the coordinates of the top left corner of the item which owns this checkpoint (for checkpoint at the bottom of the document the method returns (X=0, Y=DocumentHeight).

This method must be called only when the document is formatted.

See also methods:

•	GetCheckpointY;

•	GetCheckpointYEx;

•	ScrollTo.

See also:

•	"Checkpoints";

•	Scrolling.


TRichView.GetCheckpointY
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointY

Returns vertical coordinate of the no-th checkpoint

function GetCheckpointY(no: Integer): Integer;

The first checkpoint has index (i.e. no parameter) = 0.

The coordinate is relative to the top of document (top of scrollable area)

You can use the returned value to scroll document to this checkpoint.

This method must be called only when the document is formatted.

Note: this function contains some calculations inside (iterations through checkpoints, from the 0-th to the no-th checkpoint).

This function ignores checkpoints in table cells.

See also methods:

•	GetCheckpointYEx;

•	GetCheckpointXY;

•	ScrollTo.

See also:

•	"Checkpoints";

•	Vertical scrolling.


TRichView.GetCheckpointYEx
 TRichView Reference | TRichView

TCustomRichView.GetCheckpointYEx

Returns vertical coordinate of the checkpoint CheckpointData

function GetCheckpointYEx(CheckpointData: TCheckpointData): Integer;

Coordinate is relative to the top of the document (top of scrollable area)

You can use the returned value to scroll document to this checkpoint.

This method must be called only when the document is formatted.

See also methods:

•	GetCheckpointY;

•	GetCheckpointXY;

•	ScrollTo.

See also:

•	"Checkpoints";

•	Vertical scrolling.


TRichView.GetControlInfo
 TRichView Reference | TRichView

TCustomRichView.GetControlInfo

Returns main properties of the item of  "inserted control" type

procedure GetControlInfo(ItemNo: Integer;

  var AName: TRVAnsiString; var Actrl: TControl;

  var AVAlign: TRVVAlign;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of "inserted control" type (rvsComponent), otherwise the method raises ERichViewError exception. 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.GetControlInfo.

Output parameters:

AName – name of control item. Do not confuse with Actrl.Name property! This value can also be read using GetItemText method.

Actr – the control itself. This method returns control owned by RichView, do not not destroy it.

AVAlign – vertical alignment of the control.

ATag – tag of the item. Do not confuse with Actrl.Tag property! If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag or SetControlInfo to change tag of item. This value can also be read using GetItemTag method.

Additional item properties are returned by the methods GetItemExtraIntProperty and GetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	SetControlInfo;

•	GetItemStyle;

•	GetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichView.GetFirstCheckpoint
 TRichView Reference | TRichView

TCustomRichView.GetFirstCheckpoint

Returns value identifying the first checkpoint in the document, or nil if the document has no checkpoints.

function GetFirstCheckpoint: TCheckpointData;

GetFirstCheckpoint + GetNextCheckpoint allow to iterate through all checkpoints in the document.

Checkpoints from subdocuments (table cells) are not included in checkpoints list of the document.

See also methods:

•	GetNextCheckpoint, contains example;

•	GetLastCheckpoint;

•	GetPrevCheckpoint;

•	GetCheckpointInfo;

•	GetCheckpointXY.

See also:

•	"Checkpoints".


TRichView.GetFocusedItem
 TRichView Reference | TRichView

TCustomRichView.GetFocusedItem

Returns the item having keyboard focus.

procedure GetFocusedItem(var ARVData: TCustomRVFormattedData;

  var AItemNo: Integer);

There are two types of items which can have keyboard focus:

•	hypertext (text or pictures)

•	inserted controls.

If hypertext item has focus, pressing  Enter  invokes OnJump event for the focused link.

This method returns the focused item (the AItemNo-th item of ARVData object).

ARVData can be TRichView.RVData or table cell.

This method must be called only when the document is formatted.

If ARVData=nil, there is no focused item.

Focused items are supported only in TRichView, not in TRichViewEdit.

See also:

•	TabNavigation property.


TRichView.GetHotspotInfo
 TRichView Reference | TRichView

TCustomRichView.GetHotspotInfo

Returns main properties for item of hotspot type

procedure GetHotspotInfo(ItemNo: Integer; var AName: TRVAnsiString;

  var AImageIndex, AHotImageIndex: Integer;

  var AImageList: TCustomImageList;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of hotspot type (rvsHotspot), otherwise the method raises ERichViewError exception. 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.GetHotspotInfo.

Output parameters:

AName – name of hotspot. It can also be read using GetItemText method.

AImageList – image list (a reference to image list, do not free it).

AImageIndex – index in AImageList for normal image.

AHotImageIndex – index in AImageList for "hot" image. This image is displayed under the mouse pointer (in TRichView, or in TRichViewEdit in hypertext mode), or when user moves the caret to this item (in TRichViewEdit)

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag or SetHotspotInfo to change tag of item. This value can also be read using GetItemTag method.

Additional item properties are returned by the methods GetItemExtraIntProperty and GetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	SetHotspotInfo;

•	GetItemStyle;

•	GetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also:

•	Obtaining RichView items;

•	Item types;

•	Tags.


TRichView.GetItem
 TRichView Reference | TRichView

TCustomRichView.GetItem

Returns object representing one item in document by its index ItemNo (zero-based)

function GetItem(ItemNo: Integer): TCustomRVItemInfo;

(introduced in version 1.4)

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.GetItem.

Do not free this object yourself.

Usually this method if used to get an item object for tables, labels, sequences, footnotes, endnotes, references to notes.

This method is inverse to GetItemNo.

See also methods:

•	AddItem;

•	GetItemStyle.

See also methods of TRichViewEdit:

•	GetCurrentItem;

•	GetCurrentItemEx.

See also properties:

•	ItemCount.

See also events:

•	OnItemAction.

See also:

•	Obtaining RichView items.


TRichView.GetItemAt
 TRichView Reference | TRichView

TCustomRichView.GetItemAt

Returns item at the position X,Y.

function GetItemAt(X, Y: Integer; var RVData: TCustomRVFormattedData;

  var ItemNo, OffsetInItem: Integer; Strict: Boolean): Boolean;

Input parameters:

X,Y – coordinates relative to the top level corner of document (scrollable area)

Strict:

•	True – the method returns an item which is exactly at the specified location;

•	False – the method returns a position where caret should be moved, if the user would click the mouse at (X,Y)

Output parameters:

RVData – object containing this item (RichView.RVData or table cell or RVData of cell inplace editor)

ItemNo – index of item (in the items list of RVData), or -1 if no item was found.

OffsetInItem – position of this item:

•	for non-text: 0 (closer to the beginning of the item) or 1 (to the end);

•	for text: position is before the OffsetInItem-th character of text; characters are indexed from 1, the last position is Length(text)+1.

Return value:

"item found?"

This method must be called only when the document is formatted.

See also:

•	GetWordAt.

See also events:

•	OnRVMouseDown (contains example);

•	OnRVMouseUp.

Demo projects:

•	Demos\Delphi\Assorted\PlanetQuiz\

•	Demos\CBuilder\Assorted\PlanetQuiz\


TRichView.GetItemCheckpoint
 TRichView Reference | TRichView

TCustomRichView.GetItemCheckpoint

Returns checkpoint associated with the ItemNo-th item, or nil if this item does not have associated checkpoint.

function GetItemCheckpoint(ItemNo: Integer): TCheckpointData;

Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.GetItemCheckpoint.

See also methods:

•	GetCheckpointInfo;

•	GetCheckpointXY.

See also:

•	"Checkpoints".


TRichView.GetItemClientCoords
 TRichView Reference | TRichView

TCustomRichView.GetItemClientCoords

Returns coordinates of the item in RichView window.

function GetItemClientCoords(ItemNo: Integer;

  var Left,Top: Integer): Boolean;

(introduced in version 1.4)

Input parameter:

ItemNo – index of item. Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document.

Output parameters:

Left,Top – coordinates of the top left corner of the item, in pixels. (0,0) is in the top left corner of client area of the control window.

This method must be called only when the document is formatted.

Return value:

True if coordinates were successfully retrieved (document must be formatted)

See also:

•	GetItemCoords;

•	ClientToDocument.


TRichView.GetItemCoords
 TRichView Reference | TRichView

TCustomRichView.GetItemCoords

Returns coordinates of the item in RichView document.

function GetItemCoords(ItemNo: Integer;

  var Left,Top: Integer): Boolean;

(introduced in version 1.4)

Input parameter:

ItemNo – index of item. Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document.

Output parameters:

Left,Top – coordinates of the top left corner of the item, pixels. (0,0) is in top left corner of scrollable area of the document.

This method must be called only when the document is formatted.

Return value:

True if coordinates were successfully retrieved (document must be formatted)

See also:

•	GetItemClientCoords;

•	ClientToDocument.

See also methods of TCustomRVFormattedData

•	GetOriginEx.


TRichView.GetItemExtraIntProperty
 TRichView Reference | TRichView

TCustomRichView.GetItemExtraIntProperty

Returns value of the specified integer property for the ItemNo-th item

function GetItemExtraIntProperty(ItemNo: Integer;

  Prop: TRVExtraItemProperty; var Value: Integer): Boolean;

(introduced in version 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.GetItemExtraIntProperty.

Value receives value of the property identified by Prop. See TRVExtraItemProperty for the list of properties.

Return value:

True, if this item has this property. False, if not.

See also:

•	SetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also methods of TRichViewEdit:

•	GetCurrentItemExtraIntProperty.


TRichView.GetItemExtraStrProperty
 TRichView Reference | TRichView

TCustomRichView.GetItemExtraStrProperty

Returns value of the specified string property for the ItemNo-th item

function GetItemExtraStrProperty(ItemNo: Integer;

  Prop: TRVExtraItemStrProperty; var Value: String): Boolean;

(introduced in version 1.9)

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.GetItemExtraStrProperty.

Value receives value of the property identified by Prop. See TRVExtraItemStrProperty for the list of properties.

Return value:

True, if this item has this property. False, if not.

 Unicode note: string properties are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also:

•	SetItemExtraStrProperty;

•	GetItemExtraIntProperty.

See also methods of TRichViewEdit:

•	GetCurrentItemExtraStrProperty.


TRichView.GetItemNo
 TRichView Reference | TRichView

TCustomRichView.GetItemNo

Returns index of item (zero-based).

function GetItemNo(Item: TCustomRVItemInfo): Integer;

(introduced in version 1.4)

Item is an object representing the item. Usually this method if used to get index if table item.

This method is inverse to GetItem.

Returned value can be used, for example, in methods:

TRichViewEdit.BeginItemModify/EndItemModify

See also methods:

AddItem.


TRichView.GetItemPara
 TRichView Reference | TRichView

TCustomRichView.GetItemPara

Returns the index of paragraph style for paragraph containing the ItemNo-th item.

function GetItemPara(ItemNo: Integer): Integer;

(Introduced in version 1.3)

Parameter:

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.GetItemPara.

Return value:

The returned value is an index in the collection of Style.ParaStyles. The method never returns -1, even if this item is not the first paragraph item. The method returns the same value for all items in the same paragraph.

See also:

•	IsParaStart;

•	IsFromNewLine.

See also:

•	Paragraphs.


TRichView.GetItemStyle
 TRichView Reference | TRichView

TCustomRichView.GetItemStyle

Returns type (style) of the ItemNo-th item.

function GetItemStyle(ItemNo: Integer): Integer;

Parameters:

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

Return value:

If the item is a text item, this function returns zero or positive value: index of text style of this item in the collection of styles (Style.TextStyles).

If the item is not a text item, this function returns type of this item. It is a negative value, see rvs**** constants.

See also properties of TRichViewEdit:

•	CurItemStyle.

See also:

•	Item types.


TRichView.GetItemTag
 TRichView Reference | TRichView

TCustomRichView.GetItemTag

Returns tag of the ItemNo-th item

function GetItemTag(ItemNo: Integer): Integer;

Parameter:

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

If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this function returns a pointer to this string (you can convert the returned value to PChar), not to a copy of it, so you should not free it.

Use SetItemTag to change tag of item.

See also methods:

•	SetItemTag.

See also method of TRichViewEdit:

•	GetCurrentTag.

See also:

•	RichView items' "tags".


TRichView.GetItemText -A -W
 TRichView Reference | TRichView

TCustomRichView.GetItemText, GetItemTextA, GetItemTextW

Returns a text of text item, or a name of non-text item.

function GetItemText(ItemNo: Integer): String;

function GetItemTextA(ItemNo: Integer): TRVAnsiString;

function GetItemTextW(ItemNo: Integer): TRVUnicodeString;

(Introduced in version 1.3, 1.7)

ItemNo – index of the item. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.GetItemText*.

 Unicode notes:

GetItemTextA always returns ANSI string:

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

•	If the item is a Unicode text item, the function converts Unicode text to ANSI (Unicode text is converted basing on Charset of the item text style).

GetItemTextW always returns Unicode string:

•	If the item is a Unicode text item, the text is returned as it is.

•	If the item is a non-text item, or a text item of ANSI style, the function converts ANSI text to Unicode (ANSI text is converted basing on Charset of the item text style, or on RVStyle.DefCodePage for non-text items).

GetItemText works like GetItemTextW in Delphi/C++Builder 2009 or newer, and like GetItemTextA in the older versions of Delphi/C++Builder.

(There is one more version of this method, GetItemTextR, returning TRVRawByteString value. This method returns text in a way it is stored in TRichView)

See also:

•	SetItemText -A -W.

See also method of TRichViewEdit:

•	GetCurrentItemText -A -W.

See also:

•	Obtaining Items of RichView;

•	Unicode in RichView.


TRichView.GetItemVAlign
 TRichView Reference | TRichView

TCustomRichView.GetItemVAlign

Returns vertical alignment (position relative to the line) of the ItemNo-th item.

function GetItemVAlign(ItemNo: Integer): TRVVAlign;

(introduced in version 12)

Parameter:

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

This method must not be called for text items, tables, breaks, tabs, list markers, footnotes and endnotes.

Use SetItemVAlign to change vertical alignment.

See also methods:

•	SetItemVAlign.

See also method of TRichViewEdit:

•	GetCurrentItemVAlign


TRichView.GetJumpPointItemNo
 TRichView Reference | TRichView

TCustomRichView.GetJumpPointItemNo

Returns index of hypertext item (hotspot, hot-picture or text hypertext) by its hypertext id.

function GetJumpPointItemNo(id: Integer): Integer;

Warning: do not use this function for document containing tables. When the link is in table cell, or in cell inplace-editor, it can not be addressed using only an index of item. Use GetJumpPointLocation instead.

Parameter

id – identifier of the hypertext link; links are numbered sequentially starting from FirstJumpNo.

Return value

Index of the hypertext item (in range 0..ItemCount-1). If there is no link with such id, the method returns -1.

Note: this function contains some calculations inside (iterations through hyperlinks, from the first link to the requested one)

For TCustomRichViewEdit, if ReadOnly=False, this function always returns -1 (except for calling it from inside OnWriteHyperlink, OnJump or OnRVMouseMove).

See also:

•	RichView hypertext.


TRichView.GetJumpPointLocation
 TRichView Reference | TRichView

TCustomRichView.GetJumpPointLocation

Returns information required to access item by its hypertext id.

procedure GetJumpPointLocation(id: Integer;

  var RVData: TCustomRVFormattedData; var ItemNo: Integer);

(introduced in version 1.4)

Input parameter

id – identifier of the hypertext link; links are numbered sequentially starting from FirstJumpNo.

Output parameters

RVData and ItemNo define location of the hypertext item with the given hypertext id.

Hypertext item is the ItemNo-th item in RVData object.

RVData is a RichView document. It can be RichView.RVData, table cell, or RVData of cell inplace-editor.

If there is no jump with such id, the method returns -1 in ItemNo.

Note: this function contains some calculations inside (iterations through hyperlinks, from the first link to the requested one)

For TCustomRichViewEdit, if ReadOnly=False, this function always returns -1(except for calling it from inside OnWriteHyperlink, OnJump or OnRVMouseMove).

See also:

•	RichView hypertext.


TRichView.GetJumpPointY
 TRichView Reference | TRichView

TCustomRichView.GetJumpPointY

Returns vertical coordinate of the hypertext link (hotspot, hot-picture or text hypertext), identified by id

function GetJumpPointY(id: Integer): Integer;

Parameter

id – identifier of the hypertext link; links are numbered sequentially starting from FirstJumpNo.

Return value

You can use the returned value to scroll document to the position of this link (useful when implementing "Back" button functionality)

If there is no link with such id, the method returns 0 (top of the document)

This method must be called only when the document is formatted.

Note: this function contains some calculations inside (iterations through jumps, from the first jump to requested one)

For TCustomRichViewEdit, if ReadOnly=False, this function always returns 0 (except for calling it from inside OnJump or OnRVMouseMove).

See also methods:

•	ScrollTo

See also:

•	RichView Hypertext


TRichView.GetLastCheckpoint
 TRichView Reference | TRichView

TCustomRichView.GetLastCheckpoint

Returns value identifying the last checkpoint in the document, or nil if the document has no checkpoints.

function GetLastCheckpoint: TCheckpointData;

(introduced in version 1.5)

GetLastCheckpoint + GetPrevCheckpoint allow to iterate through all checkpoints in the document.

Checkpoints from subdocuments (table cells) are not included in the checkpoints list of document.

See also methods:

•	GetNextCheckpoint, contains example;

•	GetFirstCheckpoint;

•	GetPrevCheckpoint;

•	GetCheckpointInfo;

•	GetCheckpointXY.

See also:

•	"Checkpoints".


TRichView.GetLineNo
 TRichView Reference | TRichView

TCustomRichView.GetLineNo

Returns line of the position specified by ItemNo and ItemOffs.

function GetLineNo(ItemNo, ItemOffs: Integer): Integer;

(introduced in version 1.7)

Parameters

ItemNo – index of the item, in range from 0 to ItemCount-1.

ItemOffs – offset in item.

For non-text items, ItemOffs=0 specifies position before the item, ItemOffs=1 specifies position after the item (this is not important for this function, because non-text item cannot be placed on several lines).

For text items, ItemOffs specifies position before the ItemOffs-th character:

•	ItemOffs=1 – position before the text item (before the first character);

•	ItemOffs=2 – position before the second character;

•	    ....

•	ItemOffs=GetOffsAfterItem(ItemNo) – position after the last character of the text item.

Return value

Line index. The first line has index 1. Number of lines depends on word-wrapping.

Example:

with MyRichView do

  r := GetLineNo(ItemCount-1, GetOffsAfterItem(ItemCount-1))

r receives number of lines in MyRichView.

Warning: this function contains calculations inside, and it may take a while to execute it. (There is an idea how to make it lightning-fast in future, but it will be implemented later).

This method must be called only when the document is formatted.

See also:

•	GetItemStyle.

See also methods of TCustomRichViewEdit:

•	GetCurrentLineCol.


TRichView.GetListMarkerInfo
 TRichView Reference | TRichView

TCustomRichView.GetListMarkerInfo

Returns main properties of list marker (paragraph bullet or numbering)

function GetListMarkerInfo(AItemNo: Integer;

  var AListNo, AListLevel, AStartFrom: Integer;

  var AUseStartFrom: Boolean): Integer;

(introduced in version 1.7)

Input parameter

AItemNo – index of the item, in range from 0 to ItemCount-1. This is not necessary the index of list marker, it can be index of any item in the given paragraph.  Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.GetListMarkerInfo.

Output parameters (valid only if the function returned non-negative value)

AListNo – style of this list maker. This is an index in the collection of list styles (Style.ListStyles).

AListLevel – list level. This is an index in the collection of list levels (Style.ListStyles[AListNo].Levels).

AStartFrom: if AUseStartFrom=True, and this is a numbered list, this parameter is a value of list counter for this marker. If AUseStartFrom=False, numbering is continued.

Return value:

If this paragraph does not have a marker, this function returns -1; otherwise it returns item index of the marker.

See also:

•	SetListMarkerInfo.


TRichView.GetNextCheckpoint
 TRichView Reference | TRichView

TCustomRichView.GetNextCheckpoint

Returns value identifying the next checkpoint after the given CheckpointData, or nil if CheckpointData is the last checkpoint in  the document.

function GetNextCheckpoint(CheckpointData: TCheckpointData): TCheckpointData;

GetFirstCheckpoint + GetNextCheckpoint allow to iterate through all checkpoints in the document.

Checkpoints from subdocuments (table cells) are not included in checkpoints list of the document.

Example:

var Tag: Integer;

    Name: String;

    CheckpointData: TCheckpointData;

    RaiseEvent: Boolean;

    s: String;

begin

  MyListBox.Items.Clear;

  CheckpointData := MyRichView.GetFirstCheckpoint;

  while CheckpointData<>nil do

  begin

    MyRichView.GetCheckpointInfo(CheckpointData, Tag, Name, RaiseEvent);

    s := Format('Name:"%s" Tag:%d', [Name, Tag]);

    MyListBox.Items.Add(s);

    CheckpointData := MyRichView.GetNextCheckpoint(CheckpointData);

  end;

end;

This code fills listbox MyListBox with information about checkpoints of MyRichView.

See also methods:

•	GetFirstCheckpoint;

•	GetLastCheckpoint;

•	GetPrevCheckpoint;

•	GetCheckpointInfo;

•	GetCheckpointXY.

See also:

•	"Checkpoints".


TRichView.GetOffsAfterItem
 TRichView Reference | TRichView

TCustomRichView.GetOffsAfterItem

Returns offset after the ItemNo-th item in the document

function GetOffsAfterItem(ItemNo: Integer): Integer;

This method is useful for selecting part of document for copying in the Clipboard, or for moving caret to the specified position in editor.

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.GetOffsAfterItem.

For text items, the method returns length of text + 1 For non-text items, it returns 1.

Example for TRichViewEdit: moving caret to the end of document

var ItemNo, Offs: Integer;

  ItemNo := MyRichViewEdit.ItemCount-1;

  Offs := MyRichViewEdit.GetOffsAfterItem(ItemNo);

  MyRichViewEdit.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);

  MyRichViewEdit.Invalidate;

See also methods of TRichView:

•	SetSelectionBounds;

•	GetOffsBeforeItem.

See also properties of TRichView:

•	ItemCount.

See also properties of TRichViewEdit:

•	CurItemNo;

•	OffsetInCurItem.

See also:

•	Working with selection;

•	How to: move a caret to the beginning or to the end of document in TRichViewEdit.


TRichView.GetOffsBeforeItem
 TRichView Reference | TRichView

TCustomRichView.GetOffsBeforeItem

Returns offset before the ItemNo-th item in the document

function GetOffsBeforeItem(ItemNo: Integer): Integer;

This method is useful for selecting a part of document for copying in the Clipboard, or for moving caret to the specified position in editor.

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.GetOffsBeforeItem.

For text items, the method returns 1 For non-text items, it returns 0.

Example for TRichViewEdit: moving caret to the beginning of document

var ItemNo, Offs: Integer;

  ItemNo := 0;

  Offs := MyRichViewEdit.GetOffsBeforeItem(ItemNo);

  MyRichViewEdit.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);

  MyRichViewEdit.Invalidate;

See also methods of TRichView:

•	SetSelectionBounds;

•	GetOffsAfterItem.

See also properties of TRichView:

•	ItemCount.

See also properties of TRichViewEdit:

•	CurItemNo;

•	OffsetInCurItem.

See also:

•	Working with selection;

•	How to: move a caret to the beginning or to the end of document in TRichViewEdit;

•	Example how to move caret to the beginning of paragraph.


TRichView.GetPictureInfo
 TRichView Reference | TRichView

TCustomRichView.GetPictureInfo

Returns main properties for item of picture or hot-picture type

procedure GetPictureInfo(ItemNo: Integer; var AName: TRVAnsiString;

  var Agr: TGraphic; var AVAlign: TRVVAlign;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of picture or hot-picture type (rvsPicture), otherwise the method raises ERichViewError exception. 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.GetPictureInfo.

Output parameters:

AName – name of the item. This value can also be read using GetItemText method.

Agr – graphic object. This method returns object owned by RichView, do not not destroy it.

AVAlign – vertical alignment of the picture.

ATag – tag of the item. If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag or SetPictureInfo to change tag of item. This value can also be read using GetItemTag method.

Additional item properties (including stretching, transparency for bitmaps, link to file name, alternative text for saving to HTML) are returned by the methods GetItemExtraIntProperty and GetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	SetPictureInfo;

•	GetItemStyle;

•	GetItemExtraIntProperty;

•	GetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichView.GetPrevCheckpoint
 TRichView Reference | TRichView

TCustomRichView.GetPrevCheckpoint

Returns value identifying the previous checkpoint before the given CheckpointData, or nil if CheckpointData is the first checkpoint in the document.

function GetPrevCheckpoint(CheckpointData: TCheckpointData): TCheckpointData;

(introduced in version 1.5)

GetLastCheckpoint + GetPrevCheckpoint allow to iterate through all checkpoints in the document.

Checkpoints from subdocuments (table cells) are not included in checkpoints list of document.

See also methods:

•	GetFirstCheckpoint;

•	GetLastCheckpoint;

•	GetNextCheckpoint;

•	GetCheckpointInfo;

•	GetCheckpointXY.

See also:

•	"Checkpoints".


TRichView.GetSelectedImage
 TRichView Reference | TRichView

TCustomRichView.GetSelectedImage

Returns the selected image

function GetSelectedImage: TGraphic;

This method returns image, if the selection consist only of one image. If there is nothing selected, or not only image is selected, this method returns nil.

The method returns image owned by RichView, not a copy of it. So do not destroy this image.

This method must be called only when the document is formatted.

See also:

•	Working with selection.


TRichView.GetSelectionBounds
 TRichView Reference | TRichView

TCustomRichView.GetSelectionBounds

Returns bounds of selected part of document.

procedure GetSelectionBounds(var StartItemNo, StartItemOffs,

  EndItemNo, EndItemOffs: Integer; Normalize: Boolean);

Parameters

StartItemNo – index of the first selected item.

StartItemOffs:

•	if the first item is a text item, then the selection start is before the StartItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1).

•	if the first item is not a text, then

•	if StartItemOffs=0, then the selection start is before the first item;

•	if StartItemOffs=1, then the selection start is after the first item.

EndItemNo – index of the last selected item.

EndItemOffs:

•	if the last item is a text item, then the selection end is before the EndItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1).

•	if the last item is not a text, then

•	if EndItemOffs=0, then the selection end is before the last item

•	if EndItemOffs=1, then the selection end is after the last item.

Normalize:

•	if True, the upper bound of the selection is returned in StartItemNo:StartItemOffs, and the lower bound is in EndItemNo:EndItemOffs;

•	if False, bounds are returned as they were selected by user.

The selection is empty if

•	StartItemNo=-1 or

•	- StartItemNo=EndItemNo and StartItemOffs=EndItemOffs.

This method must be called only when the document is formatted.

If you want to get selection bounds using richedit-like parameters (SelStart and SelLength), use RVGetSelection from RVLinear unit instead.

See also methods:

•	SetSelectionBounds.

See also:

•	Working with selection.


TRichView.GetSelText
 TRichView Reference | TRichView

TCustomRichView.GetSelText, GetSelTextW

These methods return the selected part of the document as a text.

function GetSelText: String;

function GetSelTextA: TRVAnsiString;

function GetSelTextW: TRVUnicodeString;

If there is nothing selected, these methods return '' (empty string)

 Unicode notes:

GetSelTextA always returns ANSI string:

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

•	If the item is a Unicode text item, the function converts Unicode text to ANSI (Unicode text is converted basing on Charset of the item text style).

GetSelTextW always returns Unicode string:

•	If the item is a Unicode text item, the text is returned as it is.

•	If the item is a non-text item, or a text item of ANSI style, the function converts ANSI text to Unicode (ANSI text is converted basing on Charset of the item text style, or on RVStyle.DefCodePage for non-text items).

GetSelText works like GetSelTextW in Delphi/C++Builder 2009 or newer, and like GetSelTextA in the older versions of Delphi/C++Builder.

These methods must be called only when the document is formatted.

See also:

•	Working with selection.


TRichView.GetTextInfo
 TRichView Reference | TRichView

TCustomRichView.GetTextInfo

Returns text and tag for the ItemNo-th item

procedure GetTextInfo(ItemNo: Integer; var AText: String;

  var ATag: Integer);

Input parameter:

ItemNo – index of the item. The item must be of text type (GetItemStyle must return zero or positive value for this item), otherwise the method raises ERichViewError exception. Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.GetTextInfo.

Output parameters:

AText – item text (visible text). This is the same value as returned by GetItemText.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetItemTag to change tag of item. The tag can also be returned by GetItemTag.

See also methods:

•	GetItemStyle;

•	GetItemText, SetItemText;

•	GetItemTag, SetItemTag.

See also properties:

•	ItemCount.

See also:

•	Obtaining items;

•	Item types;

•	"Tags".


TRichView.GetWordAt -A -W
 TRichView Reference | TRichView

TCustomRichView.GetWordAt, GetWordAtA, GetWordAtW

Returns word at the specified coordinates

procedure GetWordAt(X,Y: Integer;

  var RVData: TCustomRVFormattedData; var ItemNo: Integer;

  var Word: String); overload;

function GetWordAtA(X,Y: Integer): TRVAnsiString;

function GetWordAtW(X,Y: Integer): TRVUnicodeString

function GetWordAt(X,Y: Integer): String;

Input parameters

(X,Y) – client coordinates (coordinates relative to the top left corner of RichView window).

Output parameters

Word (or returned value for the simplified versions) receives word (if it is a text item), or name of non-text item. See the Unicode note below. "Word" is defined as a part of string between delimiters. Delimiters are listed in Delimiters property.

ItemNo receives index of item at (X,Y), or -1 if there is no item at this point. This is an index of item in RVData object (it may be the main document, cell, or cell inplace editor).

 Unicode notes: (since TRichView version 11) the advanced version of GetWordAt returns word as a String parameter (Unicode for Delphi/C++Builder 2009 or newer, ANSI for older versions of Delphi/C++Builder). A conversion is performed from Unicode/ANSI text items to String, if necessary. See the notes below for the simplified versions for the details of this conversion.

GetWordAtA always returns ANSI string:

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

•	If the item is a Unicode text item, the function converts Unicode text to ANSI (Unicode text is converted basing on Charset of the item text style).

GetWordAtW always returns Unicode string:

•	If the item is a Unicode text item, the text is returned as it is.

•	If the item is a non-text item, or a text item of ANSI style, the function converts ANSI text to Unicode (ANSI text is converted basing on Charset of the item text style, or on RVStyle.DefCodePage for non-text items).

The simplified version of GetWordAt works like GetWordAtW in Delphi/C++Builder 2009 or newer, and as GetWordAtA in the older versions of Delphi/C++Builder.

For example, you can use this method inside OnRVMouseDown and OnRVMouseUp.

This method must be called only when the document is formatted.

Example: displaying the clicked words (only text items!) in Label1.

We cannot use simplified version of GetWordAt because we cannot know if the returned text is for text item.

uses CRVFData;

...

procedure TForm1.RichView1RVMouseUp(Sender: TCustomRichView;

  Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);

var

  LItemNo: Integer;

  LRVData: TCustomRVFormattedData;

  LWord: String;

begin

  ItemNo<0 then

    exit; // we already know that the mouse is not above item

  Sender.GetWordAt(X,Y, LRVData, LItemNo, LWord);

  if LItemNo<0 then

    exit;

  if LRVData.GetItemStyle(LItemNo)>=0 then // text item?

    Label1.Caption := LWord;

end;

There is one more version of this method: GetWordAtR. It returns text in Word as it is, in TRVRawByteString parameter.

See also events:

•	OnRVMouseDown;

•	OnRVMouseUp;

•	OnRVRightClick;

•	OnRVDblClick.

See also properties:

•	Delimiters.

See also methods:

•	SelectWordAt


TRichView.InsertRVFFromStream
 TRichView Reference | TRichView

TCustomRichView.InsertRVFFromStream

Inserts RVF content from Stream in the position of the document specified as Index (the first inserted item will have this index)

function InsertRVFFromStream(Stream: TStream; Index: Integer): Boolean;

This is the only method of RichView (not RichViewEdit) inserting items in any position.

Index – index of the item, must be in range from 0 to ItemCount. Items of subdocuments (table cells) are not included in the items range of the main document.

Method type:  viewer-style.

Setting for RVF loading can be changed in the TRichView component editor.

Return value: "Was reading successful?"

Example

This example shows how to combine several RVF documents in one.

procedure AddDoc(const FileName: String; rv: TCustomRichView);

var Stream: TFileStream;

begin

  Stream := TFileStream.Create(FileName, fmOpenRead);

  rv.InsertRVFFromStream(Stream, rv.ItemCount);

  Stream.Free;

end;

  ...

  RichView1.Clear;

  RichView1.DeleteUnusedStyles(True, True, True);

  AddDoc('c:\file1.rvf', RichView1);

  AddDoc('c:\file2.rvf', RichView1);

  AddDoc('c:\file3.rvf', RichView1);

  RichView1.Format;

If you want to add page breaks between documents, use the following code

procedure AddDoc(const FileName: String; rv: TCustomRichView);

var Stream: TFileStream;

  ItemCount: Integer;

begin

  ItemCount := rv.ItemCount;

  Stream := TFileStream.Create(FileName, fmOpenRead);

  rv.InsertRVFFromStream(Stream, rv.ItemCount);

  Stream.Free;

  if (ItemCount>0) and (ItemCount<rv.ItemCount) then

    rv.PageBreaksBeforeItems[ItemCount] := True;

end;

See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF insertion);

•	RVFParaStylesReadMode (this method type: RVF insertion).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also methods:

•	AppendRVFFromStream;

•	LoadRVFFromStream;

•	LoadRVF;

•	Format;

•	FormatTail.

See also methods of TRichViewEdit:

•	InsertRVFFromStreamEd.

•	See also:

•	TRichView component editor;

•	Saving and loading;

•	RVF overview.


TRichView.IsFromNewLine
 TRichView Reference | TRichView

TCustomRichView.IsFromNewLine

Returns "does the ItemNo-th item start a new line"?

function IsFromNewLine(ItemNo: Integer): Boolean;

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.IsFromNewLine.

This method returns True both in cases when this item starts a new paragraph (see IsParaStart) or starts a new line inside the paragraph (it was moved to the new line in editor using  Shift + Enter , or added in the mode SetAddParagraphMode(False)).

See also methods:

•	IsParaStart;

•	GetItemPara.

See also:

•	Paragraphs.


TRichView.IsParaStart
 TRichView Reference | TRichView

TCustomRichView.IsParaStart

Returns "is the ItemNo-th item a first paragraph item"?

function IsParaStart(ItemNo: Integer): Boolean;

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.IsParaStart.

This method returns False if this item starts a new line inside the paragraph (i.e. it was moved to the new line in editor using  Shift + Enter , or added in the mode SetAddParagraphMode(False)).

See also methods:

•	IsFromNewLine;

•	GetItemPara.

See also:

•	Paragraphs;

•	Example how to move caret to the beginning of paragraph.


TRichView.LiveSpellingValidateWord
 TRichView Reference | TRichView

TCustomRichView.LiveSpellingValidateWord

Removes live spelling underlines from all occurrences of AWord.

procedure LiveSpellingValidateWord(const AWord: String);

(introduced in version 1.9)

Call this method if you added this word in a dictionary or ignore list.

This procedure does not affect further processing of this word. User dictionaries and ignore list must be maintained by spelling checkers.

 Unicode note: live spelling interface is Unicode for Delphi/C++Builder 2009 or newer, and ANSI for the older versions of Delphi/C++Builder.

See also:

•	Live spelling check in RichView.


TRichView.LoadFromStream
 TRichView Reference | TRichView

TCustomRichView.LoadFromStream

Loads document from Stream, autodetecting its format (RVF/RTF/text)

type

  TRVYesNoAuto = ( rvynaNo, rvynaYes, rvynaAuto );

function LoadFromStream(Stream: TStream; IsTextUnicode: TRVYesNoAuto): Boolean;

(introduced in version 10)

IsTextUnicode specifies whether the text is Unicode:

•	rvynaNo – reading text as ANSI;

•	rvynaYes – reading text as Unicode;

•	rvynaAuto – autodetecting ANSI/Unicode (wrong detection is very possible).

Method type:  viewer-style.

Return value:

"Was reading successful?"

See also methods of TRichView:

•	LoadRVFFromStream;

•	LoadRTFFromStream;

•	LoadRTFFromStream,  LoadRTFFromStreamW.


TRichView.LoadRTF
 TRichView Reference | TRichView

TCustomRichView.LoadRTF

Appends the content of RTF (Rich Text Format) file FileName to the document.

function LoadRTF(const FileName: String):Boolean;

(Introduced in version 1.5)

Despite its name, this method does not clear the existing document before loading. To replace the current document with the content of this file, call Clear method before loading (and may be DeleteUnusedStyles after Clear)

Method type:  viewer-style.

Parameters for loading are in RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

See important note on loading external images from RTF.

By default, hyperlinks are not loaded. You can load them using OnReadHyperlink event.

Return value: "Was reading successful?" (extended information is in RTFReadProperties.ErrorCode)

 Unicode note: Text can be imported as Unicode or not, depending on value of RTFReadProperties.UnicodeMode.

See also methods of TRichView:

•	LoadRTFFromStream;

•	SaveRTF.

See also events of TRichView:

•	OnImportPicture;

•	OnReadHyperlink.

See also methods of TRichViewEdit:

•	InsertRTFFromFileEd.

See also:

•	Saving and loading in RichView.


TRichView.LoadRTFFromStream
 TRichView Reference | TRichView

TCustomRichView.LoadRTFFromStream

Appends the content of RTF (Rich Text Format) stream Stream to the document.

function LoadRTFFromStream(Stream: TStream):Boolean;

(Introduced in version 1.5)

Despite its name, this method does not clear the existing document before loading. To replace the current document with the content of this file, call Clear method before loading (and may be DeleteUnusedStyles after Clear)

Method type:  viewer-style.

Parameters for loading are in TRichView.RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

See important note on loading external images from RTF.

By default, hyperlinks are not loaded. You can load them using OnReadHyperlink event.

Return value: "Was reading successful?" (extended information is in TRichView.RTFReadProperties.ErrorCode)

See also methods of TRichView:

•	LoadRTF;

•	SaveRTFToStream.

See also events of TRichView:

•	OnImportPicture;

•	OnReadHyperlink.

See also methods of TRichViewEdit:

•	InsertRTFFromStreamEd.

See also:

•	Saving and loading in RichView.


TRichView.LoadRVF
 TRichView Reference | TRichView

TCustomRichView.LoadRVF

Clears the document and loads a new document from the file FileName as RVF (RichView Format).

function LoadRVF(const FileName: String): Boolean;

Method type:  viewer-style.

Setting for RVF loading can be changed in the TRichView component editor.

Return value: "Was reading successful?"

See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF loading);

•	RVFParaStylesReadMode (this method type: RVF loading).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also methods:

•	LoadRVFFromStream;

•	AppendRVFFromStream;

•	InsertRVFFromStream;

•	Format;

•	FormatTail.

See also methods of TRichViewEdit:

•	InsertRVFFromFileEd.

•	See also:

•	TRichView component editor;

•	Saving and loading;

•	RVF overview.


TRichView.LoadRVFFromStream
 TRichView Reference | TRichView

TCustomRichView.LoadRVFFromStream

Clears the document and loads a new document from the file stream Stream as RVF (RichView Format).

function LoadRVFFromStream(Stream: TStream): Boolean;

Method type:  viewer-style.

Setting for RVF loading can be changed in the TRichView component editor.

Return value: "Was reading successful?"

See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF loading);

•	RVFParaStylesReadMode (this method type: RVF loading).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also methods:

•	LoadRVF;

•	AppendRVFFromStream;

•	InsertRVFFromStream;

•	Format;

•	FormatTail.

See also methods of TRichViewEdit:

•	InsertRVFFromFileEd.

•	See also:

•	TRichView component editor;

•	Saving and loading;

•	RVF overview.


TRichView.LoadText -W
 TRichView Reference | TRichView

TCustomRichView.LoadText, LoadTextW

Append the content of the text file FileName to the document. LoadText loads text from ANSI text files, LoadTextW loads text from Unicode (UTF-16) text files.

function LoadText(const FileName: String; StyleNo, ParaNo: Integer;

  AsSingleParagraph: Boolean):Boolean;

function LoadTextW(const FileName: String; StyleNo, ParaNo: Integer;

  DefAsSingleParagraph: Boolean):Boolean;

Despite their names, these methods do not clear the existing document before loading. To replace the current document with the content of this file, call Clear method before loading (and may be DeleteUnusedStyles after Clear).

Parameters

StyleNo – index of text style which will be used for new text. It defines font attributes for the added text.

ParaNo – index of paragraph style which will be used for new text. It defines paragraph attributes for the added text.

AsSingleParagraph (and DefAsSingleParagraph):

•	False  –  the methods use the current add-paragraph-mode (see SetAddParagraphMode);

•	True – the methods add all text as a single paragraph (add the first new item in the current add-paragraph-mode, set add-paragraph-mode to False, add the rest of text, restore the add-paragraph-mode). DefAsSingleParagraph only affects processing CR and LF characters. WideChar($2029) ("paragraph separator") always initiates a new paragraph. WideChar($2028) ("line separator") always initiates a new line.

LoadTextW supports the Unicode byte order marks characters (if it's present, it must be the first character in the file).

Methods type:  viewer-style.

 Unicode notes:

LoadText (text in the file must be ANSI):

•	If the StyleNo-th style is ANSI style, text from the file is loaded as it is.

•	If the StyleNo-th style is Unicode style, text from the file is converted to Unicode (conversion is performed basing on the Charset of this style).

LoadTextW  (text in the file must be Unicode):

•	If the StyleNo-th style is Unicode style, text from the file is added as it is..

•	If the StyleNo-th style is ANSI style, text from the file is converted to ANSI (conversion is performed basing on the Charset of this style).

Return value:"Was loading successful?"

See also methods:

•	LoadTextFromStream, LoadTextFromStreamW;

•	AddTextNLA, AddTextNLW;

•	Format;

•	FormatTail;

•	SetAddParagraphMode;

•	SaveText, SaveTextW.

See also methods of TRichViewEdit:

•	InsertTextFromFile, InsertTextFromFileW.

See also properties of TRVStyle:

•	TextStyles;

•	SpacesInTab.

See also:

•	Other methods for appending items;

•	Saving and loading;

•	Unicode in RichView;

•	Example how to load UTF-8 files.


TRichView.LoadTextFromStream -W
 TRichView Reference | TRichView

TCustomRichView.LoadTextFromStream, LoadTextFromStreamW

Append the content of the stream Stream to the document. LoadTextFromStream reads ANSI text, LoadTextFromStreamW reads Unicode (UTF-16) text.

function LoadTextFromStream(Stream: TStream; StyleNo, ParaNo: Integer;

  AsSingleParagraph: Boolean):Boolean;

function LoadTextFromStreamW(Stream: TStream; StyleNo, ParaNo: Integer;

  DefAsSingleParagraph: Boolean):Boolean;

The same as LoadText and LoadTextW, but read text from streams instead of files.


TRichView.MarkStylesInUse
 TRichView Reference | TRichView

TCustomRichView.MarkStylesInUse

Stores lists of used text, paragraph and list styles.

procedure MarkStylesInUse(Data: TRVDeleteUnusedStylesData);

(introduced in version 10)

This method is useful if collections of text, paragraph and list styles are not saved in RVF documents (but stored in file or in the Registry). In this case, several documents share the same collections of styles. See TRVDeleteUnusedStylesData for the examples.

Usually it's much more simple (and recommended) to use one RVStyle per one RichView and store collections of styles inside RVF documents. In this case, you can use DeleteUnusedStyles instead.

See also methods:

•	DeleteMarkedStyles;

•	DeleteUnusedStyles.


TRichView.Reformat
 TRichView Reference | TRichView

TCustomRichView.Reformat

Reformats the document.

Only formatted documents can be displayed or edited.

procedure Reformat;

(introduced in v1.9)

This method works like Format, but keeps the selection (and caret position in TRichViewEdit).

Document must be formatted before calling this method.

This method is useful, for example, if you want to reformat document after changing margins.


TRichView.RefreshListMarkers
 TRichView Reference | TRichView

TCustomRichView.RefreshListMarkers

Recalculates list markers

procedure RefreshListMarkers;

(introduced in v1.8)

Call it (before calling Format) if you changed ListType or FormatString of list style level of marker that is already inserted in TRichView. It's usually not necessary to use this method.


TRichView.RemoveCheckpoint
 TRichView Reference | TRichView

TCustomRichView.RemoveCheckpoint

Removes the checkpoint associated with the ItemNo-th item.

function RemoveCheckpoint(ItemNo: Integer): Boolean;

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

If the ItemNo-th item does not have a checkpoint, this method does nothing.

Methods type:  viewer-style.

Repainting may be needed if rvoShowCheckpoints in Options.

See also methods of TRichView:

•	GetItemCheckpoint;

•	SetCheckpointInfo.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	RemoveCheckpointEd;

•	RemoveCurrentCheckpoint.

See also:

•	"Checkpoints";

•	Modifying RichView items.


TRichView.ResetAnimation
 TRichView Reference | TRichView

TCustomRichView.ResetAnimation

Rewinds all inserted animated pictures to the first frame.

procedure ResetAnimation;

(introduced in version 10)

See also methods:

•	StartAnimation;

•	StopAnimation.

See also properties:

•	AnimationMode.

See also:

•	Animation in TRichView;

•	Pictures;

•	Hot-Pictures.


TRichView.SaveHTML
 TRichView Reference | TRichView

TCustomRichView.SaveHTML

Exports TRichView document to HTML or XHTML file, using HTML tags like <font>, <b>, <div>, etc.

function SaveHTML(const FileName, Title, ImagesPrefix: String;

  Options: TRVSaveOptions): Boolean;

This method saves HTML file and a set of images (in separate files).

Files saved by this method can be rendered by the most of HTML applications. But many advanced formatting options are lost. Files saved by SaveHTMLEx look better in modern browsers.

Parameters:

FileName – the name of the output HTML file.

Title – the title of the output HTML file.

ImagesPrefix – the first part of names of images that will be saved with HTML document.

Options – options for saving, see TRVSaveOptions for possible values.

By default, inserted controls and hypertext links are not saved. You can save them yourself using OnSaveComponentToFile and OnWriteHyperlink events.

You can:

•	completely change HTML code for certain items using OnSaveItemToFile event;

•	insert additional code in HTML in OnSaveHTMLExtra and OnSaveParaToHTML events;

•	change how images are saved using OnHTMLSaveImage or OnSaveImage2 event,

•	insert HTML codes in text.

Return value: "successful saving?"

See also methods:

•	SaveHTMLEx;

•	SaveHTMLToStream.

See also events:

•	OnWriteHyperlink;

•	OnSaveComponentToFile;

•	OnSaveHTMLExtra;

•	OnHTMLSaveImage;

•	OnSaveImage2;

•	OnSaveItemToFile;

•	OnSaveParaToHTML.

See also:

•	Export to HTML;

•	RichViewSavePInHTML typed constant;

•	TFontInfo.Options (HTML codes);

•	Saving and loading.


TRichView.SaveHTMLEx
 TRichView Reference | TRichView

TCustomRichView.SaveHTMLEx

Exports TRichView document to HTML or XHTML file, using CSS (Cascading Style Sheets)

function SaveHTMLEx(const FileName, Title, ImagesPrefix, ExtraStyles,

  ExternalCSS, CPPrefix: String;

  Options: TRVSaveOptions): Boolean;

This method saves HTML file and a set of images (in separate files).

Parameters:

FileName –- the name of the output HTML file.

Title –- the title of the output HTML file.

ImagesPrefix –- the first part of names of images that will be saved with HTML document;

ExtraStyles –- strings that can contain additional entries of CSS (usually you need not to use it, set to '').

ExternalCSS –- if this string is not empty, this method use external CSS (saved with RichView.Style.SaveCSS) instead of saving CSS into HTML file).

CPPrefix –- first part of checkpoints names when saving to HTML; set to '' for using default names ('RichViewCheckPoint'). This parameter is not used, if rvsoUseCheckpointsNames is in Options.

Options – options for saving, see TRVSaveOptions for possible values.

By default, inserted controls and hypertext links are not saved. You can save them yourself using OnSaveComponentToFile and OnWriteHyperlink events.

You can:

•	completely change HTML code for certain items using OnSaveItemToFile event;

•	insert additional code in HTML in OnSaveHTMLExtra and OnSaveParaToHTML events;

•	change how images are saved using OnHTMLSaveImage or OnSaveImage2 event,

•	insert HTML codes in text.

Since v1.9, the resulting HTML conforms "HTML 4.01 Transitional" standard, see http://validator.w3.org/.

Two issues may cause the validator's warnings:

•	HTML encoding is written in HTML only if Charset of the 0-th text style <> DEFAULT_CHARSET;

•	non-standard <TABLE bordercolor> attribute is saved for MS Internet Explorer.

Return value: "successful saving?"

See also methods:

•	SaveHTML;

•	SaveHTMLToStreamEx.

See also events:

•	OnWriteHyperlink;

•	OnSaveComponentToFile;

•	OnSaveHTMLExtra;

•	OnHTMLSaveImage;

•	OnSaveImage2;

•	OnSaveItemToFile;

•	OnSaveParaToHTML.

See also:

•	Export to HTML;

•	TFontInfo.Options (HTML codes);

•	RichViewSaveDivInHTMLEx typed constant;

•	Saving and loading.


TRichView.SaveHTMLToStream
 TRichView Reference | TRichView

TCustomRichView.SaveHTMLToStream

Exports TRichView document as HTML or XHTML to the stream Stream, using HTML tags like <font>, <b>, <div>, etc.

function SaveHTMLToStream(Stream: TStream; const Path, Title,ImagesPrefix: String;

  Options: TRVSaveOptions): Boolean;

This method saves HTML to Stream and creates files for images.

The same as SaveHTML, but saves to stream instead of file.

Parameters:

Stream –- stream where to export HTML.

Path –- path where to save images (must have '\' as the last character).

For the descriptions of other parameters, see SaveHTML.


TRichView.SaveHTMLToStreamEx
 TRichView Reference | TRichView

TCustomRichView.SaveHTMLToStreamEx

Exports contents of RichView to stream as HTML or XHTML, using CSS (Cascading Style Sheets)

function SaveHTMLToStreamEx(Stream: TStream;

  const Path, Title, ImagesPrefix, ExtraStyles,

  ExternalCSS, CPPrefix: String;

  Options: TRVSaveOptions): Boolean;

This method saves HTML to Stream and creates files for images.

The same as SaveHTMLEx, but saves to stream instead of file.

Parameters:

Stream –- stream where to export HTML.

Path –- path where to save images (must have '\' as the last character).

For the descriptions of other parameters, see SaveHTMLEx.


TRichView.SavePicture
 TRichView Reference | TRichView

TCustomRichView.SavePicture

Saves picture. This method is used when saving HTML files.

function SavePicture(DocumentSaveFormat: TRVSaveFormat;

  const Path: String; gr: TGraphic): String; virtual;

Parameters:

gr – image to save.

DocumentSaveFormat – output document format, see TRVSaveFormat for possible values.

Path – path where to save the image (the last character must be '\').

If DocumentSaveFormat=rvsfHTML then the image is saved as Jpeg image (or as bitmap, if the application was compiled with RVDONOTUSEJPEGIMAGE conditional define). You can define image formats that will not be converted to Jpeg.

If DocumentSaveFormat<>rvsfHTML, the image is saved as bitmap.

This method must be used only inside the following events:

•	OnHTMLSaveImage,

•	OnSaveImage2,

•	OnSaveComponentToFile,

•	OnSaveItemToFile (SaveFormat=rvsfHTML).

The image file name will consist of the image prefix (see the ImagesPrefix parameter of SaveHTML and SaveHTMLEx) and number. The file name may be unique or not (depending on rvsoOverrideImages in the Options parameter of SaveHTML and SaveHTMLEx).

See also:

•	Export to HTML.


TRichView.SaveRTF
 TRichView Reference | TRichView

TCustomRichView.SaveRTF

Exports TRichView document (or the selected part, if SelectionOnly=True) to the file FileName as RTF (Rich Text Format).

function SaveRTF(const FileName: String; SelectionOnly: Boolean):Boolean;

(introduced in version 1.3)

Options for saving are in RTFOptions property.

By default, inserted controls and hypertext links are not saved. You can save them yourself using OnSaveComponentToFile and OnWriteHyperlink events.

You can:

•	completely change RTF code for certain items using OnSaveItemToFile event;

•	insert additional code in RTF in OnSaveRTFExtra event;

•	insert RTF codes in text.

Return value: "successful saving?"

See also methods:

•	SaveRTFToStream;

•	CopyRTF;

•	LoadRTF.

See also properties:

•	RTFOptions.

See also events:

•	OnWriteHyperlink;

•	OnSaveComponentToFile;

•	OnSaveRTFExtra;

•	OnSaveItemToFile.

See also:

•	Saving and loading in RichView.


TRichView.SaveRTFToStream
 TRichView Reference | TRichView

TCustomRichView.SaveRTFToStream

Exports TRichView document (or the selected part, if SelectionOnly=True) to the Stream as RTF (Rich Text Format)

function SaveRTFToStream(Stream: TStream; SelectionOnly: Boolean):Boolean;

Options for saving are in RTFOptions property.

By default, inserted controls and hypertext links are not saved. You can save them yourself using OnSaveComponentToFile and OnWriteHyperlink events.

You can:

•	completely change RTF code for certain items using OnSaveItemToFile event;

•	insert additional code in RTF in OnSaveRTFExtra event;

•	insert RTF codes in text.

Return value: "successful saving?"

See also methods:

•	SaveRTF;

•	CopyRTF;

•	LoadRTFFromStream.

See also properties:

•	RTFOptions.

See also events:

•	OnWriteHyperlink;

•	OnSaveComponentToFile;

•	OnSaveRTFExtra;

•	OnSaveItemToFile.

See also:

•	Saving and loading in RichView.


TRichView.SaveRVF
 TRichView Reference | TRichView

TCustomRichView.SaveRVF

Saves the document (or the selected part, if SelectionOnly=True) to the file FileName as RVF (RichView Format)

function SaveRVF(const FileName: String; SelectionOnly: Boolean): Boolean;

Setting for RVF saving can be changed in the TRichView component editor.

Return value: "successful saving?"

See also properties:

•	RVFOptions.

See also methods:

•	SaveRVFToStream;

•	LoadRVF.

See also:

•	Saving and loading RichView document;

•	RVF.


TRichView.SaveRVFToStream
 TRichView Reference | TRichView

TCustomRichView.SaveRVFToStream

Saves the document (or the selected part, if SelectionOnly=True) to the Stream as RVF (RichView Format).

function SaveRVFToStream(Stream: TStream; SelectionOnly: Boolean): Boolean;

Setting for RVF saving can be changed in the TRichView component editor.

Return value: "successful saving?"

See also properties:

•	RVFOptions.

See also methods:

•	SaveRVF;

•	LoadRVFFromStream;

•	InsertRVFFromStream;

•	AppendRVFFromStream.

See also:

•	Saving and loading RichView document;

•	RVF.


TRichView.SaveText -W
 TRichView Reference | TRichView

TCustomRichView.SaveText, SaveTextW

The methods export document to ANSI (SaveText) or Unicode (SaveTextW) text file.

function SaveText(const FileName: String; LineWidth: Integer): Boolean;

function SaveTextW(const FileName: String; LineWidth: Integer): Boolean;

Parameters:

FileName – output file name.

LineWidth is used for saving breaks (they are saved as LineWidth '-' characters)

 Unicode notes:.

SaveText: text of Unicode styles is converted basing on TRVStyle.DefCodePage.

SaveTextW: text of ANSI styles is converted basing on its character sets (if Charset=DEFAULT_CHARSET, it is converted using TRVStyle.DefCodePage).

Return value: "successful saving?"

See also methods:

•	SaveTextToStream, SaveTextToStreamW;

•	LoadText, LoadTextW.

See also events:

•	OnSaveImage2;

•	OnSaveComponentToFile;

•	OnSaveItemToFile.

See also:

•	Saving and loading RichView documents.


TRichView.SaveTextToStream -W
 TRichView Reference | TRichView

TCustomRichView.SaveTextToStream, SaveTextToStreamW

The methods export document or selection as ANSI (SaveTextToStream) or Unicode (SaveTextToStreamW) text.

function SaveTextToStream(const Path: String; Stream: TStream;

  LineWidth: Integer; SelectionOnly, TextOnly: Boolean):Boolean;

function SaveTextToStreamW(const Path: String; Stream: TStream;

  LineWidth: Integer; SelectionOnly, TextOnly: Boolean):Boolean;

(introduced in version 1.3)

Parameters

LineWidth is used for saving breaks (they are saved as LineWidth '-' characters)

Path – path for saving images and other non-text items (they are not saved by default, but this parameter is used in OnSaveImage2, OnSaveComponentToFile, and OnSaveItemToFile events);

SelectionOnly – if True, only selected part of the document is saved.

TextOnly – if True, non-text items are ignored when saving. If False, text representation of items is saved.

 Unicode notes:.

SaveTextToStream: text of Unicode styles is converted basing on TRVStyle.DefCodePage.

SaveTextToStreamW: text of ANSI styles is converted basing on its character sets (if Charset=DEFAULT_CHARSET, it is converted using TRVStyle.DefCodePage).

Return value: "successful saving?"

See also methods:

•	SaveText, SaveTextW;

•	LoadTextFromStream, LoadTextFromStreamW.

See also events:

•	OnSaveImage2;

•	OnSaveComponentToFile;

•	OnSaveItemToFile.

See also:

•	Saving and loading RichView documents.


TRichView.SearchText -A -W
 TRichView Reference | TRichView

TCustomRichView.SearchText, SearchTextA, SearchTextW

The methods search for the substring s in the document.

function SearchText(s: String; SrchOptions: TRVSearchOptions): Boolean;

function SearchTextA(s: TRVAnsiString; SrchOptions: TRVSearchOptions): Boolean;

function SearchTextW(s: TRVUnicodeString; SrchOptions: TRVSearchOptions): Boolean;

When found, these methods select substring and scroll to it.

if rvsroDown is not included in SrchOptions, the methods search upwards. if rvsroDown is included, the methods search downwards.

If rvsroFromStart is included in SrchOptions, the search is started from the beginning/end of the document. Otherwise, the methods start searching from the current selection, if it exists. If nothing is selected, the methods start from the first visible item (when searching down) or the last visible item (when searching up).

If rvsroMultiItem is included, the search can match substrings of several text items. If not included, the text is searched in each text item separately. For example, if the document contains the text Hello, the substring 'Hello' can be found only if this option is included, because 'He' and 'llo' belong to different items.

 Unicode note:  The methods allow searching both in ANSI and in Unicode text items. When SearchTextA compares Unicode text with s, the conversion is based on RVStyle.DefCodePage. When SearchTextW compares ANSI text with s, the conversion is based on the character set of the text style. SearchText works like SearchTextW in Delphi/C++Builder 2009 or newer, and like SearchTextA in the older versions.

History and compatibility

Since version 1.2 SearchText can search upwards.

Since version 1.5 SearchText can search whole words (substring must be delimited with characters from Delimiters)

SearchTextW is introduced in version 10. rvsroFromStart is introduced in version 10 as well.

rvsroMultiItem is introduced in version 12.

Note: There is incompatibility with programs written with the older version of RichView (1.0 – 1.1.4). Now if rvsroDown is not included in SrchOptions, the methods search upwards. In the older versions there was no rvsroDown option, and SearchText searched downwards only.

These methods must be called only when the document is formatted.

Return value: Is substring found?

See also methods of TRichViewEdit:

•	SearchText, -A, -W

See also global functions:

•	GetRVSearchOptions.

See also:

•	Searching in RichView and RichViewEdit.


TRichView.SelectAll
 TRichView Reference | TRichView

TCustomRichView.SelectAll

Selects the whole document for copying to the Clipboard

procedure SelectAll;

This method does not repaint document, call Invalidate.

In RichViewEdit this method moves the caret to the end of document. The method generates OnSelect event.

This method must be called only when the document is formatted.

See also methods:

•	SetSelectionBounds;

•	Deselect.

See also:

•	Selecting in RichView document.

See also:

•	Edit method of table cell.


TRichView.SelectControl
 TRichView Reference | TRichView

TCustomRichView.SelectControl

Selects the given visual control in the document.

function SelectControl(actrl: TControl): Boolean;

(introduced in version 1.8)

The method selects the item containing the control actrl.

This method repaints document.

The method generates OnSelect event.

In TRichViewEdit, if this control's item is resizable (see rvepResizable extra-property) and resizing with mouse is not forbidden (see rvoNoImageResize in EditorOptions), resizing handles appear. A good idea to call this method in OnClick event of resizable controls.

This method must be called only when the document is formatted.

Return value: True if this control was found and selected.

See also methods:

•	SetSelectionBounds;

•	Deselect.

See also:

Selecting in RichView document.


TRichView.SelectionExists
 TRichView Reference | TRichView

TCustomRichView.SelectionExists

"Is some part of document selected for copying to the Clipboard?"

function SelectionExists: Boolean;

Note: In some cases, this function can generate OnSelect event, but it's safe to use it inside OnSelect event handler (infinite recursion will not occur)

This method must be called only when the document is formatted.

See also:

•	Selecting in RichView document.


TRichView.SelectWordAt
 TRichView Reference | TRichView

TCustomRichView.SelectWordAt

Selects word at the specified point for copying to clipboard. If there is non text item at this point (such as picture), this item becomes selected.

procedure SelectWordAt(X,Y: Integer);

"Word" is defined as a part of string between delimiters. Delimiters are listed in Delimiters property.

This method repaints document.

In RichViewEdit this method moves the caret to the end of the selected word.

The method generates OnSelect event.

Parameters:

(X,Y) – client coordinates (coordinates relative to the top left corner of RichView window).

This method must be called only when the document is formatted.

Note: RichView can automatically select double-clicked word, if rvoDblClickSelectsWord is in Options.

See also events:

•	OnRVRightClick;

•	OnRVDblClick.

See also properties:

•	Delimiters.

See also methods:

•	SelectAll;

•	GetWordAt;

•	SetSelectionBounds;

•	GetSelText.

See also methods of TRichViewEdit:

•	SelectCurrentWord.

See also:

•	Selecting in RichView document.


TRichView.SetAddParagraphMode
 TRichView Reference | TRichView

TCustomRichView.SetAddParagraphMode

Sets mode for adding items from new line for all Add*** methods.

procedure SetAddParagraphMode(AllowNewPara: Boolean);

(Introduced in version 1.2)

By default (if SetAddParagraphMode was not called), all items that will be added from new line will start new paragraphs.

You can change this mode calling SetAddParagraphMode(False), and then return this mode again calling SetAddParagraphMode(True).

After SetAddParagraphMode(False) items that will be added from new line will not start new paragraphs but will be displayed from new line inside  the previous paragraph.

Warning: be careful using SetAddParagraphMode(False):

•	do not add the first item (or the item after breaks or tables) in this mode;

•	do not switch paragraph style in this mode (all items in the same paragraph must have the same paragraph style).

See: valid documents

Example 1:

with MyRichView do begin

  Clear;

  SetAddParagraphMode(True); // default mode

  AddNLATag('First',  0, 0, 0); // ok, starting 1st paragraph with style 0

  AddNLATag('Second', 0, 0, 0); // ok, starting 2nd paragraph with style 0

  AddNLATag('Third',  0, 1, 0); // ok, starting 3rd paragraph with style 1

end;

Example 2:

with MyRichView do begin

  Clear;

  SetAddParagraphMode(False);

  AddNLATag('First', 0, 0, 0); // error, do not add the first item in this mode!

end;

Example 3:

with MyRichView do begin

  Clear;

  SetAddParagraphMode(True); // default mode

  AddNLATag('First',  0, 0, 0); // ok, starting 1st paragraph with style 0

  SetAddParagraphMode(False);

  AddNLATag('Second', 0, 0, 0); // ok, adding this item from new line inside the 1st paragraph

  AddNLATag('Third',  0, 1, 0); // error, do not add items with another paragraph style in this mode!

end;

See also

•	Paragraphs;

•	Building a document.


TRichView.SetBreakInfo
 TRichView Reference | TRichView

TCustomRichView.SetBreakInfo

Changes main properties of the item of break (horizontal line) type.

procedure SetBreakInfo(ItemNo: Integer; AWidth: Byte;

  AStyle: TRVBreakStyle; AColor: TColor;

  ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of break type (rvsBreak), otherwise the method raises ERichViewError exception. 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.SetBreakInfo.

AWidth – line width (or rectangle height). Must be in range from 1 to 10.

AStyle – visual style of this break, see TRVBreakStyle for possible values.

AColor – line color. If it is equal to clNone, Style.TextStyles[0].Color is used.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetBreakInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.

Method type:  viewer-style. It's not necessary to reformat document after it, repainting is enough.

Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty.

Example

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetBreakInfo(ItemNo, 1, rvbsLine, clNone, 1)

// if rvoTagsArePChars in RichView2.Options

RichView2.SetBreakInfo(ItemNo, 1, rvbsLine, clNone, Integer(StrNew('Break Tag')));

See also methods:

•	GetBreakInfo;

•	GetItemStyle;

•	SetItemExtraIntProperty;

•	SetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetBreakInfoEd;

•	SetCurrentBreakInfo.

See also:

•	Modifying RichView items;

•	Item types;

•	Tags.


TRichView.SetBulletInfo
 TRichView Reference | TRichView

TCustomRichView.SetBulletInfo

Changes main properties of the item of bullet (image from ImageList) type.

procedure SetBulletInfo(ItemNo: Integer; const AName: TRVAnsiString;

  AImageIndex: Integer; AImageList: TCustomImageList;

  ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of bullet or hotspot type (rvsBullet or rvsHotspot), otherwise the method raises ERichViewError exception. 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.SetBulletInfo.

AName – name of bullet, any string without line break (CR, LF) characters. It can also be set using SetItemText method.

AImageList – not used, reserved, set it to nil.

AImageIndex – index of image in image list.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetBulletInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.

Method type:  viewer-style. It's not necessary to reformat document after it, repainting is enough.

Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

Example

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetBulletInfo(ItemNo, 'my image', 0, nil, 1)

// if rvoTagsArePChars in RichView2.Options

RichView1.SetBulletInfo(ItemNo, 'my image', 0, nil, Integer(StrNew('bullet tag')));

See also methods:

•	GetBulletInfo;

•	GetItemStyle;

•	SetItemExtraIntProperty;

•	SetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetBulletInfoEd;

•	SetCurrentBulletInfo.

See also:

•	Modifying RichView items;

•	Item types;

•	Tags.


TRichView.SetCheckpointInfo
 TRichView Reference | TRichView

TCustomRichView.SetCheckpointInfo

Creates a new checkpoint or modifies the existing checkpoint associated with the ItemNo-th item

procedure SetCheckpointInfo(ItemNo: Integer; ATag: Integer;

  const AName: String; ARaiseEvent: Boolean);

Parameters

ItemNo – index of the item, from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetCheckpointInfo. If this item already has a checkpoint, its properties are modified; otherwise, a new checkpoint is created.

ATag – tag of checkpoint; it can be an integer value or a pointer to dynamically allocated string (see rvoTagsArePChars in RichView.Options)

AName – name of the checkpoint, any string without line break (CR, LF) characters.

ARaiseEvent – "raise event" flag; if set, RichView can generate OnCheckpointVisible event for this checkpoint.

Method type:  viewer-style. It's not necessary to reformat document after it, repainting is enough (repainting is needed if rvoShowCheckpoints in Options).

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	GetItemCheckpoint;

•	RemoveCheckpoint.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetCheckpointInfoEd;

•	SetCurrentCheckpointInfo.

See also:

•	Modifying RichView items;

•	Checkpoints;

•	Tags.


TRichView.SetControlInfo
 TRichView Reference | TRichView

TCustomRichView.SetControlInfo

Changes main properties of the item of control type.

function SetControlInfo(ItemNo: Integer; const AName: TRVAnsiString;

  AVAlign: TRVVAlign; ATag: Integer): Boolean;

Parameters:

ItemNo – index of the item. The item must be of control type (rvsComponent), otherwise the method raises ERichViewError exception. 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.SetControlInfo.

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetItemText method. This is not a Name property of the control!

AVAlign – vertical alignment of this item, see TRVVAlign for possible options.

ATag – tag of the item. Do not confuse with Tag property of the control! If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetControlInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.

Return value: "is reformatting needed? (i.e., is the new vertical align not equal to the old one?)"

Method type:  viewer-style.

Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

Note: As you can see, current version of TRichView does not allow to change the control itself.

Example

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetControlInfo(ItemNo, 'my control', rvvaBaseline, 1)

// if rvoTagsArePChars in RichView2.Options

RichView1.SetControlInfo(ItemNo, 'my control', rvvaBaseline, Integer(StrNew('control tag')));

See also methods:

•	GetControlInfo;

•	GetItemStyle;

•	Format;

•	SetItemExtraIntProperty;

•	SetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetControlInfoEd;

•	SetCurrentControlInfo.

See also:

•	Modifying RichView items;

•	Item types;

•	Tags.


TRichView.SetHotspotInfo
 TRichView Reference | TRichView

TCustomRichView.SetHotspotInfo

Changes main properties of the item of hotspot (image from ImageList, hyperlink) type.

procedure SetHotspotInfo(ItemNo: Integer; const AName: TRVAnsiString;

  AImageIndex, AHotImageIndex: Integer;

  AImageList: TCustomImageList;

  ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of hotspot type (rvsHotspot), otherwise the method raises ERichViewError exception. 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.SetHotspotInfo.

AName – name of hotspot, any string without line break (CR, LF) characters. It can also be set using SetItemText method.

AImageList – not used, reserved, set it to nil..

AImageIndex – index of image in image list.

AImageIndex – index of "hot" image in image list. This image is displayed under the mouse pointer (in TRichView, or in TRichViewEdit in hypertext mode), or when user moves the caret to this item (in TRichViewEdit).

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetHotspotInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.

Method type:  viewer-style. It's not necessary to reformat document after it, repainting is enough.

Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

Example

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetHotspotInfo(ItemNo, 'my image', 0, 0, nil, 1)

// if rvoTagsArePChars in RichView2.Options

RichView1.SetHotspotInfo(ItemNo, 'my image', 0, 0, nil, Integer(StrNew('hotspot tag')));

See also methods:

•	GetHotspotInfo;

•	GetItemStyle;

•	SetItemExtraIntProperty;

•	SetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetHotspotInfoEd;

•	SetCurrentHotspotInfo.

See also:

•	Modifying RichView items;

•	Item types;

•	Tags.


TRichView.SetItemExtraIntProperty
 TRichView Reference | TRichView

TCustomRichView.SetItemExtraIntProperty

Changes value of the specified additional integer property of the ItemNo-th item.

function SetItemExtraIntProperty(ItemNo: Integer;

  Prop: TRVExtraItemProperty; Value: Integer): Boolean;

(introduced in version 1.7)

This method sets new Value of the item property identified by Prop. See TRVExtraItemProperty for the list of available integer properties.

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

Method type:  viewer-style. Reformatting or repainting may be needed, depending on the changed property.

Return value: True, if this item has this property. False, if not.

See also

•	GetItemExtraIntProperty;

•	SetItemExtraStrProperty;

•	Format.

See also methods of TRichViewEdit

•	SetItemExtraIntPropertyEd;

•	SetCurrentItemExtraIntProperty.


TRichView.SetItemExtraStrProperty
 TRichView Reference | TRichView

TCustomRichView.SetItemExtraStrProperty

Changes value of the specified additional string property of the ItemNo-th item.

function SetItemExtraStrProperty(ItemNo: Integer;

  Prop: TRVExtraItemStrProperty; const Value: String): Boolean;

(introduced in version 1.9)

This method sets new Value of the item property identified by Prop. See TRVExtraItemStrProperty for the list of available string properties.

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

Method type:  viewer-style. Reformatting or repainting is not necessary.

 Unicode note: string properties are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

Return value: True, if this item has this property. False, if not.

See also:

•	GetItemExtraStrProperty;

•	SetItemExtraIntProperty.

See also methods of TRichViewEdit:

•	SetItemExtraStrPropertyEd;

•	SetCurrentItemExtraStrProperty.


TRichView.SetItemTag
 TRichView Reference | TRichView

TCustomRichView.SetItemTag

Changing tag of the ItemNo-th item

procedure SetItemTag(ItemNo: Integer; ATag: Integer);

Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemTag.

Method type:  viewer-style. Reformatting or repainting is not necessary.

Tag can be an integer value or a pointer to dynamically allocated string, see Tags.

Example

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetItemTag(ItemNo, 1)

// if rvoTagsArePChars in RichView2.Options

RichView1.SetItemTag(ItemNo, Integer(StrNew('tag #1')));

See also methods:

•	GetItemTag.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetItemTagEd;

•	SetCurrentTag.

See also:

•	Modifying RichView items;

•	Tags.


TRichView.SetItemText -A -W
 TRichView Reference | TRichView

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)

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 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:  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.SetItemVAlign
 TRichView Reference | TRichView

TCustomRichView.SetItemVAlign

Changing vertical alignment (position relative to the line) of the ItemNo-th item

procedure SetItemVAlign(ItemNo: Integer; VAlign: TRVVAlign);

(introduced in version 12)

Parameters:

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

VAlign – new value of vertical alignment.

This method must not be called for text items, tables, breaks, tabs, list markers, footnotes and endnotes.

Method type:  viewer-style. Requires reformatting and repainting.

See also methods:

•	GetItemVAlign.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetItemVAlignEd;

•	SetCurrentItemVAlign.

See also:

•	Modifying RichView items


TRichView.SetListMarkerInfo
 TRichView Reference | TRichView

TCustomRichView.SetListMarkerInfo

Makes the given paragraph bulleted or numbered.

function SetListMarkerInfo(AItemNo, AListNo,

  AListLevel, AStartFrom, AParaNo: Integer;

  AUseStartFrom: Boolean): Integer;

(introduced in version 1.7)

Parameters:

AItemNo – index of the item, in range from 0 to ItemCount-1. This is not necessary the index of list marker, it can be index of any item in the given paragraph.  Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetListMarkerInfo. If this paragraph does not have list marker, a new list marker is created; otherwise, properties of the existing marker are modified.

If AItemNo<0 or >=ItemCount, a new marker is added at the end of the document. It's assumed that at least one item will be added after such marker  in the same paragraph (see Valid Documents).

AListNo – style of this list maker. This is an index in the collection of list styles (Style.ListStyles).

AListLevel – list level. This is an index in the collection of list levels (Style.ListStyles[AListNo].Levels).

AStartFrom: if AUseStartFrom=True, and this is a numbered list, this parameter is a value of list counter for this marker. If AUseStartFrom=False, numbering is continued.

AParaNo is used to define paragraph style of marker (if it is added as the last item, i.e. AItemNo<0). This is an index in the collection of paragraph styles (Style.ParaStyles). If this marker is added to the existing paragraph, this parameter is ignored.

Method type:  viewer-style.

Important note: list marker cannot be the only item in paragraph. It must be followed by other item. If you need empty markered paragraph, call Add to add empty text item after the list marker. See also: rules for valid documents

Return value: item index of the marker.

See also methods:

•	GetListMarkerInfo;

•	Format.

See also properties:

•	Style;

•	ItemCount.

See also methods of TCustomRichViewEdit

•	ApplyListStyle;

•	RemoveLists;

•	ChangeListLevels.

See also:

•	List Markers.


TRichView.SetPictureInfo
 TRichView Reference | TRichView

TCustomRichView.SetPictureInfo

Changes main properties of the item of picture or hot-picture type.

function SetPictureInfo(ItemNo: Integer; const  AName: TRVAnsiString;

  Agr: TGraphic; AVAlign: TRVVAlign; ATag: Integer): Boolean;

Parameters:

ItemNo – index of the item. The item must be of picture or hot-picture type (rvsPicture or rvsHotPicture), otherwise the method raises ERichViewError exception. 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.SetPictureInfo.

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetItemText method.

Agr – graphic object. It must be an unique graphic object (you cannot assign the same graphic object to two or more items) or value returned by GetPictureInfo.

AVAlign – vertical alignment of the picture.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetPictureInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.

Return value: is reformatting needed? (are the size and the vertical align of the new picture not equal to the size and the vertical align of the old one?)

Method type:  viewer-style.

Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty (including stretching, transparency for bitmaps, link to file name, alternative text for saving to HTML).

 Unicode note: names of non-text items are ANSI strings.

Example 1

// if not (rvoTagsArePChars in RichView1.Options)

RichView1.SetPictureInfo(ItemNo, 'my image', Bitmap1, rvvaBaseline, 1)

// if rvoTagsArePChars in RichView2.Options

RichView1.SetPictureInfo(ItemNo, 'my image', Bitmap2, rvvaBaseline, Integer(StrNew('bullet tag')));

Example 2 (incorrect!)

bmp := TBitmap.Create;

bmp.LoadFromFile('c:\image.bmp');

RichView1.SetPictureInfo(ItemNo1, '', bmp, rvvaBaseline, 0);

RichView1.SetPictureInfo(ItemNo2, '', bmp, rvvaBaseline, 0); // incorrect! you cannot assign

  // the same graphic object to different items

Example 2 (the same, but correct)

bmp1 := TBitmap.Create;

bmp1.LoadFromFile('c:\image.bmp');

RichView1.SetPictureInfo(ItemNo1, '', bmp1, rvvaBaseline, 0);

bmp2 := TBitmap.Create;

bmp2.Assign(bmp1);

RichView1.SetPictureInfo(ItemNo2, '', bmp2, rvvaBaseline, 0);

See also methods:

•	GetPictureInfo;

•	GetItemStyle;

•	Format;

•	SetItemExtraIntProperty;

•	SetItemExtraStrProperty.

See also properties:

•	ItemCount.

See also methods of RichViewEdit:

•	SetPictureInfoEd;

•	SetCurrentPictureInfo.

See also:

•	Modifying RichView items;

•	Item types;

•	Tags.


TRichView.SetSelectionBounds
 TRichView Reference | TRichView

TCustomRichView.SetSelectionBounds

Selects part of RichView document (for copying to the Clipboard)

procedure SetSelectionBounds(StartItemNo, StartItemOffs,

  EndItemNo, EndItemOffs: Integer);

Parameters

StartItemNo – index of the first selected item.

StartItemOffs:

•	if the first item is a text item, then the selection start is before the StartItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1).

•	if the first item is not a text, then

•	if StartItemOffs=0, then the selection start is before the first item;

•	if StartItemOffs=1, then the selection start is after the first item.

EndItemNo – index of the last selected item.

EndItemOffs:

•	if the last item is a text item, then the selection end is before the EndItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1).

•	if the last item is not a text, then

•	if EndItemOffs=0, then the selection end is before the last item

•	if EndItemOffs=1, then the selection end is after the last item.

In TRichViewEdit, the caret is always at the end of the selection, so this method can be used to move caret.

There are two ways to deselect:

•	to pass StartItemNo=-1

•	to pass StartItemNo=EndItemNo and StartItemOffs=EndItemOffs (in editor, the caret is moved to the specified position).

Please be careful and do not specify incorrect values.

This method does not repaint component (use Invalidate)

This method generates OnSelect event.

There are two useful methods to work with SetSelectionBounds: GetOffsBeforeItem and GetOffsAfterItem.

This method must be called only when the document is formatted.

If you want to set selection bounds using richedit-like parameters (SelStart and SelLength), use RVSetSelection from RVLinear unit instead.

See also methods:

•	SelectAll;

•	Deselect;

•	GetSelectionBounds.

See also events:

•	OnSelect.

See also:

•	Working with selection;

•	How to: move a caret to the beginning or to the end of document in TRichViewEdit;

•	Example how to move caret to the beginning of paragraph.

See also:

•	Edit method of table cell.


TRichView.StartAnimation
 TRichView Reference | TRichView

TCustomRichView.StartAnimation

Starts animation of pictures.

procedure StartAnimation;

(introduced in version 10)

Alternatively, animation may start automatically when document is formatted, if AnimationMode = rvaniOnFormat.

See also methods:

•	ResetAnimation;

•	StopAnimation.

See also properties:

•	AnimationMode.

See also:

•	Animation in TRichView;

•	Pictures;

•	Hot-Pictures.


TRichView.StartLiveSpelling
 TRichView Reference | TRichView

TCustomRichView.StartLiveSpelling

Starts live spelling check (runs a live spelling thread).

procedure StartLiveSpelling;

(introduced in v1.9)

OnSpellingCheck event must be assigned.

If live spelling thread is already active, this method clears all live spelling underlines and restarts the thread from the beginning of document.

Note: If you use  RichViewActions and want to start live spelling immediately when document is loaded, call StartLiveSpelling  in TrvActionOpen.OnOpenFile.

See also property of TRichViewEdit:

•	LiveSpellingMode.

See also:

•	Live spelling check in RichView.


TRichView.StopAnimation
 TRichView Reference | TRichView

TCustomRichView.StopAnimation

Stops animation of pictures.

procedure StopAnimation;

(introduced in version 10)

Clear may stop animations as well.

See also methods:

•	StartAnimation;

•	ResetAnimation.

See also properties:

•	AnimationMode.

See also:

•	Animation in TRichView;

•	Pictures;

•	Hot-Pictures.


TRichView.UpdatePaletteInfo
 TRichView Reference | TRichView

TCustomRichView.UpdatePaletteInfo

Call this method when screen color resolution changed (see WM_DISPLAYCHANGE window message). You need not to call this method if DoInPaletteMode=rvpaDoNothing.

procedure UpdatePaletteInfo;

Example

You also need to call UpdatePaletteInfo if you create TRichView at run-time (instead of placing at design-time on form) after you have created it.

This method is necessary only in 256-color display mode (not supported by new versions of Windows).

See also properties:

•	DoInPaletteMode.

See also methods of TRVPrint:

•	UpdatePaletteInfo.


TRichView.OnAddStyle
 TRichView Reference | TRichView

TCustomRichView.OnAddStyle

Occurs when new style is added.

type

  TRVAddStyleEvent = procedure (Sender: TCustomRichView;

    StyleInfo: TCustomRVInfo) of object;

property OnAddStyle: TRVAddStyleEvent;

(introduced in version 11)

This event occurs when a new style is added (to TextStyles, ParaStyles, or ListStyles collections of the linked TRVStyle component) as a result of:

•	RTF (Rich Text Format) reading (both loading and insertion)

•	RVF (RichView Format) insertion;

•	(in editor) changing the current text style on keyboard language change (see rvoAutoSwitchLang in EditorOptions).

Notes about additional components:

•	HTML importers call this event;

•	RichViewActions do not call this event, they use TRVAControlPanel.OnAddStyle instead.


TRichView.OnCheckpointVisible
 TRichView Reference | TRichView

TCustomRichView.OnCheckpointVisible

Occurs when checkpoint (with RaiseEvent flag = True) becomes visible as a result of vertical scrolling.

type

  TRVCheckpointVisibleEvent = procedure(Sender: TCustomRichView;

    CheckpointData: TCheckpointData) of object;

property OnCheckpointVisible: TRVCheckpointVisibleEvent;

This event occurs if:

•	RichView.CPEventKind = cpeWhenVisible for checkpoint that becomes visible;

•	RichView.CPEventKind = cpeAsSectionStart for visible checkpoint or the nearest checkpoint above visible area.

CheckpointData parameter identifies the checkpoint. It's possible that CheckpointData=nil (no checkpoint visible).

This event never occurs in TRichViewEdit.

See also properties:

•	CPEventKind.

See also methods extracting information from CheckpointData:

•	GetCheckpointInfo;

•	GetCheckpointXY;

•	GetCheckpointYEx;

•	GetCheckpointItemNo;

•	GetCheckpointNo.

See also

•	Checkpoints.


TRichView.OnControlAction
 TRichView Reference | TRichView

TCustomRichView.OnControlAction

Occurs when some important operation is performed on control inserted in RichView

type

  TRVControlAction =

    (rvcaAfterRVFLoad, rvcaDestroy,

     rvcaMoveToUndoList, rvcaMoveFromUndoList,

     rvcaDestroyInUndoList, rvcaBeforeRVFSave,

     rvcaAfterRVFSave);

  TRVControlActionEvent =

    procedure (Sender: TCustomRichView;

      ControlAction: TRVControlAction;

      ItemNo: Integer;

      var ctrl: TControl) of object;

property OnControlAction: TRVControlActionEvent;

(Introduced in version 1.3, changed in v1.4 and v10)

Warning: this event can occur from RichView destructor (when clearing document before destruction). Be careful if you access other controls from this event: they may be already destroyed!

This event occurs when some changes were done (or are being done) on inserted control ctrl.

Position of this control in the document is defined by the "hidden" parameter Sender.Style.RVData (must be typecasted to TCustomRVData) and ItemNo parameter. ItemNo is an index of item (containing ctrl) in the document Sender.Style.RVData (it may be RVData of the main RichView (Sender), cell, or  RVData of cell inplace editor).

ControlAction	Meaning
rvcaAfterRVFLoad	The control was created and loaded from RVF (file, stream, database field or Clipboard);
rvcaDestroy	The control will be destroyed soon (removing items from RichView, or destroying RichView itself)
rvcaMoveToUndoList	The control was moved to undo/redo buffer. It will not be displayed, but it will not be destroyed yet.
rvcaMoveFromUndoList	The control was moved from undo/redo list back to the editor.
rvcaDestroyInUndoList	The control will be destroyed together with undo/redo buffer (undo item); this control is already not in the editor; only ctrl parameter is valid in this case, ItemNo=-1;
rvcaBeforeRVFSave	Before saving to RVF
rvcaAfterRVFSave	After saving to RVF
Note: do not perform any changes on RichView when processing this event.

Note: TRVControlAction is defined in RVStyle unit.

See also:

•	OnItemAction.


TRichView.OnCopy
 TRichView Reference | TRichView

TCustomRichView.OnCopy

Occurs when copying to the Clipboard

property OnCopy: TNotifyEvent;

(Introduced in version 1.4)

Occurs inside CopyDef and Copy methods, or when copying from keyboard.

This event allows copying to the Clipboard in your own formats (occurs between Clipboard.Open and Clipboard.Close).

See also:

•	TRichViewEdit.OnPaste;

•	Working with Clipboard.


TRichView.OnGetItemCursor
 TRichView Reference | TRichView

TCustomRichView.OnGetItemCursor

Allows defining custom custom cursors for items.

type

  TRVGetItemCursorEvent = procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer; var Cursor: TCursor) of object;

property OnGetItemCursor: TRVGetItemCursorEvent;

(introduced in version 12)

This event occurs when mouse pointer moves over the item.

Input Parameters

RVData – document containing this item (RichView.RVData, or table cell, or cell inplace editor's RVData)

ItemNo – index of the item inside RVData.

Output Parameter

Cursor  – cursor to display.

See also:

•	OnItemHint.


TRichView.OnHTMLSaveImage
 TRichView Reference | TRichView

 TCustomRichView.OnHTMLSaveImage

Occurs when TRichView saves item containing image to HTML file or stream. This event allows to modify saving procedure for all (or some) images.

type

  TRVHTMLSaveImageEvent =

    procedure (Sender: TCustomRichView; RVData: TCustomRVData;

      ItemNo: Integer; const Path: String;

      BackgroundColor: TColor; var Location: String;

      var DoDefault: Boolean) of object;

property OnHTMLSaveImage: TRVHTMLSaveImageEvent;

(introduced in version 1.4)

This event is called for the following item types:

•	pictures, hot-pictures,

•	bullets, hotspots,

•	list markers (paragraph bullets) with images,

•	tables (saving background image),

•	for background image and cells' background images.

There is more easy-to-use event: OnSaveImage2.

By default:

Images are saved in separate files as Jpegs (or as bitmaps for Delphi2, or if RVDONOTUSEJPEGIMAGE is defined) and have names composed as ImagesPrefix + Number + '.jpg', where

•	ImagesPrefix – parameter of SaveHTML/SaveHTMLEx;

•	Number – some number making this file name unique (image files can override existing ones or not, depending on parameters of SaveHTML/SaveHTMLEx). Bullets and hotspots items having the same image list, image index and background color are saved in the same file (the same is for list markers).

Transparent color of bullets, hotspots and transparent image formats (TIcon, TMetafile, gifs) is replaced with background color (which can be color of component (TRichView.Color/TRVStyle.Color), color of cell (TRVTableCellData.Color) or color of paragraph background (TRVBackroundRect.Color).

You can define formats that must not be converted to Jpeg.

Input Parameters

RVData – document containing item that is being saved to image; it can be Sender.RVData, table cell, or RVData of cell inplace-editor.

ItemNo – index of this item inside RVData. If this event is called for background image (document or cell), ItemNo=-1.

Path – destination directory of HTML file (or Path parameter of SaveHTMLToStream/SaveHTMLToStreamEx).

BackgroundColor – color of background below the item (can be ignored, if you can preserve transparency of image)

Location – if rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, this is a path to the image defined in the rvespImageFileName item property, relative to Path. Otherwise, initial value of this parameter is empty.

Output Parameters

Location – set this parameter to file name of image where you saved it. This string will be inserted in HTML file.

DoDefault – set to False if you saved this item as image yourself, to disallow default saving. If DoDefault is True, then after calling this event:

•	if rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx and value of rvespImageFileName item property is not empty, this value is written in HTML (relative to Path); otherwise

•	OnSaveImage2 is called (if its handler is assigned); if it is not assigned or OnSaveImage2's DoDefault parameter is True, the default image saving procedure is called.

Inside this event you can use:

•	Sender.imgSaveNo – value which was used as Number for file name for the previously saved image;

•	RVData.GetNextFileName – function returning image file name with the given image prefix and extension:

function GetNextFileName(const ImagesPrefix, Path, Ext: String;

  var imgSaveNo: Integer; OverrideFiles: Boolean): String;

where

ImagesPrefix – the first part of image file name (for example, you can set it to ImagesPrefix parameter of SaveHTML/SaveHTMLEx);

Path – path for the image (for example, you can use Path parameter of this event);

Ext – file extension, for example '.jpg' (you can use GraphicExtension(TGraphicClass(Graphic.ClassType)));

imgSaveNo – this function will use this value incremented one or several times to compose a name of image; returns the incremented value;

OverrideFiles – if set to False, this function will check existing files and returns an unique file name (by incrementing imgSaveNo several times)

Return value: full file name of the image. You can use it to save image and assign it to Location parameter of the event (this file name includes path, use ExtractFileName or ExtractRelativePath).

Alternatively, you can use SavePicture.

See also events:

•	OnSaveImage2;

•	OnSaveItemToFile.

See also

•	Export to HTML.


TRichView.OnImportPicture
 TRichView Reference | TRichView

TCustomRichView.OnImportPicture

Occurs when loading RTF file or stream containing links to image files. This event also can be used by TRVHtmlImporter.

type

  TRVImportPictureEvent =

    procedure (Sender: TCustomRichView;

    const Location: String; Width, Height: Integer;

    var Graphic: TGraphic) of object;

property OnImportPicture: TRVImportPictureEvent;

(introduced in version 1.8)

Usually pictures are saved inside RTF file/stream. But sometimes RTF contains links to external image files (file names or URLs).

If these links are local (like 'c:\images\image.bmp'), TRichView can load these files itself. But if images are on the Internet (like 'http://www.trichview.com/images/headers/what_is.gif'), it makes sense to process this event and to download the image.

Input parameters

Location – path to the file (local or URL);

Width, Height – reserved, equal to 0;

Graphic – nil.

Output parameters

Graphic – set it to the loaded image. If you leave it equal to nil, TRichView will attempt to load the image itself.

(TRichView can load image file only if its extension is associated with some graphic class. Delphi does it automatically for TBitmap, TIcon, TMetafile, TJpegImage. If you use third-party graphic classes, you can register them using TPicture.RegisterFileFormat class procedure).

Example: downloading images from http location using Indy (IdHTTP1: TIdHTTP)

Unfortunately, Delphi does not have methods returning graphic class by file extension. So we need to create a temporal file, save image there, then load it in TPicture.

uses RVFuncs;

{ Returns the system directory for temporal files }

function GetTempDir: String;

var l: Integer;

begin

  // Warning: : The GetTempPath function

  // does not verify that the returned

  // directory exists.

  SetLength(Result, 300);

  l := GetTempPath(300, PChar(Result));

  SetLength(Result, l);

end;

{ Returns name for temporal file with the

  given extension }

function GetTempFileName(const Ext: String): String;

var Path: String;

    v: Integer;

begin

  Path := GetTempDir+'tmp';

  v := Random(MaxInt div 2);

  repeat

    inc(v);

    Result := Path+IntToStr(v)+Ext;

  until not FileExists(Result);

end;

{ TMyRichView.OnImportPicture }

procedure TMyForm.MyRichViewImportPicture(Sender: TCustomRichView;

  const Location: String; Width, Height: Integer;

  var Graphic: TGraphic);

var Stream: TMemoryStream;

    FileStream: TFileStream;

    FileName: String;

    pic: TPicture;

begin

  if Pos('http://', LowerCase(Location))=1 then

  begin

    Stream := TMemoryStream.Create;

    try

      // 1. downloading

      IdHTTP1.Get(Location, Stream);

      // 2. creating temporal file

      FileName := GetTempFileName(ExtractFileExt(Location));

      FileStream := TFileStream.Create(FileName, fmCreate);

      try

        FileStream.CopyFrom(Stream, 0);

      finally

        FileStream.Free;

      end;

      // 3. reading and deleting temporal file

      pic := TPicture.Create;

      try

        pic.LoadFromFile(FileName);

        Graphic := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));

        Graphic.Assign(pic.Graphic);

      finally

        pic.Free;

        DeleteFile(FileName);

      end;

    except

      Graphic.Free;

      Graphic := nil;

    end;

    Stream.Free;

  end;

end;

See also methods of TRichView:

•	LoadRTF;

•	LoadRTFFromStream.

See also methods of TRichViewEdit:

•	InsertRTFFromFileEd;

•	InsertRTFFromStreamEd.


TRichView.OnItemAction
 TRichView Reference | TRichView

TCustomRichView.OnItemAction

Occurs on insertion, deletion and some other modifications of item

type

  TRVItemAction = (rviaInserting, rviaInserted,

    rviaTextModifying, rviaDestroying, rviaMovingToUndoList)

  TRVItemActionEvent = procedure (Sender: TCustomRichView;

    ItemAction: TRVItemAction; Item: TCustomRVItemInfo;

    var Text: TRVRawByteString; RVData: TCustomRVData) of object;

property OnItemAction: TRVItemActionEvent;

(introduced in version 1.7)

Parameters

Item – item for which this event is generated.

Text – text associated with this item. If this is a text item, this text is displayed in RichView.

RVData – document containing Item (it can be Sender.RVData, table cell, or RVData of cell inplace-editor).

ItemAction identifies operation that calls this event.

ItemAction	Meaning
rviaInserting	The event occurs before the item is inserted in Sender (in RVData). You can modify Text. This event also occurs when moving items to cell inplace editor and back to the cell.
rviaInserted	The event occurs after the item is inserted in the Sender (in RVData). Ignore Text parameter. This event also occurs when moving items to cell inplace editor and back to the cell.
rviaMovingToUndoList	The event occurs when item is moved (from RVData) to undo list. Ignore Text parameter.
rviaDestroying	Occurs when item is destroyed. Ignore Text parameter. If the item is in undo/redo list, RVData is nil. Otherwise, this is an object containing this item.
rviaTextModifying	Occurs when item text (Text) is modified as a result of editing operation. Be careful when modifying text. It's highly not recommended to do any modification of Text except for replacing one characters to others.
Example (converting all non-Unicode text to upper case):

procedure TForm1.RichViewEdit1ItemAction(Sender: TCustomRichView;

  ItemAction: TRVItemAction; Item: TCustomRVItemInfo;

  var Text: TRVRawByteString; RVData: TCustomRVData);

begin

  if (ItemAction in [rviaInserting, rviaTextModifying]) and

     (Item.StyleNo>=0) and

     not (rvioUnicode in Item.ItemOptions) then

    Text := AnsiUpperCase(Text);

end;

Warning: this event can occur from RichView destructor (when clearing document before destruction). Be careful if you access other controls from this event, they may be already destroyed.

See also events:

•	OnControlAction.

See also methods:

•	GetItem;

•	GetItemNo.


TRichView.OnItemHint
 TRichView Reference | TRichView

TCustomRichView.OnItemHint

Allows to define custom popup hints for items.

type

  TRVItemHintEvent = procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer;

    var HintText: String) of object;

property OnItemHint: TRVItemHintEvent;

This event occurs when mouse pointer moves over the item.

Parameters

RVData – document containing this item (RichView.RVData, or table cell, or cell inplace editor's RVData)

ItemNo – index of the item inside RVData.

HintText  –  on input, it's a value of rvespHint item property. On output, it's a message that will be displayed.

 Unicode note: hints are Unicode strings for Delphi/C++Builder 2009, and ANSI strings for older versions of Delphi/C++Builder.

Item popup hint can be displayed if rvoShowItemHints is in RichView.Options and RichView.ShowHint=True.

Cell Hints cannot be altered in this event.

See also:

•	OnGetItemCursor.

Example

Besides the default hint, this code displays:

•	for hyperlinks: tag (rvoTagsArePChars must be included in MyRichViewEdit.Options);

•	for images: Delphi class type, width and height.

procedure TMyForm.MyRichViewEditItemHint(Sender: TCustomRichView;

  RVData: TCustomRVData; ItemNo: Integer; var HintText: String);

var Tag: Integer;

    VAlign: TRVVAlign;

    Name: TRVAnsiString;

    gr: TGraphic;

begin

  if RVData.GetItem(ItemNo).GetBoolValueEx(rvbpJump, Sender.Style) then begin

    if HintText<>'' then

      HintText := HintText+#13;

    HintText := HintText + 'Target: '+PChar(RVData.GetItemTag(ItemNo));

  end;

  if (RVData.GetItemStyle(ItemNo)=rvsPicture) or

     (RVData.GetItemStyle(ItemNo)=rvsHotPicture) then begin

    if HintText<>'' then

      HintText := HintText+#13;

    RVData.GetPictureInfo(ItemNo, Name, gr, VAlign, Tag);

    HintText := HintText+gr.ClassName+' ('+IntToStr(gr.Width)+','+IntToStr(gr.Height)+')';

  end;

end;


TRichView.OnJump
 TRichView Reference | TRichView

TCustomRichView.OnJump

Occurs when user clicks on hypertext item.

type

  TJumpEvent = procedure(Sender: TObject; id: Integer) of object;

property OnJump: TJumpEvent;

Parameter

id is an identifier of hypertext link (the first link in the document has id=FirstJumpNo, the next link has id=FirstJumpNo+1, and so on).

In editor, this numeration is available only when the editor works in hypertext mode:

•	while user holds  Ctrl  key (see EditorOptions) until he/she releases it, or the document is modified, or the editor loses focus;

•	if ReadOnly=True.

So, when using this event in editor, perform all actions that use this id before any action changing document or moving focus out of editor.

In viewer, this even can also be initiated using keyboard, if TabNavigation<>rvtnNone. User uses  Tab  to highlight the hyperlink, then  Enter  to activate it (to call this event).

Example:

procedure TMyForm.MyRichViewJump(Sender: TObject; id: Integer);

var ItemNo: Integer;

    RVData: TCustomRVFormattedData;

    s: String;

begin

  MyRichView.GetJumpPointLocation(id, RVData, ItemNo);

  s := PChar(RVData.GetItemTag(ItemNo));

  Application.MessageBox(PChar(s), 'Link', MB_OK or MB_ICONINFORMATION);

end;

This example assumes that rvoTagsArePChars is in Options

See also events:

•	OnRVMouseMove.

See also:

•	RichView hypertext.


TRichView.OnPaint
 TRichView Reference | TRichView

TCustomRichView.OnPaint

Allows painting over the richview document

type

  TRVPaintEvent = procedure (Sender: TCustomRichView;

    Canvas: TCanvas; Prepaint: Boolean) of object;

property OnPaint: TRVPaintEvent;

(introduced in version 1.7)

Parameters:

Canvas – canvas for painting.

Prepaint – reserved for future use.This event is called when all standard painting is done.

This event does not affect printing (see OnPagePrepaint, OnPagePostpaint).

Demo project:

•	Demos\Delphi\Assorted\Custom Draw\CustomDraw\

•	Demos\CBuilder\Assorted\Custom Draw\CustomDraw\


TRichView.OnProgress
 TRichView Reference | TRichView

TCustomRichView.OnProgress

Occurs on long operations

type

  TRVLongOperation = (rvloLoading, rvloConverting);

  TRVProgressStage = (rvpstgStarting, rvpstgRunning, rvpstgEnding);

type

  TRVProgressEvent = procedure (Sender: TCustomRichView;

    Operation: TRVLongOperation; Stage: TRVProgressStage;

    PercentDone: Byte) of object;

property OnProgress: TRVProgressEvent;

(introduced in v1.9)

First, it is called with parameter Stage=rvpstgStarting.

Next, it is called several times with parameter Stage=rvpstgRunning, with PercentDone in range 0..100.

Finally, it is called with parameter Stage=rvpstgEnding.

This event occurs when loading large RTF files/streams, Operation=rvloLoading.

In future, it will be called also during other long operations.

The component does not call this event with Operation=rvloConverting, you can use this value to call this event yourself from your handler of TRVOfficeConverter.OnConverting event.

Note: TRVLongOperation and TRVProgressStage types are declared in RVStyle unit.


TRichView.OnReadHyperlink
 TRichView Reference | TRichView

TCustomRichView.OnReadHyperlink

Occurs when reading hyperlinks (for example, from RTF file)

type

  TRVLoadFormat =

    (rvlfText,rvlfHTML,rvlfRTF,rvlfRVF,rvlfURL);

  TRVReadHyperlink =

    procedure (Sender: TCustomRichView;

      const Target, Extras: String;

      DocFormat: TRVLoadFormat;

     var StyleNo, ItemTag: Integer;

     var ItemName: TRVRawByteString) of object;

property OnReadHyperlink: TRVReadHyperlink;

Input parameters:

Target – target of hypertext link (Internet address, file name, or bookmark/anchor).

Extras – additional information stored with link. For example, if Extras='\l \o"hint_text"', then Target is an RTF bookmark name (because of '\l') and link has a popup hint 'hint_text'.

TRichView automatically writes items hints in rvespHint item's extra string property, and adds '#' to the beginning of links to bookmarks.

DocFormat – format of loaded document.

DocFormat	Meaning
rvlfRTF	The event occurs when reading RTF files containing hyperlinks (RTF loading, pasting, or accepting on drag&drop).
rvlfURL	The event occurs on drag&drop, when accepting URL dropped to TRichViewEdit (rvddURL must be in AcceptDragDropFormat).
rvlfHTML	The event occurs when reading HTML files using TRVHtmlImporter, if rvhtmloAutoHyperlinks is excluded from RVHtmlImporter.Options.
StyleNo:

•	if the item is a picture, it is initially equal to rvsHotPicture. You can change it to rvsPicture, if you want to disable this link.

•	if the item is a text, it is index of style of this text. You can modify it to point to another style. If DocFormat=rvlfURL, the initial style may be not hypertext, so you need to provide index of hypertext style in this parameter.

ItemName:

•	if the item is a picture, it is initially equal to '' (empty string) . You can set it to value which will be assigned to name of this item.

•	if the item is a text, it is initially a text to display. You can modify it.

Output parameters:

StyleNo – style that will be used for the loaded item. See comments for input parameters.

ItemName – value that will be assigned to item text. See comments for input parameters.

ItemTag – value that will be assigned to tag of this item. A good place to store hyperlink target.

Example

procedure TMyForm.MyRichViewReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,

  ItemTag: Integer; var ItemName: String);

begin

  ItemTag := Integer(StrNew(PChar(Target)));

end;

This example assumes that rvoTagsArePChars is in Options

More complicated example

This example assumes that you included rvddURL in AcceptDragDropFormat and want to accept hyperlinks. Besides, it's assumed that "Allow adding styles dynamically" is set in the component editor (or properties are set to the proper values to allow saving the changed collection of text styles).
This code uses blue underlined font for hyperlinks.

procedure TMyForm.MyRichViewReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,

  ItemTag: Integer; var ItemName: String);

var FontStyle: TFontInfo;
begin

  ItemTag := Integer(StrNew(PChar(Target)));

  if DocFormat=rvddURL then

  begin

    FontStyle := TFontInfo.Create(nil);

    FontStyle.Assign(Sender.Style.TextStyles[StyleNo]);

    FontStyle.Color := clBlue;

    FontStyle.Style := FontStyle.Style + [fsUnderline];

    FontStyle.Jump := True;

    StyleNo := Sender.Style.TextStyles.FindSuchStyle(

      StyleNo, FontStyle, RVAllFontInfoProperties);

    if StyleNo<0 then

    begin

      Sender.Style.TextStyles.Add;

      StyleNo := Sender.Style.TextStyles.Count-1;

      Sender.Style.TextStyles[StyleNo].Assign(FontStyle);

      Sender.Style.TextStyles[StyleNo].Standard := False;

    end;

    FontStyle.Free;

  end;

end;

The same example using  RichViewActions:

procedure TMyForm.MyRichViewReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,

  ItemTag: Integer; var ItemName: String);

begin

  ItemTag := Integer(StrNew(PChar(Target)));

  if DocFormat=rvddURL then

    StyleNo := rvActionInsertHyperlink1.GetHyperlinkStyleNo(Sender as TRichViewEdit);

end;

See also events:

•	OnWriteHyperlink.

See also properties of RVRTFReadProperties:

•	BasePathLinks.


TRichView.OnRVDblClick
 TRichView Reference | TRichView

TCustomRichView.OnRVDblClick

Occurs when user double-clicks the primary mouse button when the mouse pointer is above the item in RichView (or on single left-click, if rvsSingleClick is in Options)

type

  TRVDblClickEvent =

    procedure(Sender: TCustomRichView; ClickedWord: TRVRawByteString;

      Style: Integer) of object;

property OnRVDblClick:TRVDblClickEvent;

Parameters

Style – style (type) of the clicked item.

If Style<0 then the clicked item is not a text item, and Style is a type of this item (see Item Types). In this case ClickedWord contains a name of this item, ANSI string.

If Style>=0, then this is a text item, and Style is an index in the collection of text styles (RichView.Style.TextStyles). In this case ClickedWord is a word below the mouse pointer. "Word" is defined as a part of string between delimiters. Delimiters are listed in Delimiters property. For Unicode text items, ClickedWord contains "raw Unicode". For non-Unicode text items, ClickedWord contains ANSI string.

This event is not generated when the user clicks not on item (on background)

See also events:

•	OnRVRightClick.

See also properties:

•	Delimiters.


TRichView.OnRVFControlNeeded
 TRichView Reference | TRichView

TCustomRichView.OnRVFControlNeeded

Occurs when reading inserted control from RVF file or stream, and this control was saved without its "body".

type

  TRVFControlNeededEvent =

    procedure(Sender: TCustomRichView; Name: String;

      Tag: Integer; var ctrl: TControl) of object;

property OnRVFControlNeeded: TRVFControlNeededEvent;

By default, values of all published properties of controls are saved in RVF documents.

If you exclude rvfoSaveControlsBody from RichView.RVFOptions, none of control properties are saved. Only the item name (value returned by GetItemText) and tag (value returned by GetItemTag) are saved. These values allow to identify the control on loading. When reading such RVF files, OnRVFControlNeeded is called for each control.

Input parameters:

Name – name of the control's item (this is a value returned by GetItemText (converted to Unicode for Delphi/C++Builder 2009 or newer); do not confuse with Name property of controls, see Item types).

Tag – tag of the control's item (this is a value returned by GetItemTag; do not confuse with Tag property of controls, see "Tags").

Output parameter:

ctrl – control to insert in document. Create this control in this event. Do not destroy it (RichView will destroy it when necessary).

See also:

•	RVF overview, contains example.


TRichView.OnRVFImageListNeeded
 TRichView Reference | TRichView

TCustomRichView.OnRVFImageListNeeded

Occurs when reading bullet, hotspot or list level with imagelist picture from RVF.

type

  TRVFImageListNeededEvent =

    procedure(Sender: TCustomRichView;

      ImageListTag: Integer;

      var il: TCustomImageList) of object;

property OnRVFImageListNeeded: TRVFImageListNeededEvent;

If you do not process this event, RichView is not able to read bullets, hotspots and list level with imagelist from RVF file or stream.

When saving these items, RichView saves Tag of the corresponding ImageList (do not confuse with RichView items' tags, this is TCustomImageList.Tag property). This value is passed as ImageListTag parameter of this event on reading.

Assign your ImageList to il parameter (note: RichView does not own ImageLists, it will not destroy it).

This event is generated for each bullet, hotspot and list levels with imagelist in RVF, so it is not recommended to perform time consuming calculations in this event.

See also:

•	RVF overview, contains example.


TRichView.OnRVFPictureNeeded
 TRichView Reference | TRichView

TCustomRichView.OnRVFPictureNeeded

Occurs when reading picture or hot-picture from RVF file or stream, and this picture was saved without its "body"

type

  TRVFPictureNeededEvent = procedure(Sender: TCustomRichView; Name: String;

    Tag: Integer; var gr: TGraphic) of object;

property OnRVFPictureNeeded: TRVFPictureNeededEvent;

By default, images are stored inside RVF documents.

If you exclude rvfoSavePicturesBody from RichView.RVFOptions, images are not saved. Only item name (value returned by GetItemText) and tag (value returned by GetItemTag) are saved. These values allow to identify the image on loading. When reading such RVF files, OnRVFPictureNeeded is called for each image.

Input parameters:

Name – name of the image's item (this is a value returned by GetItemText) (converted to Unicode for Delphi/C++Builder 2009 or newer).

Tag – tag of the image's item (this is a value returned by GetItemTag).

Output parameter:

gr – image (for example, of TBitmap type) to insert in the document. Create it in this event. Do not destroy it (RichView will destroy it when necessary)

If image was not returned in OnRVFPictureNeeded event, this event is called the second time with the value of rvespImageFileName property in the Name parameter (if value of this property was stored for this item).

See also:

•	RVF overview, contains example.


TRichView.OnRVMouseDown
 TRichView Reference | TRichView

TCustomRichView.OnRVMouseDown

Occurs when the user presses a mouse button with the mouse pointer over the control.

type

  TRVMouseEvent =

    procedure(Sender: TCustomRichView; Button: TMouseButton;

    Shift: TShiftState; ItemNo, X, Y: Integer) of object;

property OnRVMouseUp: TRVMouseEvent;

Similar to OnMouseDown, but you also have information about index of item under the mouse pointer.

ItemNo is an index of this item, or -1 if there is no item at the position of the mouse pointer.

The OnRVMouseDown event handler can respond to left, right, or center mouse button presses and shift key plus mouse-button combinations. Shift keys are the  Shift ,  Ctrl , and  Alt  keys. X and Y are the pixel coordinates of the mouse pointer in the client area of the Sender.

When clicking on table, this event returns ItemNo of this table in the root document, even if user clicked on item inside this table.

Use the following procedure if you want to know the exact clicked item:

procedure TForm1.MyRichViewRVMouseDown(Sender: TCustomRichView;

  Button: TMouseButton; Shift: TShiftState;

  ItemNo, X, Y: Integer);

var LRVData: TCustomRVFormattedData;

    LItemNo, LOffs: Integer;

    pt: TPoint;

begin

  pt := MyRichView.ClientToDocument(Point(X,Y));

  if not MyRichView.GetItemAt(pt.X, pt.Y, LRVData, LItemNo, LOffs, True) then

    exit;

  // item is the LItemNo-th item in LRVData

  // example of using: LRVData.GetItemStyle (LItemNo)

  ..

end;

Note: if you want to create code responding on clicking on item, it's recommended to use OnRVMouseUp instead of OnRVMouseDown.

See also events:

•	OnRVMouseUp.


TRichView.OnRVMouseMove
 TRichView Reference | TRichView

TCustomRichView.OnRVMouseMove

Occurs when mouse pointer is moved to the area of hypertext link.

type

  TRVMouseMoveEvent = procedure(Sender: TObject; id: Integer) of object

property OnRVMouseMove: TRVMouseMoveEvent

id is an identifier of hypertext link (the first link in the document has id=FirstJumpNo, the next link has id=FirstJumpNo+1, and so on).

In editor, this numeration is available only when the editor works in hypertext mode:

•	while user holds  Ctrl  key (see EditorOptions) until he/she releases it, or the document is modified, or the editor loses focus;

•	if ReadOnly=True.

So, when using this event in editor, perform all actions that use this id before any action changing document or moving focus out of editor.

If id=-1, the mouse pointer is not above hyperlink.

This event is never called two times in succession for the same hypertext link.

See also events:

•	OnJump.

See also:

•	RichView hypertext overview, contains example.


TRichView.OnRVMouseUp
 TRichView Reference | TRichView

TCustomRichView.OnRVMouseUp

Occurs when the user releases a mouse button that was pressed with the mouse pointer over the component.

type

  TRVMouseEvent = Procedure(Sender: TCustomRichView;

    Button: TMouseButton; Shift: TShiftState;

    ItemNo, X, Y: Integer) of object;

property OnRVMouseUp: TRVMouseEvent;

Similar to OnMouseUp, but you also have information about index of item under the mouse pointer.

ItemNo is an index of this item, or -1 if there is no item at the position of the mouse pointer.

The OnRVMouseUp event handler can respond to left, right, or center mouse button presses and shift key plus mouse-button combinations. Shift keys are the  Shift ,  Ctrl , and  Alt  keys. X and Y are the pixel coordinates of the mouse pointer in the client area of the Sender.

When clicking on table, this event returns ItemNo of this table in the root document, even if user clicked on item inside this table.

Use the following procedure if you want to know the exact clicked item:

procedure TForm1.MyRichViewMouseUp(Sender: TCustomRichView;

  Button: TMouseButton; Shift: TShiftState;

  ItemNo, X, Y: Integer);

var LRVData: TCustomRVFormattedData;

    LItemNo, LOffs: Integer;

    pt: TPoint;

begin

  pt := MyRichView.ClientToDocument(Point(X,Y));

  if not MyRichView.GetItemAt(pt.X, pt.Y, LRVData, LItemNo, LOffs, True) then

    exit;

  // item is the LItemNo-th item in LRVData

  // example of using: LRVData.GetItemStyle (LItemNo)

  ..

end;

See also events:

•	OnRVMouseDown;

•	OnRVRightClick.


TRichView.OnRVRightClick
 TRichView Reference | TRichView

TCustomRichView.OnRVRightClick

Occurs when the user releases the right mouse button over the RichView component.

type

  TRVRightClickEvent = procedure(Sender: TCustomRichView;

    ClickedWord: TRVRawByteString; Style, X, Y: Integer) of object;

property OnRVRightClick:TRVRightClickEvent;

This event is almost obsolete. There are more convenient events:

•	OnRVMouseDown,

•	OnRVMouseUp.

OnRVRightClick event occurs if user releases right mouse button over some item of RichView.

If Style<0 then this item is not a text item, and Style is a type of this item (such as rvsPicture, rvsBreak, rvsHotspot or rvsBullet). In this case ClickedWord contains name of this item (see Item types), ANSI string.

If Style>=0, this is a text item, and Style is an index in the collection of text styles (RichView.Style.TextStyles). In this case ClickedWord is a word which user has clicked. "Word" is defined as a part of string between delimiters. Delimiters are listed in Delimiters property. For Unicode text items, ClickedWord contains "raw Unicode". For non-Unicode text items, ClickedWord contains ANSI string.

X,Y are screen coordinates of mouse pointer (more convenient for displaying popup menu than client coordinates)

This event has the following limitations (which do not exist in OnRVMouseDown, OnRVMouseUp):

•	you can not get further information about the clicked item (you do not know index of this item);

•	this event is not generated when user clicks not on item (on background).

See also events:

•	OnRVDblClick.

See also properties:

•	Delimiters.


TRichView.OnSaveComponentToFile
 TRichView Reference | TRichView

TCustomRichView.OnSaveComponentToFile

Occurs when RichView wants to save inserted control in text, RTF or HTML file.

type

  TRVSaveComponentToFileEvent = procedure(

    Sender: TCustomRichView; Path: String;

    SaveMe: TPersistent; SaveFormat: TRVSaveFormat;

    var OutStr:String) of object;

property OnSaveComponentToFile: TRVSaveComponentToFileEvent;

By default, inserted controls are not saved in HTML, RTF and text files. But you can use this event to save them.

Input parameters:

SaveMe – component to save.

SaveFormat identifies file format, one of rvsfText, rvsfHTML, rvsfRTF.

Path – path where the file is saved. May be used, for example, for saving images (see SavePicture method).

Output parameter:

OutStr – text to insert in the output file. This is a Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for the older versions of Delphi/C++Builder.

Example:

procedure TMyForm.MyRichViewSaveComponentToFile(

  Sender: TCustomRichView; Path: String;

  SaveMe: TPersistent; SaveFormat: TRVSaveFormat;

  var OutStr: String);

var bmp: TBitmap;

  ImageFileName: String;

begin

 case SaveFormat of

   rvsfText:

     begin

       if SaveMe is TButton then

         OutStr := '['+TButton(SaveMe).Caption+']';

       else if SaveMe is TImage then

         OutStr := '<Image of '+TImage(SaveMe).Hint+'>';

      end;

   rvsfHTML:

     begin

       if SaveMe is TButton then

         OutStr := '<FORM><INPUT type="button"' +

                   'value="' + TButton(SaveMe).Caption +

                   '" onClick="alert(''Test'')"></FORM>';

       else if SaveMe is TImage then begin

         bmp         := TBitmap.Create;

         bmp.Height  := TImage(SaveMe).Height;

         bmp.Width   := TImage(SaveMe).Width;

         bmp.Canvas.Draw(0,0, TImage(SaveMe).Picture.Bitmap);

         ImageFileName := MyRichView.SavePicture(SaveFormat,Path,bmp);

         OutStr      := '<IMG src="'+ImageFileName+'" alt='+

                          TImage(SaveMe).Hint+'>';

         bmp.Free;

       end;

     end;

    rvsfRTF:

      begin

        OutStr := '\plain\b ('+SaveMe.ClassName+')';

      end;

 end;

end;

This code saves

•	TButton controls in text file as "[Button.Caption]" string;

•	TButton controls in HTML file as form with button;

•	TImage controls in text file as "<Image of Image.Hint>" string;

•	TImage controls in HTML file as image (using SavePicture) with alternative text "Image.Hint";

•	All controls in RTF as "(Class of control)".

See also:

•	OnSaveItemToFile;

•	Saving and loading;

•	Export to HTML.


TRichView.OnSaveHTMLExtra
 TRichView Reference | TRichView

TCustomRichView.OnSaveHTMLExtra

Allows saving additional information in HTML.

type

  TRVHTMLSaveArea = (rv_thms_Head, rv_thms_BodyAttribute,

    rv_thms_Body, rv_thms_End);

  TRVSaveHTMLExtraEvent = procedure (

    Sender: TCustomRichView; Area: TRVHTMLSaveArea;

    CSSVersion: Boolean; var HTMLCode: String) of object;

property OnSaveHTMLExtra: TRVSaveHTMLExtraEvent;

This event occurs when saving HTML by methods SaveHTML (with CSSVersion parameter = False) and SaveHTMLEx (with CSSVersion=True).

Text assigned to HTMLCode parameter will be saved in HTML. This is a Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for the older versions of Delphi/C++Builder.

Area can be:

Area	HTMLCode is inserted...
rv_thms_Head	between <head> and </head>
rv_thms_BodyAttribute	between <body and >
rv_thms_Body	just after <body>
rv_thms_End	just before </body>
Example

procedure TMyForm.MyRichViewSaveHTMLExtra(

  Sender: TCustomRichView; Area: TRVHTMLSaveArea;

  CSSVersion: Boolean; var HTMLCode: String);

begin

  case Area of

  rv_thms_Head:

    HTMLCode := '<script></script>';

  rv_thms_BodyAttribute:

    HTMLCode := 'alink=#ff0000';

  rv_thms_Body:

    HTMLCode := 'This document is generated by '+

    '<A href="http://www.trichview.com">RichView</A><BR>';

  end;

end;

Note: TRVHTMLSaveArea is defined in RVStyle.pas.

See also events:

•	OnHTMLSaveImage;

•	OnSaveImage2;

•	OnSaveParaToHTML;

•	OnSaveRTFExtra.

See also:

•	Export to HTML.


TRichView.OnSaveImage2
 TRichView Reference | TRichView

TCustomRichView.OnSaveImage2

Occurs when TRichView saves image to HTML file or stream.

type

  TRVSaveImageEvent2 = procedure (Sender: TCustomRichView;

    Graphic: TGraphic; SaveFormat: TRVSaveFormat;

    const Path, ImagePrefix: String;

    var ImageSaveNo: Integer; var Location: String;

    var DoDefault: Boolean) of object;

property OnSaveImage2: TRVSaveImageEvent2;

(introduced in version 1.8)

This event is alternative to OnHTMLSaveImage. It is more easy to use, because the image is available in the Graphic parameter (in OnHTMLSaveImage, you need to extract image from the item or RVData yourself). Besides, this event has ImagePrefix and ImageSaveNo parameters, so you do not need to store them in global variables.

OnSaveImage2 is not called if:

•	rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx and value of rvespImageFileName item property is not empty;

•	DoDefault parameter of OnHTMLSaveImage was set to False for this image.

Input parameters:

Graphic – image to save.

SaveFormat is equal to rvsfHTML.

Path – destination directory of HTML file (or Path parameter of SaveHTMLToStream/SaveHTMLToStreamEx)

ImagePrefix – recommended beginning of image file name (this is ImagesPrefix parameter of SaveHTMLToStream/SaveHTMLToStreamEx)

ImageSaveNo – value that you can use to create unique file names (see GetNextFileName method in the description of OnHTMLSaveImage).

Output parameters:

Location – set this parameter to file name of image where you saved it. This string will be inserted in HTML file.

DoDefault – set to False if you saved this image yourself. Otherwise, the default image saving procedure will be called.

Note: when saving images from image-lists (bullets, hotspots, list markers with images), TRichView creates a temporal TBitmap and passes it to this event.

See also events:

•	OnHTMLSaveImage;

•	OnSaveItemToFile.

See also:

•	Export to HTML.


TRichView.OnSaveItemToFile
 TRichView Reference | TRichView

TCustomRichView.OnSaveItemToFile

Allows you to change how document items are saved in text, RTF or HTML file or stream.

type

  TRVSaveItemToFileEvent = procedure (Sender: TCustomRichView;

    const Path: String; RVData: TCustomRVData; ItemNo: Integer;

    SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr:TRVRawByteString;

    var DoDefault: Boolean) of object;

(introduced  in v1.8)

This is a "low level" event allowing to change saving of items completely.

There are events offering a subset of functionality of this event:

•	OnHTMLSaveImage,

•	OnSaveImage2,

•	OnSaveComponentToFile.

These events are easier to use than this event.

Input parameters:

Path – path to output file;

RVData, ItemNo – item to save. RVData – document containing item that is being saved; it can be Sender.RVData, table cell, or RVData of cell inplace-editor. ItemNo – index of this item inside RVData.

SaveFormat identifies file format, one of rvsfText, rvsfHTML, rvsfRTF.

Unicode – True when saving Unicode text files or UTF-8 HTML files.

OutStr:

•	for non-text items: empty string;

•	for text items: text that needs to be saved (it can be a part of the item's text when saving selected fragment). For Unicode text items, this is a "raw Unicode" string..

DoDefault – True.

Output parameters:

Set values of DoDefault and OutStr according to the table below. Mismatched values will cause corrupted files.

Unicode parameter	Output value of DoDefault	For ANSI text items	For Unicode text items	For non-text items
Any	True	For text files: default saving, value of OutStr is ignored. For HTML and RTF: value of OutStr must be set to ANSI string. This string will be processed afterwards (for example, '<' will be  changed to '&lt;' for HTML).	For text files: default saving, value of OutStr is ignored. For HTML and RTF: value of OutStr must be set to "raw Unicode" string. This string will be processed afterwards (for example, '<' will be  changed to '&lt;' for HTML).	Default saving, value of OutStr is ignored.
False	False	OutStr must be set to ANSI string, this string will be inserted in the file as it is (no control codes will be replaced).
True	False	OutStr must be set to "raw Unicode" string, this string will be inserted in the file without further processing (no control codes will be replaced).
If you do not want to change saving of some item, leave DoDefault to True.

You cannot override some special processing for paragraph markers when saving to HTML and RTF.

Example 1: saving text items in UTF-8 encoding in HTML and text files.

In this example, we change default saving only if Unicode parameter is False (it is equal to False when saving ANSI text or HTML files).

uses RVUni, CRVData;

procedure TMyForm.MyRichViewSaveItemToFile(

  Sender: TCustomRichView; const Path: String;

  RVData: TCustomRVData; ItemNo: Integer;

  SaveFormat: TRVSaveFormat; Unicode: Boolean;

  var OutStr: TRVRawByteString; var DoDefault: Boolean);

begin

  if (SaveFormat in [rvsfText, rvsfHTML]) and

     (RVData.GetItemStyle(ItemNo)>=0) and

     not Unicode then

  begin

    if Sender.Style.TextStyles[RVData.GetItemStyle(ItemNo)].Unicode then

      OutStr := UTF8Encode(RVU_RawUnicodeToWideString(OutStr))

    else

      OutStr := AnsiToUtf8(OutStr);

    DoDefault := False;

  end;

end;

Note 1: For HTML files, there is an option for saving as UTF-8, so this code is given only as an example. This example is imperfect, because:

•	this code does not include replacement of <, >, &,  multiple spaces when saving to HTML; we cannot set DoDefault to True for HTML if the source item is Unicode, because the default RichView procedure expects "raw Unicode" in this case, but we output UTF-8;

•	non-text items are not converted to UTF-8 (so the file will be corrupted if their text representation contains non-English characters);

•	HTML encoding is not changed to UTF-8 (so the HTML will be correct only if no encoding is saved at all; it happens in RVStyle.TextStyles[0].Charset=DEFAULT_CHARSET).

Note 2: One more simplification: AnsiToUtf8 uses a system default code page for converting ANSI to Unicode (for better results, languages (Charsets) of text items must be  taken into account for the conversion).

Example 2: saving pictures as '<PIC>' (in text files, HTML and RTF)

procedure TMyForm.MyRichViewSaveItemToFile(

  Sender: TCustomRichView; const Path: String;

  RVData: TCustomRVData; ItemNo: Integer;

  SaveFormat: TRVSaveFormat; Unicode: Boolean;

  var OutStr: TRVRawByteString; var DoDefault: Boolean);

begin

  if (RVData.GetItemStyle(ItemNo)=rvsPicture) then

  begin

    if SaveFormat=rvsfHTML then

      OutStr := '&lt;PIC&gt;'

    else

      OutStr := '<PIC>';

    if Unicode then

      OutStr := RVU_GetRawUnicode(OutStr);

    DoDefault := False;

  end;

end;

Note: for non-text items, OutStr is saved as it is; so we need to replace '<' with '&lt;' and '>' with '&gt;' for HTML.


TRichView.OnSaveParaToHTML
 TRichView Reference | TRichView

TCustomRichView.OnSaveParaToHTML

Allows to add your HTML code when saving paragraphs to HTML.

property OnSaveParaToHTML: TRVSaveParaToHTMLEvent

TRVSaveParaToHTMLEvent =

  procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer;

    ParaStart, CSSVersion: Boolean;

    var HTMLCode: String) of object;

(introduced in v1.8)

Input parameters:

ParaStart:

•	True, if the returned text will be inserted in the beginning of paragraph (before <p>, <div> or <li>),

•	False, if it will be inserted in the end (after </p>, </div> or </li>).

RVData, ItemNo define the location. if ParaStart=True, ItemNo is an index of the first paragraph item (in RVData). If False, it is an index of the first item of the next paragraph (or RVData.ItemCount for the last paragraph).

RVData can be Sender.RVData, or table cell, or cell inplace editor's RVData.

Output parameters:

HTMLCode – output string. This is a Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for the older versions of Delphi/C++Builder.

Example: each paragraph in its own table

procedure TMyForm.MyRichViewSaveParaToHTML(Sender: TCustomRichView;

  RVData: TCustomRVData; ItemNo: Integer; ParaStart,

  CSSVersion: Boolean; var HTMLCode: String);

begin

  if ParaStart then

    HTMLCode := '<table border=1 width=100%><tr><td>'

  else

    HTMLCode := '</td></tr></table>'

end;

This event is public, so you need to assign its handler in code at run time.

See also:

•	OnSaveHTMLExtra;

•	Export to HTML.


TRichView.OnSaveRTFExtra
 TRichView Reference | TRichView

TCustomRichView.OnSaveRTFExtra

Allows saving additional information in RTF

type

  TRVRTFSaveArea = (rv_rtfs_TextStyle, rv_rtfs_ParaStyle,

    rv_rtfs_ListStyle, rv_rtfs_CellProps, rv_rtfs_RowProps,

    rv_rtfs_Doc);

 TRVSaveRTFExtraEvent = procedure (Sender: TCustomRichView;

   Area: TRVRTFSaveArea; Obj: TObject;

   Index1, Index2: Integer;

   InStyleSheet: Boolean; var RTFCode: TRVAnsiString) of object;

property OnSaveRTFExtra: TRVSaveRTFExtraEvent;

This event occurs when saving RTF (SaveRTF, SaveRTFToStream).

Text assigned to RTFCode parameter will be saved in RTF.

Area defines place where RTFCode will be inserted. Meaning of Index1, Index2 and Obj depend on Area.

Area	Meaning
rv_rtfs_TextStyle	Occurs when saving text style. Index1 is an index of the text style in TextStyles collection, Obj is a text style object
rv_rtfs_ParaStyle	Occurs when saving paragraph style. Index1 is an index of the paragraph style in ParaStyles collection, Obj is a paragraph style object
rv_rtfs_ListStyle	Occurs when saving list style and list levels. Index1 is an index of the list style in ListStyles. Index2 equals to -1 when saving the list description, or  it equals to the level index when saving list level. Obj is a list style object
rv_rtfs_CellProps	Occurs when saving table cell properties. Index1 = row index, Index2 =column index, Obj is the table.
rv_rtfs_RowProps	Occurs when saving table row properties. Index1 = row index, Obj is the table.
rv_rtfs_Doc	Allows saving additional information at the beginning of the document
Example

procedure TMyForm.MyRichViewSaveRTFExtra(

  Sender: TCustomRichView; Area: TRVRTFSaveArea;

  Obj: TObject; Index1, Index2: Integer;

  InStyleSheet: Boolean; var RTFCode: TRVAnsiString);

begin

  if Area=rv_rtfs_Doc then

    RTFCode := '\paperw11906\paperh16838\margl567\'+

      'margr567\margt567\margb567';

end;

This example saves paper size = A4, and margins = 1 cm.

See also properties:

•	DocParameters.

See also events:

•	OnSaveHTMLExtra.

See also examples:

•	http://www.trichview.com/forums/viewtopic.php?t=64.


TRichView.OnSelect
 TRichView Reference | TRichView

TCustomRichView.OnSelect

Occurs when selection in the document was changed (not contents, but bounds)

property OnSelect:TNotifyEvent;

Changes in selection can occur when the user changes the selection using the mouse or keyboard, or when the selection is changed with the methods:

•	SelectAll;

•	Deselect;

•	SetSelectionBounds;

•	(and sometimes SelectionExists).

See also:

•	Selection in RichView.


TRichView.OnSpellingCheck
 TRichView Reference | TRichView

TCustomRichView.OnSpellingCheck

Allows to mark misspelled words.

type

  TRVSpellingCheckEvent = procedure (Sender: TCustomRichView;

    const AWord: String; StyleNo: Integer;

    var Misspelled: Boolean) of object;

property OnSpellingCheck: TRVSpellingCheckEvent;

(introduced in v1.9)

This event is called for each word in the document.

Input parameters:

AWord is a word to check (Unicode for Delphi/C++Builder 2009 or newer, ANSI for older versions of Delphi/C++Builder).

StyleNo is a style of text item containing this word (index in the collection Sender.Style.TextStyles).

Output parameter:

Misspelled, must be set to True if this word is misspelled.

Example (using Addict3 spelling checker):

procedure TMyForm.MyRichViewEditSpellingCheck(Sender: TCustomRichView;

  const AWord: String; StyleNo: Integer; var Misspelled: Boolean);

begin

  Misspelled := not MyRVAddictSpell3.WordAcceptable(AWord);

end;

This event is called in thread context.

See also:

•	Live spelling check in RichView.


TRichView.OnURLNeeded
 TRichView Reference | TRichView

TCustomRichView.OnURLNeeded

Occurs when RichView wants to save hyperlink to HTML or RTF file.

type

  TRVURLNeededEvent =

    procedure(Sender: TCustomRichView; id: Integer;

    var url:String) of object;

property OnURLNeeded:TRVURLNeededEvent

This is an obsolete event.

Use OnWriteHyperlink


TRichView.OnWriteHyperlink
 TRichView Reference | TRichView

TCustomRichView.OnWriteHyperlink

Occurs when RichView wants to save hypertext link to HTML or RTF file

type

  TRVWriteHyperlink = procedure (Sender: TCustomRichView;

     id: Integer; RVData: TCustomRVData; ItemNo: Integer;

     SaveFormat: TRVSaveFormat;

     var Target, Extras: String) of object;

property OnWriteHyperlink: TRVWriteHyperlink;

(introduced in v1.8)

By default, hypertext links (associated with hypertext text styles, hotspots and hot-pictures) are not saved in HTML and RTF.

But you can use this event to save them (or some of them).

In order to do it, you need to assign Target parameter to the target URL.

Input parameters:

id – identifier of the hypertext link; this event can be called for unformatted documents; in this case, id=-1.

RVData – document containing hyperlink (Sender.RVData, or table cell, or cell inplace editor's RVData)

ItemNo – index of hyperlink-item inside RVData.

SaveFormat can be rvsfHTML or rvsfRTF.

Output parameters:

Target – hyperlink target to save in file or stream

Extras – optional additional information for saving with the link.

When saving RTF files, if Target is started from '#', TRichView removes '#' from the target and add '\l' in Extras. Thus, such links are saved as links to bookmarks (checkpoints are saved as bookmarks)

Example 1:

The most typical using: URLs are saved in tags, and rvoTagsArePChars is in Options

In addition to saving the link target, this example saves the hint "Click here!" (both for RTF and HTML) and the attribute "target=_blank" for HTML.

procedure TMyForm.MyRichViewWriteHyperlink(

  Sender: TCustomRichView; id: Integer;

  RVData: TCustomRVData; ItemNo: Integer;

  SaveFormat: TRVSaveFormat;

  var Target, Extras: String);

begin

  Target := PChar(RVData.GetItemTag(ItemNo));

  case SaveFormat of

    rvsfHTML:

      Extras := 'target=_blank title="Click here!"';

    rvsfRTF:

      Extras := '\o "Click here!"';

  end;

end;

Saving hint is given here only as an example. TRichView saves hints stored in the rvespHint item's extra string property automatically.

Example 2:

procedure TMyForm.MyRichViewWriteHyperlink(

  Sender: TCustomRichView; id: Integer;

  RVData: TCustomRVData; ItemNo: Integer;

  SaveFormat: TRVSaveFormat;

  var Target, Extras: String);

begin

  case id-FirstJumpNo of

    0: Target := 'http://www.borland.com';

    1: Target := 'http://www.inprise.com';

  end;

end;

See also events:

•	OnReadHyperlink.

See also methods:

•	SaveHTML;

•	SaveHTMLEx;

•	SaveRTF;

•	(and methods saving RTF and HTML to streams).

See also:

•	Hypertext;

•	Saving to HTML.


TRVRTFReaderProperties
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties

Properties    Methods

This is a type of TRichView.RTFReadProperties. It contains properties for controlling RTF import in TRichView and TRichViewEdit. Do not create objects of this class yourself, use this property instead.

Unit RVRTFProps.

Syntax

TRVRTFReaderProperties = class (TPersistent)

Properties

The most important properties are:

•	ParaStyleMode;

•	TextStyleMode;

•	UnicodeMode.

The following properties allow to ignore some part of RTF content:

•	IgnoreBookmarks;

•	IgnoreNotes;

•	IgnorePictures;

•	IgnoreSequences;

•	IgnoreTables;

•	SkipHiddenText;

•	ReadDocParameters.

Reading Hyperlinks

Hyperlinks are not loaded unless you provide TCustomRichView.OnReadHyperlink.

Reading RTF Images

The following types of RTF pictures are supported (if IgnorePictures = False):

•	bitmaps (DIB and DDB), loaded as TBitmap;

•	metafiles (WMF and EMF), loaded as TMetafile; if metafile contains only a bitmap, it can be loaded as TBitmap, see ExtractMetafileBitmaps;

•	Jpegs, loaded as TJPEGImage;

•	PNG, if PNG class is specified;

•	external images, loaded from files (TCustomRichView.OnImportPicture event occurs).


TRVRTFReaderProperties.AutoHideTableGridLines
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.AutoHideTableGridLines

Hides grid lines (dotted lines in place of hidden borders) for tables imported from RTF.

property AutoHideTableGridLines: Boolean;

(introduced in version 1.6)

If this property is set to True, RichView includes rvtoHideGridLines in Options of tables read from RTF.

Note: it's not necessary to set this option for individual tables. You can hide and show grid for all tables in all TRichView controls using global variables.

Default value:

False


TRVRTFReaderProperties.BasePathLinks
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.BasePathLinks

Specifies whether to add base path (path to RTF file) to hyperlink targets.

property BasePathLinks: Boolean;

(introduced in version 10)

Set to False if you do not want to add the document path to relative  hyperlinks on RTF loading.

For example, when loading "c:\Docs\MyFile.rtf' containing link to "MyFile2.rtf":

•	if this property is False, TCustomRichView.OnReadHyperlink event occurs with Target='MyFile2.rtf';

•	if this property is True, this event occurs with Target='c:\Docs\MyFile2.rtf'.

In RVHTMLImporter, this property corresponds to rvhtmloBasePathLinks in RVHTMLImporter.Options.

Default value:

True


TRVRTFReaderProperties.CharsetForUnicode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.CharsetForUnicode

Specifies a character set for Unicode text read from RTF.

property CharsetForUnicode: TFontCharset;

(introduced in version 11)

This property is used if UseCharsetForUnicode=True and TextStyleMode<>rvrsUseSpecified.

This character set is applied to Unicode text (see UnicodeMode) read from RTF.

Using a single specified character set for all text may be useful if you want to avoid words consisting of several text items (having the same font but different character sets) in UnicodeMode=rvruOnlyUnicode.

Default value:

DEFAULT_CHARSET


TRVRTFReaderProperties.ConvertHighlight
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ConvertHighlight

Specifies the mode of import of text highlighting.

type

  TRVRTFHighlight = // defined in RVScroll.pas

    (rtfhlIgnore, rtfhlFixedColors, rtfhlColorTable);

property ConvertHighlight: TRVRTFHighlight;

(introduced in version 1.7)

RTF editors show text highlighting as a text background color. But this is not a real text background color (which is always imported by RichView), this is not even a RTF text attribute.

 – this is a MS Word toolbar button applying text highlighting.

Mode	Meaning
rtfhlIgnore	Highlighting is ignored.
rtfhlFixedColors	Highlighting is converted to text background using a fixed set of colors (according to the old RTF specification)
rtfhlColorTable	Highlighting is converted to text background using RTF color table.
MS Word (and TRichView) always puts 16 default colors to the beginning of RTF color table, so for such documents, both rtfhlFixedColors and rtfhlColorTable work absolutely identically. TRichView itself never saves text background color as a highlight, it uses the special RTF keyword for text background.

It's not recommended to change value of this property.

Default value:

rtfhlColorTable


TRVRTFReaderProperties.ErrorCode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ErrorCode (read only)

Contains error code for the last RTF reading operation.

ErrorCode: TRVRTFErrorCode;

type // defined in RVRTFErr unit.

  TRVRTFErrorCode = (

    rtf_ec_OK,             // No error

    rtf_ec_StackUnderflow, // Unmatched '}'

    rtf_ec_StackOverflow,  // Too many '{' -- memory exhausted

    rtf_ec_UnmatchedBrace, // RTF ended during an open group.

    rtf_ec_InvalidHex,     // Invalid hex character found in data

    rtf_ec_BadTable,       // RTF table invalid (internal parser error)

    rtf_ec_Assertion,      // Assertion failure (internal parser error)

    rtf_ec_EndOfFile,      // End of file reached while reading RTF

    rtf_ec_FileOpenError,  // Parser cannot open input file

    rtf_ec_Exception,      // Exception (internal parser error)

    rtf_ec_InvalidPicture, // Invalid picture in RTF

    rtf_ec_Aborted         // (internal parser error)

    );


TRVRTFReaderProperties.ExtractMetafileBitmaps
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ExtractMetafileBitmaps

Option for reading metafiles from RTF

property ExtractMetafileBitmaps: Boolean;

(introduced in version 1.9)

MS Word usually does not save bitmaps in RTF as they are, it wraps them in metafiles.

If this property is set to False, such bitmaps will be loaded as TMetafile. TMetafile sometimes scales bitmap images inaccurately.

If this property is set to True, TRichView attempts to extract bitmaps embedded in metafiles and to use them instead of metafiles. If successful, they are inserted as TBitmap.

This option does not affect RTF metafiles containing something besides bitmaps, no bitmaps, or multiple bitmaps – they will be loaded as TMetafile.

Default value:

True


TRVRTFReaderProperties.FooterYMM
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.FooterYMM (read only)

Vertical footer position read from RTF, mm (distance from the bottom of page to the bottom of page footer)

property FooterYMM: Integer;

(introduced in version 1.7)

This property is valid only after RTF reading. If it is negative, ignore it (RTF does not contain footer)

You can assign this property to TRVPrint.FooterYMM.

See also:

•	HeaderYMM.

See also methods:

•	SetFooter.


TRVRTFReaderProperties.HeaderYMM
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.HeaderYMM (read only)

Vertical header position read from RTF, mm (distance from the top of page to the top of page header)

property HeaderYMM: Integer;

(introduced in version 1.7)

This property is valid only after RTF reading. If it is negative, ignore it (RTF does not contain header).

You can assign this property to TRVPrint.HeaderYMM.

See also:

•	FooterYMM.

See also methods:

•	SetHeader.


TRVRTFReaderProperties.IgnoreBookmarks
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.IgnoreBookmarks

Disallows loading bookmarks from RTF.

property IgnoreBookmarks: Boolean;

(introduced in version 10)

Bookmarks starts are read as checkpoints. Bookmark ends cannot be read.

Default value:

False


TRVRTFReaderProperties.IgnoreNotes
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.IgnoreNotes

Disallows loading footnotes, endnotes and references to them from RTF.

property IgnoreNotes: Boolean;

(introduced in version 10)

If loading of notes is allowed, their properties are also loaded, specifically Style.FootNotePageReset.

Default value:

False


TRVRTFReaderProperties.IgnorePictures
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.IgnorePictures

Disallows loading pictures from RTF.

property IgnorePictures: Boolean;

Set it to True to import RTF without pictures.

TRichView supports RTF pictures in the following formats:

•	Windows Bitmaps (DIB and DDB), loaded as TBitmap;

•	Metafiles, loaded as TMetafile or as TBitmap (see ExtractMetafileBitmaps property);

•	Enhanced Metafiles, loaded as TMetafile,

•	JPEG (D3+), loaded as TJpegImage,

•	PNG, see RV_RegisterPngGraphic procedure.

Default value:

False


TRVRTFReaderProperties.IgnoreSequences
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.IgnoreSequences

Disallows loading numbering sequences from RTF.

property IgnoreSequences: Boolean;

(introduced in version 10)

If this property is True, RTF numbered sequences are loaded as a plain text.

Default value:

False


TRVRTFReaderProperties.IgnoreTables
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.IgnoreTables

Disallow loading tables from RTF.

property IgnoreTables: Boolean;

(introduced in version 10)

If True, contents of tables are loaded as normal text.

Default value:

False


TRVRTFReaderProperties.LineBreaksAsParagraphs
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.LineBreaksAsParagraphs

If set to True, all line breaks (added with  Shift + Enter ) in RTF will be treated as paragraph starts.

property LineBreaksAsParagraphs: Boolean;

(introduced in version 1.7)

Default value:

False


TRVRTFReaderProperties.ParaStyleMode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ParaStyleMode

Defines mode of reading of paragraph properties from RTF.

property ParaStyleMode: TRVReaderStyleMode;

Mode	Meaning
rvrsUseSpecified	All paragraph formatting in RTF will be ignored, all paragraphs will have style specified in ParaStyleNo property.
rvrsUseClosest	RTF formatting will be mapped to the the most similar existing paragraph style
rvrsAddIfNeeded	This mode provides the most closer look to the original RTF. RichView will try to use existing styles as much as possible, but if style with the desired formatting does not exist, RichView will add a new one to the end of the collection of paragraph styles and use it.
List markers (bullets and numbering) are imported only if ParaStyleMode=rvrsAddIfNeeded.

Default value:

•	rvrsUseClosest for components created at runtime.

•	For components placed on form at designtime, initial value of this property is defined in the component editor for TRichView. By default, the component editor applies "allow adding styles dynamically" mode to new TRichView components, and this property is set to rvrsAddIfNeeded.

See also:

•	ParaStyleNo;

•	TextStyleMode.


TRVRTFReaderProperties.ParaStyleNo
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ParaStyleNo

Default paragraph style for RTF loading.

property ParaStyleNo: Integer

This property is used if ParaStyleMode=rvrsUseSpecified.

It is an index in the collection of paragraph styles.

Default value:

0

See also:

•	ParaStyleMode;

•	TextStyleNo.


TRVRTFReaderProperties.ReadDocParameters
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.ReadDocParameters

Set to True to allow reading DocParameters from RTF.

property ReadDocParameters: Boolean;

(introduced in version 10)

Default value:

False


TRVRTFReaderProperties.SkipHiddenText
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.SkipHiddenText

Controls loading hidden text from RTF

property SkipHiddenText: Boolean;

(introduced in version 1.6)

If True, hidden text is not added to RichView.

If False, hidden text is added (just like any other RTF text).

Default value:

True


TRVRTFReaderProperties.StoreImagesFileNames
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.StoreImagesFileNames

Allows storing file name of external images imported with RTF

property StoreImagesFileNames: Boolean;

(introduced in version 10)

If you set it to True, filenames of external RTF images will be stored in rvespImageFileName item property of read images, and you will be able to use them when storing HTML.

Default value:

False


TRVRTFReaderProperties.TextStyleMode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.TextStyleMode

Defines a mode for extraction of character formatting from RTF

property TextStyleMode: TRVReaderStyleMode;

Mode	Meaning
rvrsUseSpecified	All paragraph formatting in RTF will be ignored, all text will have style specified in TextStyleNo property.
rvrsUseClosest	RTF formatting will be mapped to the the most similar existing text style.
rvrsAddIfNeeded	This mode provides the most closer look to the original RTF. RichView will try to use existing styles as much as possible, but if style with the desired formatting does not exist, RichView will add a new one to the end of the collection of text styles and use it.
Default value:

•	rvrsUseClosest for components created at runtime.

•	For components placed on form at designtime, initial value of this property is defined in the component editor for TRichView. By default, the component editor applies "allow adding styles dynamically" mode to new TRichView components, and this property is set to rvrsAddIfNeeded.

See also:

•	TextStyleNo;

•	ParaStyleMode.


TRVRTFReaderProperties.TextStyleNo
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.TextStyleNo

Default text style for RTF loading.

property TextStyleNo: Integer

This property is used if TextStyleMode=rvrsUseSpecified.

It is an index in the collection of text styles.

Default value:

0

See also:

•	TextStyleMode;

•	ParaStyleNo.


TRVRTFReaderProperties.UnicodeMode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.UnicodeMode

Defines how text is read from RTF.

property UnicodeMode: TRVReaderUnicode;

type

  TRVReaderUnicode =

    (rvruMixed, rvruNoUnicode, rvruOnlyUnicode);

Mode	Meaning
rvruMixed	RichView will use Unicode text styles when necessary,  trying to use ANSI text as much as possible.
rvruNoUnicode	RichView will ignore Unicode in RTF. Usually RTF contains ANSI alternative for Unicode text, and RichView will use it.
rvruOnlyUnicode	All imported text will be in Unicode encoding. For conversion to Unicode, RichView will use code page identifier read from RTF, or, if it was not found there, TRVStyle.DefCodePage property.
Default value:

For Delphi/C++Builder 2009 or newer: rvruOnlyUnicode

For older versions: rvruNoUnicode

See also properties:

•	UseCharsetForUnicode;

•	CharsetForUnicode.

See also:

•	Unicode in RichView.


TRVRTFReaderProperties.UseCharsetForUnicode
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.UseCharsetForUnicode

Specifies whether CharsetForUnicode property is used as a character set for Unicode text read from RTF.

property UseCharsetForUnicode: Boolean;

Default value:

False


TRVRTFReaderProperties.UseHypertextStyles
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.UseCharsetForUnicode

Specifies whether

property UseCharsetForUnicode: Boolean

Set this property to True to allow using existing hypertext text styles for non-hypertext text from RTF (in TextStyleMode = rvrsUseClosest or rvrsAddIfNeeded).

Note: it's not recommended to change value of this property.

Default value:

False

See also:

•	Hypertext in RichView.


TRVRTFReaderProperties.UseSingleCellPadding
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.UseSingleCellPadding

Set it to True if you want to use the same values for CellHPadding and CellVPadding for loaded tables.

property UseSingleCellPadding: Boolean;

(introduced in version 10)

It may be useful if your application is primary oriented to generate HTML files (or if you wish to maintain compatibility with older versions of your software, because applications compiled with older versions of TRichView cannot read RVF files containing tables with different cell padding).

Default value:

False


TRVRTFReaderProperties.SetFooter
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.SetFooter

Specifies the document to read page footer in. Call with nil parameter to remove this link.

procedure SetFooter(RVData: TCustomRVData);

Example:

RichView1.Clear;

RichView2.Clear;

RichView1.RTFReadProperties.SetFooter(RichView2.RVData);

RichView1.LoadRTF('test.rtf');

RichView1.Format; // contains document

RichView2.Format; // contains footer

RVPrint1.AssignSource(RichView1);

if RichView1.RTFReadProperties.FooterYMM>=0 then begin

  RVPrint1.FooterYMM := RichView1.RTFReadProperties.FooterYMM;

  RVPrint1.SetFooter(RichView2.RVData);

  end

else

  RVPrint1.SetFooter(nil);

RVPrint1.FormatPages(rvdoAll);

RVPrint1.Print('Doc with footer', 1, False);

See also:

•	SetHeader.

See also properties:

•	FooterYMM.


TRVRTFReaderProperties.SetHeader
 TRichView Reference | TRichView | TRVRTFReaderProperties

TRVRTFReaderProperties.SetHeader

Specifies the document to read header footer in. Call with nil parameter to remove this link.

procedure SetHeader(RVData: TCustomRVData);

Example:

RichView1.Clear;

RichView2.Clear;

RichView1.RTFReadProperties.SetHeader(RichView2.RVData);

RichView1.LoadRTF('test.rtf');

RichView1.Format; // contains document

RichView2.Format; // contains header

RVPrint1.AssignSource(RichView1);

if RichView1.RTFReadProperties.HeaderYMM>=0 then begin

  RVPrint1.HeaderYMM := RichView1.RTFReadProperties.HeaderYMM;

  RVPrint1.SetHeader(RichView2.RVData);

  end

else

  RVPrint1.SetHeader(nil);

RVPrint1.FormatPages(rvdoAll);

RVPrint1.Print('Doc with header', 1, False);

See also:

•	SetFooter.

See also properties:

•	HeaderYMM.


TRVDocParameters
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters

Properties    Methods

This is a type of TRichView.DocParameters. It contains document's and page properties that can be written to or read from RVF (RichView Format) and RTF (Rich Text Format). The components do not use these properties, but they can be assigned to TRVPrint using the method AssignDocParameters.

Unit RVDocParams.

Syntax

TRVDocParameters = class(TPersistent)

(introduced in version 10)

Properties

This class has the following properties:

•	Units – measurement units for margins, paper size, header and footer positions;

•	PageWidth, PageHeight – page size;

•	Orientation – page orientation;

•	LeftMargin, RightMargin, TopMargin, BottomMargin – margins;

•	MirrorMargins allow to exchange left and right margins on even pages;

•	HeaderY, FooterY – position of header and footer;

•	ZoomMode – zooming mode;

•	ZoomPercent – zooming percent.

Methods

This class has the following methods:

•	Reset resets all properties to default values;

•	ResetLayout resets all sizes to default values measured in Units;

•	UnitsPerInch allows to convert between measurement units;

•	ConvertToUnits converts all sizes to the specified units.


TRVDocParameters.BottomMargin
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.BottomMargin

Bottom margin, measured in Units.

property BottomMargin: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.BottomMarginMM.

Default value:

1.0


TRVDocParameters.FooterY
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.FooterY

Distance from the bottom of page to the bottom of footer, measured in Units.

property FooterY: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.FooterYMM.

Default value:

0.5


TRVDocParameters.HeaderY
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.HeaderY

Distance from the top of page to the top of header, measured in Units.

property HeaderY: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.HeaderYMM.

Default value:

0.5


TRVDocParameters.LeftMargin
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.LeftMargin

Left margin, measured in Units.

property LeftMargin: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.LeftMarginMM.

Default value:

1.25


TRVDocParameters.MirrorMargins
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.MirrorMargins

Instructs to swap left and right margins on even pages.

property MirrorMargins: Boolean;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.MirrorMargins.

Default value:

False


TRVDocParameters.Orientation
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.Orientation

Page orientation.

property Orientation: TPrinterOrientation;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

Default value:

poPortrait


TRVDocParameters.PageHeight
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.PageHeight

Page height, measured in Units.

property PageHeight: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

Default value:

11.692913386 (A4 height in inches)


TRVDocParameters.PageWidth
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.PageWidth

Page width, measured in Units.

property PageWidth: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

Default value:

8.2677165354 (A4 width in inches)


TRVDocParameters.RightMargin
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.RightMargin

Right margin, measured in Units.

property RightMargin: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.RightMarginMM.

Default value:

1.25


TRVDocParameters.TopMargin
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.TopMargin

Top margin, measured in Units.

property TopMargin: Extended;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

TRVPrint.AssignFromDocParameters assigns this property to TRVPrint.TopMarginMM.

Default value:

1.0


TRVDocParameters.Units
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.Units

Measurement units for all sizes in TRVDocParameters.

type

  TRVUnits = (rvuInches, rvuCentimeters, rvuMillimeters, rvuPicas, rvuPixels, rvuPoints);

property Units: TRVUnits;

Note: TRVUnits is defined in RVStyle unit.

Value	Meaning
rvuInches	Inches. 1 inch = 2.54 cm.
rvuCentimeters	Centimeters.
rvuMillimeters	Millimeters.
rvuPicas	Picas (used in typography). 1 pica = 1/6 inch = 12 points.
rvuPixels	Screen pixels (see below).
rvuPoints	Points (used in typography). 1 point = 1/72 inch.
If RichViewPixelsPerInch is positive, it is used for calculation of number of screen pixels in one inch. Otherwise, Screen.PixelsPerInch is used. In the latter case, values in rvuPixels depend on the screen resolution and cannot be used in WYSIWYG editors.

Assignment to this property does not change other properties. Use ConvertToUnits to convert all sizes to new units.

Use UnitsPerInch to convert values between units.


TRVDocParameters.ZoomMode
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.ZoomMode

Scaling mode

type // defined in RVStyle unit

  TRVZoomMode = (rvzmFullPage, rvzmPageWidth, rvzmCustom);

property ZoomMode : TRVZoomMode;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

Default value:

rvzmCustom


TRVDocParameters.ZoomPercent
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.ZoomPercent

View scale, % (if ZoomMode=rvzmCustom).

property ZoomPercent: Integer;

This property is not used by TRichView components, but it can be written and read from RVF (RichView Format) and RTF (Rich Text Format) files.

Default value:

100


TRVDocParameters.ConvertToUnits
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.ConvertToUnits

Converts all sizes to AUnits.

procedure ConvertToUnits(AUnits: TRVUnits);

This method converts all size properties from Units to AUnits, then assigns Units = AUnits.

The following properties are converted:

•	PageWidth, PageHeight – page size;

•	LeftMargin, RightMargin, TopMargin, BottomMargin – margins;

•	HeaderY, FooterY – position of header and footer.


TRVDocParameters.Reset
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.Reset

Resets all properties to default values.

procedure Reset;


TRVDocParameters.ResetLayout
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.ResetLayout

Resets all sizes to default values measured in Units.

procedure ResetLayout;

It makes sense to call this method on "File | New" command.

The following properties are reset:

•	PageWidth, PageHeight – page size;

•	LeftMargin, RightMargin, TopMargin, BottomMargin – margins;

•	HeaderY, FooterY – position of header and footer.

In addition, this method resets Orientation to poPortrait and MirrorMargins to False.


TRVDocParameters.UnitsPerInch
 TRichView Reference | TRichView | TRVDocParameters

TRVDocParameters.UnitsPerInch

Returns the number of Units in one inch.

function UnitsPerInch(Units: TRVUnits): Extended;

This method can be used to convert between measurement units.

For example, this code converts from points to millimeters:

ValueMM := ValuePoints * UnitsPerInch(rvuMillimeters) / UnitsPerInch(rvuPoints);

See the note about rvuPixels in the topic about Units.


Loading UTF-8 files
 TRichView Reference | TRichView

Loading UTF-8 files

This example shows how to load Unicode UTF-8 file:

procedure LoadUTF8(rv: TCustomRichView; const FileName: String;

  StyleNo, ParaNo: Integer);

var Stream: TFileStream;

    s: TRVRawByteString;

    ws: TRVUnicodeString;

begin

  Stream := TFileStream.Create(FileName, fmOpenRead);

  SetLength(s, Stream.Size);

  Stream.ReadBuffer(PRVAnsiChar(s)^, Stream.Size);

  Stream.Free;

  rv.Clear;

  ws := UTF8Decode(s);

  rv.AddTextNLW(ws, StyleNo, ParaNo, ParaNo, False);

end;

Call:

LoadUTF8(RichViewEdit1, 'test.txt', 0, 0);

RichViewEdit1.Format;

If the StyleNo-th style has Unicode property = True, the file will be loaded as it is. If not, it will be converted to ANSI text.

See also:

•	Unicode in TRichView.


TRichViewEdit
 TRichView Reference | TRichViewEdit

 TRichViewEdit

Properties   Methods   Events

TRichViewEdit is a control for editing documents with pictures, tables, Delphi controls and hyperlinks.

Unit RVEdit

Syntax

TCustomRichViewEdit = class(TCustomRichView)

TRichViewEdit = class(TCustomRichViewEdit)

RichViewEdit does not display or edit its content if it is not linked to RVStyle component via Style property.

The most important property settings can be done in the component editor for TRichView. In Delphi (C++Builder) IDE, right click the RichViewEdit object on the form, choose "Settings" in the context menu.

Some abilities of TRichView are disabled in TRichViewEdit, such as:

•	OnCheckpointVisible event;

•	all features related to hypertext ids:OnRVMouseMove, OnJump,  GetJumpPointItemNo work only when user presses and holds  Ctrl  key, if rvtoCtrlJumps in EditorOptions (or if ReadOnly=True).

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

TRVScroller

TCustomRichView

TCustomRichViewEdit

List of properties, events and methods

grouped in several categories (some entries can be in several groups)

Properties  Events  General methods  Inserting items in the position of caret  Clipboard operations  Advanced methods for modifying items  Information about item at the position of caret	Modifying item at the position of caret  Undo/Redo  Unicode  Live spelling check  "Smart Popups"  Related to tables and special items  Working with checkpoints
Properties

•	CurItemNo – index of item in the position of caret, OffsetInCurItem – offset of caret in this item;

•	CurItemStyle – style (or type) of the item at the position of caret;

•	CurParaStyleNo – current paragraph style index;

•	CurTextStyleNo – current text style index, see also ActualCurTextStyleNo;

•	EditorOptions – options for editing;

•	ReadOnly disables/enables editing;

•	Modified – all editing methods set it to True.

•	CustomCaretInterval – blinking interval for custom caret.

See also properties for undo/redo.

Events

•	OnChange occurs when document is changed;

•	OnCurParaStyleChanged occurs when index of the current paragraph style is changed;

•	OnCurTextStyleChanged occurs when index of the current text style is changed;

•	OnPaste allows pasting data from the Clipboard in custom formats;

•	OnStyleConversion occurs while executing ApplyStyleConversion;

•	OnParaStyleConversion occurs while executing ApplyParaStyleConversion;

•	OnCaretGetOut occurs when user moves caret "outside" the editor;

•	OnCaretMove occurs when the caret is moved;

•	OnItemTextEdit occurs when text item's text is changed as a result of editing operation;

•	OnSmartPopupClick occurs when user clicks "smart popup" button.

•	OnMeasureCustomCaret and OnDrawCustomCaret allow drawing your own caret instead of the system one.

General Methods

•	ApplyParaStyle, ApplyTextStyle apply paragraph and text style to the selection;

•	ApplyStyleConversion applies custom style conversion to the selected text;

•	ApplyParaStyleConversion applies custom paragraph style conversion to the selected paragraphs;

•	Change generates OnChange event;

•	BeginUpdate, EndUpdate disable and enable redrawing;

•	SearchText, -A, -W search for substring.

Inserting Items in the Position of Caret (Insert*** methods)

•	InsertText, -A, -W, InsertStringTag, InsertStringATag, InsertStringWTag insert text;

•	InsertBreak inserts break (horizontal line);

•	InsertBullet inserts bullet;

•	InsertControl inserts Delphi control;

•	InsertHotspot inserts hotspot;

•	InsertPicture inserts picture;

•	InsertHotPicture inserts picture-hypertext link;

•	InsertTab inserts tabulator;

•	InsertRVFFromFileEd, InsertRVFFromStreamEd insert RVF (RichView Format) from file or stream;

•	InsertRTFFromFileEd, InsertRTFFromStreamEd insert RTF (Rich Text Format) from file or stream;

•	InsertTextFromFile,InsertOEMTextFromFile,InsertTextFromFileW insert text from file;

•	InsertItem – general method for inserting items, inserts one item (usually used for tables).

Clipboard Operations

Main methods and events:

•	CanPaste – "can something be pasted from the Clipboard?";

•	CanPasteRVF – "can RVF (RichView Format) be pasted from the Clipboard?";

•	CanPasteRTF – "can RTF (Rich Text Format) be pasted from the Clipboard?";

•	CutDef cuts selection to the Clipboard;

•	Paste pastes from the Clipboard;

•	PasteBitmap pastes bitmap from the Clipboard;

•	PasteMetafile pastes metafile from the Clipboard;

•	PasteGraphicFile pastes metafile from the Clipboard;

•	PasteRVF pastes RVF (RichView Format) from the Clipboard;

•	PasteRTF pastes RTF (Rich Text Format) from the Clipboard;

•	PasteTextA pastes ANSI text from the Clipboard;

•	PasteTextW pastes Unicode text from the Clipboard;

•	event OnPaste allows to paste data from the Clipboard in custom formats.

Also:

•	DeleteSelection deletes selection;

•	SelectCurrentWord selects word at the position of caret;

•	SelectCurrentLine selects the line containing caret.

Advanced Methods for Modifying Items (Set***InfoEd methods)

Main methods:

•	SetBreakInfoEd – for changing break;

•	SetBulletInfoEd – for changing bullet;

•	SetControlInfoEd – for changing inserted control;

•	SetHotspotInfoEd – for changing hotspot;

•	SetPictureInfoEd – for changing picture or hot picture.

Also:

•	SetItemExtraIntPropertyEd,
SetItemExtraStrPropertyEd – for changing additional properties of items;

•	SetItemTagEd – for changing tag;

•	SetItemVAlignEd – for changing item position relative to the line;

•	SetItemTextEd  changes text (name) of item;

•	SetCheckpointInfoEd – for changing checkpoint;

•	RemoveCheckpointEd – for deleting checkpoint;

•	ResizeControl – for resizing inserted control;

•	AdjustControlPlacement returns control to the proper position;

•	AdjustControlPlacement2 returns control to the proper position.

Information about the Item at the Position of Caret (GetCurrent***Info methods)

These methods are equivalent to Get***Info(CurItemNo,...) but work also in inplace editors of tables.

Main methods:

•	GetCurrentTextInfo – about text item;

•	GetCurrentBreakInfo – about break;

•	GetCurrentBulletInfo – about bullet;

•	GetCurrentControlInfo – about inserted control;

•	GetCurrentHotspotInfo – about hotspot;

•	GetCurrentPictureInfo – about picture or hot picture;

•	GetCurrentItem – as an object about any item (usually for tables);

•	GetCurrentItemEx.

Also:

•	GetCurrentItemExtraIntProperty,
GetCurrentItemExtraStrProperty return value of additional item property;

•	GetCurrentTag returns item's tag;

•	GetCurrentItemVAlign returns item position relative to the line;

•	GetCurrentCheckpoint returns item's checkpoint;

•	GetCurrentItemText returns text/name of item;

•	GetCurrentLineCol returns line and column at the caret position.

Modifying Item in Position of Caret (SetCurrent***Info methods)

These methods are equivalent to Set***InfoEd(CurItemNo,...) but work also in inplace editors of tables.

Main methods:

•	SetCurrentBreakInfo modifies break;

•	SetCurrentBulletInfo modifies bullet;

•	SetCurrentHotspotInfo modifies hotspot;

•	SetCurrentControlInfo modifies inserted control;

•	SetCurrentPictureInfo modifies picture or hot picture.

Also:

•	SetCurrentItemExtraIntProperty,

•	SetCurrentItemExtraStrProperty change value of additional item property;

•	SetCurrentTag modifies item's tag;

•	SetCurrentItemVAlign changes item position relative to the line;

•	SetCurrentItemText changes text (name) of item;

•	SetCurrentCheckpointInfo modifies checkpoint;

•	RemoveCurrentCheckpoint deletes checkpoint;

•	ResizeCurrentControl returns control to the proper position in document;

•	RemoveCurrentPageBreak removes "explicit page break before item" flag;

•	InsertPageBreak sets "explicit page break before item" flag; can split current item into two parts.

Undo/Redo

Main:

•	property UndoLimit sets capacity of undo buffer;

•	UndoAction returns which operation will be undone next;

•	Undo undoes the last operation;

•	UndoName returns name of custom undo operation which will be undone next;

•	RedoAction returns which operation will be redone next;

•	Redo redoes the last undone operation;

•	RedoName returns name of custom redo operation which will be redone next;

•	ClearUndo clears undo and redo buffers.

Also:

•	BeginUndoGroup,

•	BeginUndoCustomGroup,

•	SetUndoGroupMode.

Unicode

•	PasteTextW pastes Unicode text from the Clipboard;

•	InsertTextW inserts Unicode text;

•	InsertTextFromFileW inserts Unicode text from file.

Live Spelling Check

•	GetCurrentMisspelling returns misspelled word at the caret position;

•	property LiveSpellingMode controls when live spelling thread starts.

"Smart Popups"

"Smart popups" are buttons that can be used to set properties for the current (at the position of caret) item.

Properties:

•	SmartPopupProperties – popup button properties;

•	SmartPopupVisible – popup button properties.

Events:

•	OnSmartPopupClick occurs when user clicks "smart popup" button.

Related to Tables and Special Items

•	InsertItem – general method for inserting items, inserts one item (usually used for tables, labels, sequences, footnotes, endnotes, references to notes).

•	GetCurrentItem returns item at the position of caret as an object (usually used for tables, labels, sequences, footnotes, endnotes, references to notes);

•	BeginItemModify, EndItemModify are used to reformat editor after operations on item (usually on tables);

•	CanChange checks possibility of performing editing operation (usually it is called before making operations on table).

Working with Checkpoints

Editing-style analogs of methods of TRichView:

•	SetCheckpointInfoEd – adds checkpoint for the specified item;

•	RemoveCheckpointEd – deletes checkpoint for the specified item.

Methods working with the item at the position of caret:

•	GetCurrentCheckpoint – returns checkpoint associated with the item at the caret position;

•	SetCurrentCheckpointInfo – adds/modifies checkpoint for the item at the caret position;

•	RemoveCurrentCheckpoint – deletes checkpoint for the item at the caret position.

Methods working with the checkpoint exactly at the position of caret:

•	InsertCheckpoint – inserts checkpoint in the caret position;

•	GetCheckpointAtCaret – returns the checkpoint exactly at the caret position;

•	RemoveCheckpointAtCaret – deletes the checkpoint exactly at the caret position.


TRichViewEdit.AcceptDragDropFormats
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.AcceptDragDropFormats

Lists formats that can be accepted when dropping data in TRichViewEdit.

property AcceptDragDropFormats: TRVDragDropFormats

type

  TRVDragDropFormat = (

    rvddRVF, rvddRTF, rvddText, rvddUnicodeText,

    rvddBitmap, rvddMetafile, rvddURL, rvddFiles);

  TRVDragDropFormats = set of TRVDragDropFormat;

(introduced in v1.8)

Value	D&D Format	Meaning
rvddRVF	'RichView Format'	RichView Format
rvddRTF	'Rich Text Format'	RTF
rvddText	CF_TEXT	Plain ANSI text
rvddUnicodeText	CF_UNICODETEXT	Plain Unicode text
rvddBitmap	CF_DIB or CF_BITMAP	Bitmap
rvddMetafile	CF_ENHMETAFILE	Metafile
rvddURL	'UniformResourceLocator'	URL. If available, URL caption is read from CFSTR_FILEDESCRIPTOR format (otherwise caption = target). OnReadHyperlink event occurs with DocFormat=rvlfURL. If this event is not processed, URL is inserted as a plain text.
rvddFiles	CF_HDROP	By default, RichViewEdit inserts: • graphic files, • *.RTF, • *.RVF, • *.TXT. You can modify the default processing in OnDropFiles event.
Example (processing OnReadHyperlink with rvddURL support)

// OnReadHyperlink. This code assumes rvoTagsArePChars is in

// MyRichViewEdit.Options

procedure TMyForm.MyRichViewEditReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,

  ItemTag: Integer; var ItemName: TRVRawByteString);

begin

  if DocFormat=rvlfURL then

    StyleNo := GetHyperlinkStyleNo(Sender);

  ItemTag := Integer(StrNew(PChar(Target)));

end;

// This function returns index of text style having all properties

// like the current style, but hypertext, blue, underlined.

// If this style does not exist, it is added.

function TMyForm.GetHyperlinkStyleNo(rve: TCustomRichViewEdit): Integer;

var TextStyle: TFontInfo;

begin

  Result := rve.CurTextStyleNo;

  TextStyle := TFontInfo.Create(nil);

  try

    TextStyle.Assign(rve.Style.TextStyles[Result]);

    TextStyle.Jump := True;

    TextStyle.Color := clBlue;

    TextStyle.Style := TextStyle.Style+[fsUnderline];

    Result := rve.Style.TextStyles.FindSuchStyle(

      Result, TextStyle, RVAllFontInfoProperties);

    if Result<0 then

    begin

      rve.Style.TextStyles.Add;

      Result := rve.Style.TextStyles.Count-1;

      rve.Style.TextStyles[Result].Assign(TextStyle);

      rve.Style.TextStyles[Result].Standard := False;

    end;

  finally

    TextStyle.Free;

  end;

end;

Default value:

[rvddRVF, rvddRTF, rvddText, rvddUnicodeText, rvddBitmap, rvddMetafile, rvddFiles] (all except for rvddURL)

See also:

•	Drag&Drop.


TRichViewEdit.ActualCurTextStyleNo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ActualCurTextStyleNo  (read-only)

Index of the current text style in the collection of text styles. Can return rvsDefStyle.

property ActualCurTextStyleNo: Integer;

(introduced in v1.8)

This is an index in the collection Style.TextStyles.

This property is the same as CurTextStyleNo, but:

•	read-only;

•	does not process rvsDefStyle, returns it as it is.


TRichViewEdit.CurItemNo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CurItemNo (read-only)

Index of item at the position of caret

property CurItemNo: Integer;

This value is in range from 0 to ItemCount-1.

If the caret is inside table cell, this property returns index of the table in the main document. Items of subdocuments (table cells) are not included in the items range of the main document. If you want to know index of item at the position of caret in the table cell, use TopLevelEditor.CurItemNo.

This property must be accessed only when the document is formatted.

If you want to get the caret position as a number of characters from the beginning of the document, use RVGetCaretPos from RVLinear unit instead.

See also properties:

•	OffsetInCurItem;

•	TopLevelEditor;

•	CurItemStyle;

•	CurTextStyleNo;

•	CurParaStyleNo.

See also events:

•	OnCaretMove.

See also:

•	Inserting in the position of the caret;

•	How to: move the caret to the beginning or to the end of document in TRichViewEdit.


TRichViewEdit.CurItemStyle
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CurItemStyle (read-only)

Style (i.e. type) of item at the position of caret

property CurItemStyle: Integer;

The same as TopLevelEditor.GetItemStyle(TopLevelEditor.CurItemNo).

If the current item is a text item, this function returns zero or positive value: index in the collection of text styles (Style.TextStyles).

Otherwise, this function returns a type of this item: see rvsXXX constants.

This property must be accessed only when the document is formatted.

See also methods:

•	GetItemStyle.

See also properties:

•	CurItemNo;

•	CurTextStyleNo.

See also:

•	Item types.


TRichViewEdit.CurParaStyleNo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CurParaStyleNo

Index of the current paragraph style in the collection of paragraph styles.

property CurParaStyleNo: Integer;

This is an index in the collection Style.ParaStyles.

This is a style of paragraph containing caret.

Value of this is changed when the user moves the caret to another paragraph or edits the document, or when some methods are called. When this property is changed, OnCurParaStyleChanged event occurs.

Usually you do not need not to assign value to this property directly, use ApplyParaStyle or ApplyParaStyleConversion methods instead.

This property must be accessed only when the document is formatted.

See also methods:

•	ApplyParaStyle;

•	ApplyParaStyleConversion.

See also properties:

•	CurTextStyleNo.

See also events:

•	OnCurParaStyleChanged.

See also:

•	Working with paragraphs.


TRichViewEdit.CurTextStyleNo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CurTextStyleNo

Index of the current text style in the collection of styles.

property CurTextStyleNo: Integer;

This is an index in the collection Style.TextStyles.

This text style will be used when inserting new text in the document in the position of caret (both by user keyboard input and by methods, such as PasteText or InsertText).

This property is changed when user moves the caret to another text item or edits the document, or when some methods are called. When this property is changed, OnCurTextStyleChanged event occurs.

Value of this property is always positive. To get style (i.e. type) of item at the caret position, use CurItemStyle property.

The editor never sets this property to index of text style having rvprDoNotAutoSwitch in Protection. You can do it yourself to insert a special symbol (by keyboard input, or InsertText), but after that the component automatically switches this property back to the last used style without rvprDoNotAutoSwitch in Protection.

Usually you do not need to assign value to this property directly, use ApplyTextStyle or ApplyStyleConversion instead.

This property must be accessed only when the document is formatted.

This property never returns rvsDefStyle constant. It "translates" it and returns the index of text style that is used for text. If you want to know if the text actually has rvsDefStyle style, use ActualCurTextStyleNo property.

See also methods:

•	ApplyTextStyle;

•	ApplyStyleConversion.

See also properties:

•	CurItemStyle;

•	CurParaStyleNo;

•	ActualCurTextStyleNo.

See also events:

•	OnCurTextStyleChanged.


TRichViewEdit.CustomCaretInterval
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CustomCaretInterval

If set to positive value, activates the custom caret feature. Defines the timer interval for redrawing caret, in milliseconds.

property CustomCaretInterval: Integer;

(introduced in version 10)

The caret is activated when you call Format method (and is deactivated when you call Clear).

It's not recommended to use the custom caret feature together with image animation.

Default value:

0 (the system caret is used)

See also events:

•	OnMeasureCustomCaret;

•	OnDrawCustomCaret.


TRichViewEdit.EditorOptions
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.EditorOptions

Additional options affecting editing

type

  TRVEditorOption = (rvoClearTagOnStyleApp, rvoCtrlJumps,

    rvoDoNotWantReturns, rvoWantTabs,

    rvoAutoSwitchLang, rvoHideReadOnlyCaret,

    rvoDoNotWantShiftReturns, rvoNoImageResize,

    rvoNoCaretHighlightJumps)

  TRVEditorOptions = set of TRVEditorOption;

property EditorOptions: TRVEditorOptions;

Options for disabling/enabling certain editing operations

Option	Meaning
rvoDoNotWantReturns	If set, editor ignores  Enter  keys.
rvoDoNotWantShiftReturns	If set,  Shift + Enter  does nothing (by default, it inserts a line break inside paragraph – noticeable in paragraphs with bullets or borders)
rvoWantTabs	If set (default), editor accepts  Tab  key ( Ctrl + Tab  always works). Tabs can be inserted as several spaces, or as a tabulator (special item type), depending on the value of SpacesInTab property of the linked TRVStyle component.
rvoNoImageResize	Prevents resizing pictures and controls with mouse.
Visual options

Option	Meaning
rvoNoCaretHighlightJumps	If set, hyperlinks will not be highlighted (with HoverColor and HoverBackColor) when the caret is moved inside them.
rvoHideReadOnlyCaret	If set, the editor hides the caret in read-only mode
Other options

Option	Meaning
rvoCtrlJumps	If set (default), the editor switches to the hypertext mode (highlighting hypertext items under mouse cursor, using hypertext cursors, generating OnJump and OnRVMouseMove) when user presses and holds  Ctrl  key  The editor switches back to the editing mode when user releases  Ctrl  key or changes document, or if the editor loses focus.
rvoClearTagOnStyleApp	If set, editor clears tags (set to 0, or nil) of all text items when changing their style index using ApplyTextStyle or ApplyStyleConversion method.
rvoAutoSwitchLang	If set, the editor processes changing of keyboard locale (WM_INPUTLANGCHANGE message) and switches the current text style to the style having charset of the new keyboard locale. This option helps to provide multilingual input without using Unicode. This option is ignored if the current text style is Unicode style. If not, the editor searches for non-Unicode text styles with Charset of the new keyboard locale, and switches CurTextStyleNo to it. If such style was not found, the editor adds a new style in the collection of text styles. Thus this option may add new styles in the collection of text styles. If you use this option, you need to store text styles with the document (see "allow adding styles dynamically").
Default value (changed in v1.9):

[rvoWantTabs, rvoCtrlJumps]

See also:

•	Options.

See also events:

•	OnJump;

•	OnRVMouseMove.

See also:

•	TRVStyle.SpacesInTab;

•	RichView Hypertext;

•	Tags.


TRichViewEdit.LiveSpellingMode
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.LiveSpellingMode

Defines when live spelling thread is started.

type

  TRVLiveSpellingMode = (rvlspManualStart, rvlspOnChange);

property LiveSpellingMode: TRVLiveSpellingMode;

(introduced in v1.9)

Value	Meaning
rvlspManualStart	Live spelling check can be started only by StartLiveSpelling.
rvlspOnChange	Live spelling check also starts when the user modifies document (or when any editing-style method is called).
Default value:

rvlspOnChange

See also:

•	Live spelling check in RichView.


TRichViewEdit.Modified
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Modified

Value of this property is True if document was modified

property Modified: Boolean.

This is a public (not published) property.

Initially it is False. Calling Clear resets it to False.

Any editing operation, including calling any editor-style method (which invokes OnChange event) sets it to True.

Calling any method introduced in TCustomRichView does not affect it.

If you use this property, set it to False after saving document to file.


TRichViewEdit.OffsetInCurItem
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OffsetInCurItem (read-only)

Offset of the caret in the current item.

property OffsetInCurItem: Integer;

Index of item at the position of the caret is returned in CurItemNo property.

CurItemNo and OffsetInCurItem together define position of the caret in the document.

If item is a text item, then caret is before the OffsetInCurItem-th character of string. If caret is after the last character of the text item, OffsetInCurItem = length of the item + 1.

If item is not a text, then

•	if the caret is before the item, then OffsetInCurItem=0;

•	if the caret is after the item, then OffsetInCurItem=1.

If selection exists, position of the caret is always equal to the second bound of selection (because the caret is always at the end of selection).

You can set the caret position using SetSelectionBounds.

If the caret is inside table cell, this property returns 1 (position after the table). Items of subdocuments (table cells) are not included in the items range of the main document. If you want to know position of  the caret in the table cell, use TopLevelEditor.CurItemNo and TopLevelEditor.OffsetInCurItem.

This property must be accessed only when the document is formatted.

See also properties:

•	CurItemNo;

•	TopLevelEditor.

See also events:

•	OnCaretMove.

See also methods:

•	SetSelectionBounds;

•	GetSelectionBounds.

See also:

•	Inserting in the position of the caret;

•	How to: move the caret to the beginning or to the end of document in TRichViewEdit.


TRichViewEdit.ReadOnly
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ReadOnly

When set to True, this property prevents user's input in the editor; it also blocks execution of all [image] editing-style methods.

property ReadOnly: Boolean;

This property does not affect [image] viewer-style methods.

Editor hides the caret in read-only mode, if rvoHideReadOnlyCaret is in EditorOptions.

Since version 1.6, hypertext in read-only mode works automatically (user does not need to press and hold  Ctrl  key).

Default value:

False

See also events:

•	OnChanging.


TRichViewEdit.SmartPopupProperties
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SmartPopupProperties

Properties for "smart popups" (analog of Microsoft Office's "smart tags" buttons).

property SmartPopupProperties: TRVSmartPopupProperties;

(introduced in version 10)

See TRVSmartPopupProperties for details.

See also properties:

•	SmartPopupVisible.

See also events:

•	OnSmartPopupClick.


TRichViewEdit.SmartPopupVisible
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SmartPopupVisible

Shows/hides "smart popup" button for the current (at the position of caret) item.

property SmartPopupVisible: Boolean;

(introduced in version 10)

The editor hides this button automatically on document change or clearing.

Since smart popup works only for the current item, you must ensure that it is displayed for the current item: update it in OnCaretMove event. Even if this property is True, reassigning True to it makes sense, because it links the smart popup to the current item.

Properties for the button are defined in SmartPopupProperties.

See also events:

•	OnSmartPopupClick.


TRichViewEdit.TopLevelEditor
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.TopLevelEditor (read-only)

Returns active editor component

property TopLevelEditor: TCustomRichViewEdit;

(introduced in version 1.7)

This property returns editor containing the caret.

This is either this RichViewEdit itself or InplaceEditor of table cell which is being edited.

If cell of nested table is being edited, this is InplaceEditor of InplaceEditor, and so on.

Insert***, GetCurrent***, SetCurrent*** methods automatically work with content of TopLevelEditor.

Use this property, if you want to work with methods having ItemNo in parameters.

This property must be accessed only when the document is formatted.


TRichViewEdit.UndoLimit
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.UndoLimit

Limits capacity of the undo buffer.

property UndoLimit: Integer;

(Introduced in version 1.3)

Value	Meaning
0	Undo is turned off
-1	Undo buffer "unlimited" (limited by available memory)
any positive value	Limit of saved operations to undo
Note 1: although typing is undone character-by-character, it is saved as a single undo action (for more efficient memory usage).

Note 2: It's not recommended for this version to set UndoLimit to 1. Use multilevel undo instead.

Note 3: Modifying UndoLimit does not affect the current state of undo buffer (no items are deleted from it)

This property does not affect behavior of methods introduced in TRichView, they can't be undone.

Default value:

-1 (unlimited buffer)

See also:

•	Undo in RichViewEdit.


TRichViewEdit.AdjustControlPlacement
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.AdjustControlPlacement

Returns the control owned by the ItemNo-th item to its position in the document.

procedure AdjustControlPlacement(ItemNo: Integer);

Usually you do not need to use this method. RichViewEdit moves and scrolls inserted controls when it's needed.

If you want to resize control, use ResizeCurrentControl (or ResizeControl) method.

Use this method if the control has moved or resized itself. This method moves the control to the proper place in a document.

If the control has changed its size, this method also quickly reformats the affected part of the document.

It's recommended to use AdjustControlPlacement2 instead of this method, because it can work with controls inserted in table cells.

This method must be called only when the document is formatted.


TRichViewEdit.AdjustControlPlacement2
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.AdjustControlPlacement2

Returns Control back to its position in the document. Control must be inserted in RichViewEdit directly or in table cell.

procedure AdjustControlPlacement2(Control: TControl);

(introduced in version 1.4)

Usually you do not need to use this method. RichViewEdit moves and scrolls inserted controls when it's needed.

If you want to resize control, use ResizeCurrentControl (or ResizeControl) method.

Use this method if Control has moved or resized itself. This method moves the control to the proper place in the document.

If the control has changed its size, this method also quickly reformats the affected part of the document.

This method works only if the control is inserted in the root RichViewEdit or in cell inplace editor.

This method must be called only when the document is formatted.

See also:

•	AdjustControlPlacement.


TRichViewEdit.ApplyListStyle
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ApplyListStyle

Applies list style (bullets or numbering) to the selected paragraphs

procedure ApplyListStyle(AListNo, AListLevel, AStartFrom: Integer;

  AUseStartFrom, ARecursive: Boolean);

(introduced in version 1.7)

This method adds/changes list markers for the selected paragraph(s).

Parameters

AListNo defines style of this list. This is an index in the collection of list styles (Style.ListStyles)

AListLevel – list level. This is an index in the collection of list levels (Style.ListStyles[AListNo].Levels).

If AListLevel=-1, levels of the existing markers are not changed, new markers have level=0.

If AUseStartFrom=True, and this is a numbered list, AStartFrom defines value of the list counter for this marker. If AUseStartFrom=False, the numbering is continued. For bulleted lists, these parameters are ignored.

ARecursive – reserved for future use. Set it to False.

Method type:  editor-style method (unlike SetListMarkerInfo).

See also:

•	RemoveLists;

•	ChangeListLevels.

See also methods of TCustomRichView:

•	SetListMarkerInfo;

•	GetListMarkerInfo.


TRichViewEdit.ApplyParaStyle
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ApplyParaStyle

Applies the specified paragraph style.

procedure ApplyParaStyle(ParaStyleNo: Integer);

ParaStyleNo – index in the collection of paragraph styles (Style.ParaStyles).

The method applies the paragraph style ParaStyleNo to the paragraph containing the caret and all the selected paragraphs.

If the existing paragraphs are formatted with styles having rvpaoStyleProtect in their Options, this method does not change their styles.

Method type:  editing-style.

If you want to implement commands like "change alignment", "increase indent" use ApplyParaStyleConversion instead.

See also properties:

•	CurParaStyleNo.

See also methods:

•	ApplyTextStyle;

•	ApplyParaStyleConversion.

See also:

•	TParaInfo.Options;

•	Paragraphs overview.


TRichViewEdit.ApplyParaStyleConversion
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ApplyParaStyleConversion

Applies custom conversion procedure to styles of the selected paragraphs.

procedure ApplyParaStyleConversion(UserData: Integer);

(introduced in version 1.7)

This procedure calls OnParaStyleConversion event for each selected item. Using this method, you can implement commands like "change alignment" or "increase indent".

This method ignores any paragraph protection, it can change paragraph style even if rvpaoStyleProtect is included in Options of existing paragraphs' styles. If you want to respect paragraph style protection, check this option yourself in OnParaStyleConversion event.

Method type:  editing-style.

Demo:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

See also:

•	ApplyStyleConversion;

•	ApplyParaStyle.

See also events:

•	OnParaStyleConversion.

See also:

•	Paragraphs overview.


TRichViewEdit.ApplyStyleConversion
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ApplyStyleConversion

Applies custom conversion procedure to styles of the selected text items, tabs, label items.

procedure ApplyStyleConversion(UserData: Integer);

This procedure calls OnStyleConversion event for each selected text item and for the current text style. Using this method, you can implement commands like "make bold" or "change font name".

This method ignores any text protection, it can change text style even if rvprStyleProtect is included in Protection of existing text items' styles. If you want to respect text style protection, check this protection option yourself in OnStyleConversion event.

Method type:  editing-style.

 Unicode note: If Unicode text style is applied to ANSI text item, text in this item is converted from ANSI to Unicode, and vice versa.

Demo:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

See also:

•	ApplyParaStyleConversion;

•	ApplyTextStyle.

See also events:

•	OnStyleConversion.


TRichViewEdit.ApplyTextStyle
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ApplyTextStyle

Applies the specified text style to the selected items (text items, tabs, label items)

procedure ApplyTextStyle(TextStyleNo: Integer);

TextStyleNo – index in the collection of text styles (Style.TextStyles).

If selection is empty, this method only sets CurTextStyleNo to TextStyleNo.

If the selection is not empty, the method changes style of text items in the selection.

If the existing text items are formatted with styles having rvprStyleProtect in their Protection, this method does not change their styles.

Method type:  editing-style.

 Unicode note: If Unicode text style is applied to ANSI text item, text in this item is converted from ANSI to Unicode, and vice versa.

If you want to implement commands like "make bold", "change text color", "apply font", use ApplyStyleConversion instead of this method.

See also properties:

•	CurTextStyleNo;

•	EditorOptions.

See also methods:

•	ApplyParaStyle.


TRichViewEdit.BeginItemModify
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.BeginItemModify

Stores some information required for quick reformatting after modification of item.

procedure BeginItemModify(ItemNo: Integer; var ModifyData: Integer);

Input parameter:

ItemNo – index of item which will be modified.

Output parameter:

ModifyData receives some formatting information. Value assigned to this parameter should be passed to EndItemModify after performing modifications.

Usually this function is used when modifying tables.

This method must be called only when the document is formatted.

Example is in Table Operations Overview


TRichViewEdit.BeginUndoCustomGroup
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.BeginUndoCustomGroup

Begins a new undo action.

procedure BeginUndoCustomGroup(const Name: String);

Begins a new undo action.

Usually followed by SetUndoGroupMode(True) ... SetUndoGroupMode(False), thus allowing to group several subsequent changes in editor (they will be undone/redone as one operation).

The same as BeginUndoGroup, but allows to give a custom name to this group of changes.

This method must be called only when the document is formatted.

This method must be called directly for the editor where changed are made (usually TopLevelEditor).

See also:

•	Undo in RichViewEdit.


TRichViewEdit.BeginUndoGroup
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.BeginUndoGroup

Begins a new undo action.

procedure BeginUndoGroup(UndoType: TRVUndoType);

Begins a new undo action.

Usually followed by SetUndoGroupMode(True) ... SetUndoGroupMode(False), thus allowing to group several subsequent changes in editor (they will be undone/redone as one operation).

The same as BeginUndoCustomGroup, but gives a standard name (undo identifier) to this group of changes.

This method must be called only when the document is formatted.

This method must be called directly for the editor where changed are made (usually TopLevelEditor).

See also:

•	Undo in RichViewEdit, includes example.


TRichViewEdit.BeginUpdate
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.BeginUpdate

Suspends repainting until EndUpdate is called.

procedure BeginUpdate;

(meaning of this method is changed since version 10)

Use BeginUpdate to speed processing and avoid flicker while multiple editing operations are applied.

Calls to BeginUpdate and EndUpdate can be nested.


TRichViewEdit.CanChange
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CanChange

Returns: "can the document in this editor be changed now?"

function CanChange: Boolean;

This function checks ReadOnly property.

Usually this function is called before performing operations on tables to prevent modifying editor in read-only state.

For TDBRichViewEdit, this function also turns the editor's dataset in editing mode (required before operations on tables).

This method must be called only when the document is formatted.


TRichViewEdit.CanPaste
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CanPaste

Returns True if:

•	the Clipboard contains data in format which RichViewEdit can paste, and

•	the editor is not in read-only state (ReadOnly=False)

function CanPaste: Boolean;

See also methods:

•	Paste;

•	CanPasteRVF;

•	CanPasteRTF.

See also:

•	Working with Clipboard.


TRichViewEdit.CanPasteRTF
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CanPasteRTF

Returns True if:

•	the Clipboard contains data in RTF (Rich Text Format), and

•	the editor is not in read-only state (ReadOnly=False)

function CanPasteRTF: Boolean;

(Introduced in version 1.5)

See also methods:

•	PasteRTF;

•	CanPaste.

See also:

•	Working with Clipboard


TRichViewEdit.CanPasteRVF
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CanPasteRVF

Returns True if:

•	the Clipboard contains data in RVF (RichView Format), and

•	the editor is not in read-only state (ReadOnly=False)

function CanPasteRVF: Boolean;

See also methods:

•	PasteRVF;

•	CanPaste.

See also:

•	Working with Clipboard;

•	RVF.


TRichViewEdit.Change
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Change

Generates OnChange event.

procedure Change;

This method also assigns True to Modified property.


TRichViewEdit.ChangeListLevels
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ChangeListLevels

Changes list levels (levels of paragraphs bullets and numbering) for the selected paragraphs.

procedure ChangeListLevels(LevelDelta: Integer);

(introduced in version 1.7)

For example,

  rve.ChangeListLevels(+1) // increases level by 1

  rve.ChangeListLevels(-1) // decreases level by 1

Paragraphs without bullets or numbering are not affected.

Method type:  editing-style.

See also:

•	ApplyListStyle;

•	RemoveLists.

See also methods of TCustomRichView:

•	SetListMarkerInfo;

•	GetListMarkerInfo.


TRichViewEdit.Clear
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Clear

Clears the document.

procedure Clear;override;

This method:

•	deletes all content of the document (see RichView.Clear);

•	sets the current text style index (CurTextStyleNo) and the current paragraph style index (CurParaStyleNo) to zeros;

•	clears undo and redo buffers (see ClearUndo);

•	sets Modified to False.

This method does not check ReadOnly, does not reformat and repaint component, does not generate OnChange.

This methods makes the document unformatted.


TRichViewEdit.ClearTextFlow
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ClearTextFlow

Clears text flow around left- and right-aligned items.

procedure ClearTextFlow(Left, Right: Boolean);

(introduced in version 12)

This method changes ClearLeft and ClearRight property for the first selected paragraph.

Method type:  editing-style.

See also:

•	TRVVAlign type (rvvaLeft and rvvaRight)


TRichViewEdit.ClearUndo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ClearUndo

Clears undo and redo buffers of the editor.

procedure ClearUndo;

(Introduced in version 1.3)

See also:

•	Undo in RichViewEdit.


TRichViewEdit.ConvertToHotPicture
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ConvertToHotPicture

Converts item type from picture to hot-picture.

procedure ConvertToHotPicture(ItemNo: Integer);

Hot-picture is a picture with hypertext link.

If ItemNo<0, this methods works with the item at the position of caret. Otherwise (if ItemNo in range 0..ItemCount-1) it works with the specified item

If this item is not a picture (GetItemStyle/CurItemStyle <> rvsPicture), this method does nothing.

Method type:  editing-style.

See also:

•	ConvertToPicture.


TRichViewEdit.ConvertToPicture
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ConvertToPicture

Converts item type from hot-picture to picture

procedure ConvertToPicture(ItemNo: Integer);

Hot-picture is a picture with hypertext link.

If ItemNo<0, this methods works with the item at the position of caret. Otherwise (if ItemNo in range 0..ItemCount-1) it works with the specified item.

If this item is not a hot-picture (GetItemStyle/CurItemStyle <> rvsHotPicture), this method does nothing.

Method type:  editing-style.

See also:

•	ConvertToHotPicture.


TRichViewEdit.Create
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Create

Usual component constructor.

Creates a new RichViewEdit instance.

constructor Create(AOwner: TComponent);override;

Use Create to instantiate RichViewEdit at runtime. RichViewEdits placed on forms at design time are created automatically. Specify the owner of the new RichViewEdit using the AOwner parameter.

Important note: initial values of several properties of components created in code may be different from initial values of components placed on form at design time. In the latter case, initial values of these properties can be overridden by the designtime component editor (and overridden by default!)


TRichViewEdit.CutDef
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.CutDef

Cuts selection to the Clipboard

procedure CutDef;

This method copies selection to the Clipboard using CopyDef method. If the selection was copied (at least one of copy formats is selected in Options), it calls DeleteSelection.

This method is executed automatically when user presses  Ctrl + X  or  Shift + Delete .
Method type:  editing-style.

See also methods:

•	CopyDef;

•	Paste;

•	SelectionExists.

See also:

•	Working with selection;

•	Working with Clipboard.


TRichViewEdit.DeleteSelection
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.DeleteSelection

Deletes the selected fragment in the editor.

procedure DeleteSelection;

Method type:  editing-style.

See also:

•	Working with selection.


TRichViewEdit.Destroy
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Destroy

Destroys an instance of TRichViewEdit

destructor Destroy;override;

Do not call Destroy directly in an application. Instead, call Free. Free verifies that the control is not nil, and only then calls Destroy.

Applications should only free controls explicitly when the constructor was called without assigning an owner to the control.


TRichViewEdit.EndItemModify
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.EndItemModify

Quickly reformats editor after modifying item.

procedure EndItemModify(ItemNo: Integer; ModifyData: Integer);

Parameters:

ItemNo – index of item which was modified.

ModifyData – the value obtained in BeginItemModify

Usually this function is used when modifying tables.

Example is in Table Operations Overview


TRichViewEdit.EndUpdate
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.EndUpdate

Reenables editor repainting that was turned off with the BeginUpdate method. Repaints the editor.

procedure EndUpdate;

(meaning of this method is changed since v10)

Calls to BeginUpdate are cumulative, so calling EndUpdate will reenable repainting only if every call to BeginUpdate has been matched by a call to EndUpdate.


TRichViewEdit.GetCheckpointAtCaret
 TRichView Reference | TRichViewEdit

TRichViewEdit.GetCheckpointAtCaret

Returns checkpoint at the position of caret.

function GetCheckpointAtCaret: TCheckpointData;

(introduced in version 10)

This method returns checkpoint only if the caret is at the beginning of item, otherwise it returns nil.

The following table compares this method with GetCurrentCheckpoint.

Caret Position	GetCheckpointAtCaret	GetCurrentCheckpoint
In the middle of text item	returns nil	returns checkpoint for this item
At the beginning of item and at the beginning of line	returns checkpoint for this item	returns checkpoint for this item
At the beginning of item and in the middle of line	returns checkpoint for this item	returns checkpoint for the previous item
At the end of item and at the end of line	returns nil	returns checkpoint for this item
This method is used in conjunction with InsertCheckpoint and RemoveCheckpointAtCaret. The alternative set of methods is: SetCurrentCheckpointInfo, GetCurrentCheckpoint and RemoveCurrentCheckpoint.

See also:

•	"Checkpoints".


TRichViewEdit.GetCurrentBreakInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentBreakInfo

Returns main properties for the item of break type at the position of caret.

procedure GetCurrentBreakInfo(var AWidth: Byte;

  var AStyle: TRVBreakStyle; var AColor: TColor;

  var ATag: Integer);

GetCurrentBreakInfo(...) is equivalent to TopLevelEditor.GetBreakInfo(TopLevelEditor.CurItemNo, ...).

The item must be of break type (rvsBreak), otherwise the method raises ERichViewError exception. Type of item at the position of caret is returned by CurItemStyle.

Output parameters:

AWidth – line width (or rectangle height).

AStyle – visual style of this break, see TRVBreakStyle for possible values.

AColor – line color. If it is equal to clNone, Style.TextStyles[0].Color is used.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetCurrentTag or SetCurrentBreakInfo to change tag of item as an editing operation. This value can also be read using GetCurrentTag method.

This method must be called only when the document is formatted.

Additional properties of item at the position of caret are returned by the methods GetCurrentItemExtraIntProperty and GetCurrentItemExtraStrProperty.

See also methods:

•	SetCurrentBreakInfo (changes properties of break at the position of caret, as an editing operation);

•	GetBreakInfo (returns properties of the specified break).

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.GetCurrentBulletInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentBulletInfo

Returns main properties for the item of bullet type at the position of caret.

procedure GetCurrentBulletInfo(var AName: TRVAnsiString;

  var AImageIndex: Integer; var AImageList: TCustomImageList;

  var ATag: Integer);

GetCurrentBulletInfo(...) is equivalent to TopLevelEditor.GetBulletInfo(TopLevelEditor.CurItemNo, ...).

Output parameters:

AName – name of bullet. It can also be read using GetCurrentItemText method.

AImageList – image list (a reference to image list, do not free it).

AImageIndex – index in AImageList.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert returned ATag to PChar), not to the copy of it, so you should not free it. Use SetCurrentTag or SetCurrentBulletInfo to change tag of item as an editing operation. This value can also be read using GetCurrentTag method.

This method must be called only when the document is formatted.

 Unicode note: names of non-text items are ANSI strings.

Additional properties of item at the position of caret are returned by the methods GetCurrentItemExtraIntProperty and GetCurrentItemExtraStrProperty.

See also methods:

•	SetCurrentBulletInfo (changes properties of bullet at the position of caret, as an editing operation);

•	GetBulletInfo (returns properties of the specified bullet).

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.GetCurrentCheckpoint
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentCheckpoint

Returns checkpoint associated with the item at position of caret, or nil if this item does not have associated checkpoint.

function GetCurrentCheckpoint: TCheckPointData;

The same as TopLevelEditor.GetItemCheckpoint(TopLevelEditor.CurItemNo).

This method must be called only when the document is formatted.

See also methods:

•	SetCurrentCheckpointInfo (changes checkpoint of item at the position of caret, as an editing operation);

•	GetItemCheckpoint (returns checkpoint of the specified item).

See also properties:

•	CurItemNo.

See also:

•	"Checkpoints".


TRichViewEdit.GetCurrentControlInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentControlInfo

Returns main properties for the item of inserted control type at position of caret.

procedure GetCurrentControlInfo(var AName: TRVAnsiString;

  var Actrl: TControl; var AVAlign: TRVVAlign;

  var ATag: Integer);

GetCurrentControlInfo(...) is equivalent to TopLevelEditor.GetControlInfo(TopLevelEditor.CurItemNo, ...).

Output parameters:

AName – name of control item. Do not confuse with Actrl.Name property! This value can also be read using GetCurrentItemText method.

Actr – the control itself. This method returns control owned by RichView, do not not destroy it.

AVAlign – vertical alignment of the control.

ATag – tag of the item. Do not confuse with Actrl.Tag property! If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetCurrentTag or  SetCurrentControlInfo to change tag of item as an editing operation. This value can also be read using GetCurrentTag method.

This method must be called only when the document is formatted.

 Unicode note: names of non-text items are ANSI strings.

Additional properties of item at the position of caret are returned by the methods GetCurrentItemExtraIntProperty and GetCurrentItemExtraStrProperty.

See also methods:

•	SetCurrentControlInfo (changes properties of control item at the position of caret, as an editing operation);

•	GetControlInfo (returns properties of the specified control item).

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.GetCurrentHotspotInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentHotspotInfo

Returns main properties for the item of hotspot type at the position of caret.

procedure GetCurrentHotspotInfo(var AName: TRVAnsiString;

  var AImageIndex, AHotImageIndex: Integer;

  var AImageList: TCustomImageList;

  var ATag: Integer);

GetCurrentHotspotInfo(...) is equivalent to TopLevelEditor.GetHotspotInfo(TopLevelEditor.CurItemNo, ...).

Output parameters:

AName – name of hotspot. It can also be read using GetCurrentItemText method.

AImageList – image list (a reference to image list, do not free it).

AImageIndex – index in AImageList for normal image.

AHotImageIndex – index in AImageList for "hot" image. This image is displayed under the mouse pointer (in hypertext mode), or when user moves the caret to this item (in TRichViewEdit).

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert returned ATag to PChar), not to the copy of it, so you should not free it. Use SetCurrentTag or SetCurrentHotspotInfo to change tag of item as an editing operation. This value can also be read using GetCurrentTag method.

This method must be called only when the document is formatted.

 Unicode note: names of non-text items are ANSI strings.

Additional properties of item at the position of caret are returned by the methods GetCurrentItemExtraIntProperty and GetCurrentItemExtraStrProperty.

See also methods:

•	SetCurrentHotspotInfo (changes properties of hotspot at the position of caret, as an editing operation);

•	GetHotspotInfo (returns properties of the specified hotspot).

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.GetCurrentItem
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItem

Returns object representing item at position of caret.

function GetCurrentItem: TCustomRVItemInfo;

(introduced in version 1.4)

This method is usually used when working with tables, labels, sequences, footnotes, endnotes, references to notes.

The table object is returned if the caret is to the left or to the right of the table, or if several table cells are selected. If the caret is inside table cell, this method returns item contained in this cell. To get the table in this case, use GetCurrentItemEx instead of GetCurrentItem.

This method must be called only when the document is formatted.

See also methods:

•	GetCurrentItemEx;

•	InsertItem;

•	GetItem.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Tables in RichView.


TRichViewEdit.GetCurrentItemEx
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItemEx

Returns object at the position of caret representing item of the given class.

function GetCurrentItemEx(RequiredClass: TCustomRVItemInfoClass;

  var ItemRichViewEdit: TCustomRichViewEdit;

  var Item: TCustomRVItemInfo): Boolean;

(introduced in version 1.4)

This method is usually used when working with tables.

Input parameter:

RequiredClass – the required class of item, set it to TRVTableItemInfo.

Output parameters:

ItemRichViewEdit – editor containing this item (table); it can be the main editor, or cell inplace-editor (if this item (table) is in cell of another table).

Item – object representing the item (table)

This method must be called only when the document is formatted.

Return value

The method returns True if the output parameters were assigned. In case of tables, it returns True if:

•	the caret is to the right or to the left of the table, or

•	the table has multicell selection, or

•	the caret is inside table cell.

In case of nested tables, this method returns the top level table (the closest to the user in Z-order).

See also methods:

•	GetCurrentItem;

•	InsertItem;

•	GetItem.

See also:

•	Obtaining RichView items;

•	Tables in RichView.


TRichViewEdit.GetCurrentItemExtraIntProperty
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItemExtraIntProperty

Returns value of the specified integer property of item at the position of caret

function GetCurrentItemExtraIntProperty(

  Prop: TRVExtraItemProperty; var Value: Integer): Boolean;

(introduced in version 1.7)

GetCurrentItemExtraIntProperty(...) is equivalent to TopLevelEditor.GetItemExtraIntProperty(TopLevelEditor.CurItemNo, ...).

Value receives value of the property identified by Prop. See TRVExtraItemProperty for the list of available properties.

This method must be called only when the document is formatted.

Return value

True, if this item has this property. False, if not.

See also

•	SetCurrentItemExtraIntProperty (sets value of integer property for item at the position of caret, as an editing operation);

•	SetItemExtraIntPropertyEd (sets value of integer property for the specified item, as an editing operation);

•	GetCurrentItemExtraStrProperty (returns value of the specified string property of item at the position of caret).

See also methods of TRichView

•	GetItemExtraIntProperty.


TRichViewEdit.GetCurrentItemExtraStrProperty
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItemExtraStrProperty

Returns value of the specified string property of the item at the position of caret

function GetCurrentItemExtraStrProperty(

  Prop: TRVExtraItemStrProperty; var Value: String): Boolean;

(introduced in version 1.9)

GetCurrentItemExtraStrProperty(...) is equivalent to TopLevelEditor.GetItemExtraStrProperty(TopLevelEditor.CurItemNo, ...).

Value receives value of the property identified by Prop. See TRVExtraItemStrProperty for the list of available properties.

This method must be called only when the document is formatted.

Return value

True, if this item has this property. False, if not.

 Unicode note: string properties are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also:

•	SetCurrentItemExtraStrProperty (sets value of string property for item at the position of caret, as an editing operation);

•	SetItemExtraStrPropertyEd (sets value of string property for the specified item, as an editing operation);

•	GetCurrentItemExtraIntProperty (returns value of the specified integer property of item at the position of caret).

See also methods of TRichView:

•	GetItemExtraStrProperty.


TRichViewEdit.GetCurrentItemText -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItemText, GetCurrentItemTextA, GetCurrentItemTextW

Returns text for the item at the position of caret.

function GetCurrentItemText: String;

function GetCurrentItemTextA: TRVAnsiString;

function GetCurrentItemTextW: TRVUnicodeString;

(Introduced in version 1.4, 1.7)

For text items, these methods return visible text. For non-text items, they return item name.

•	GetCurrentItemText is the same as TopLevelEditor.GetItemText(TopLevelEditor.CurItemNo).

•	GetCurrentItemTextA is the same as TopLevelEditor.GetItemTextA(TopLevelEditor.CurItemNo).

•	GetCurrentItemTextW is the same as TopLevelEditor.GetItemTextW(TopLevelEditor.CurItemNo).

 Unicode notes:

GetCurrentItemTextA always returns ANSI string:

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

•	If the item is a Unicode text item, the function converts Unicode text to ANSI (Unicode text is converted basing on Charset of the item text style).

GetCurrentItemTextW always returns Unicode string:

•	If the item is a Unicode text item, the text is returned as it is.

•	If the item is a non-text item, or a text item of ANSI style, the function converts ANSI text to Unicode (ANSI text is converted basing on Charset of the item text style, or on RVStyle.DefCodePage for non-text items).

GetCurrentItemText works like GetCurrentItemTextW in Delphi/C++Builder 2009 or newer, and like GetCurrentItemTextA in the older versions of Delphi/C++Builder.

These methods must be called only when the document is formatted.

See also methods:

•	SetCurrentItemText -A -W.

See also methods of TCustomRichView:

•	GetItemText -A -W.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags";

•	Unicode in RichView.


TRichViewEdit.GetCurrentItemVAlign
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentItemVAlign

Returns vertical alignment (position relative to the line) of the item at the caret position

function GetCurrentItemVAlign: TRVVAlign;

(introduced in version 12)

The same as TopLevelEditor.GetItemVAlign(TopLevelEditor.CurItemNo).

This method must be called only when the document is formatted.

This method must not be called if the current item is one of: text items, tables, breaks, tabs, list markers, footnotes and endnotes.

See also methods:

•	SetCurrentItemVAlign.

See also properties:

•	CurItemNo.


TRichViewEdit.GetCurrentLineCol
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentLineCol

Returns a line and column at the caret position.

procedure GetCurrentLineCol(var Line, Column: Integer);

(introduced in version 1.7)

Number of lines depends on word-wrapping.

Number of the first line is 1. Number of the leftmost caret position is 1.

Lines in table cells are calculated relative to the beginning of the cell.

Warning: this function contains calculations inside, and it may take some time to execute it

(There is an idea how to make it lightning-fast in future, but it will be implemented later)

This method must be called only when the document is formatted.

See also methods of TCustomRichView:

•	GetLineNo.


TRichViewEdit.GetCurrentMisspelling
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentMisspelling

Returns misspelled word in the position of caret, optionally selects it.

function GetCurrentMisspelling(SelectIt: Boolean;

  var Word: String; var StyleNo: Integer): Boolean;

Input parameters:

SelectIt – if True, the returned word will be selected in the editor.

Output parameters:

Word receives misspelled word.

StyleNo receives text style of misspelled word (index in TextStyles collection of the linked TRVStyle component).

The output parameters are defined only if this method returns True.

 Unicode note: Word parameter is Unicode string for Delphi/C++Builder 2009, and ANSI string for the older versions of Delphi/C++Builder.

Return value

True if misspelling is found.

See also:

•	Live spelling check in RichView.


TRichViewEdit.GetCurrentPictureInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentPictureInfo

Returns main properties for the item of picture/hot-picture type at the position of caret.

procedure GetCurrentPictureInfo(var AName: TRVAnsiString; var Agr: TGraphic;

  var AVAlign: TRVVAlign; var ATag: Integer);

GetCurrentPictureInfo(...) is equivalent to TopLevelEditor.GetPictureInfo(TopLevelEditor.CurItemNo, ...).

Output parameters:

AName – name of the item. It can also be read using GetCurrentItemText method.

Agr – graphic object. This method returns object owned by RichViewEdit, do not not destroy it.

AVAlign – vertical alignment of the picture.

ATag – tag of the item. If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this procedure returns a pointer to this string (you can convert the returned ATag to PChar), not to the copy of it, so you should not free it. Use SetCurrentTag or SetCurrentPictureInfo to change tag of item as an editing operation. This value can also be read using GetCurrentTag method.

This method must be called only when the document is formatted.

 Unicode note: names of non-text items are ANSI strings.

Additional properties of item at the position of caret are returned by the methods GetCurrentItemExtraIntProperty and GetCurrentItemExtraStrProperty.

See also methods:

•	SetCurrentPictureInfo  (changes properties of picture at the position of caret, as an editing operation);

•	GetPictureInfo (returns properties of the specified picture).

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.GetCurrentTag
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentTag

Returns tag of the item at the caret position

function GetCurrentTag: Integer;

The same as TopLevelEditor.GetItemTag(TopLevelEditor.CurItemNo).

If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this method returns a pointer to this string (you can convert returned value to PChar), not to a copy of it, so you should not free it. Use SetCurrentTag to change tag of item at the caret position, as an editing operations.

This method must be called only when the document is formatted.

See also methods:

•	SetCurrentTag.

See also properties:

•	CurItemNo.

See also

•	"Tags".


TRichViewEdit.GetCurrentTextInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.GetCurrentTextInfo

Returns text and tag for text item at the position of caret

procedure GetCurrentTextInfo(var AText: String; var ATag: Integer);

GetCurrentTextInfo(...) is equivalent to TopLevelEditor.GetTextInfo(TopLevelEditor.CurItemNo, ...).

If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this method returns a pointer to this string (you can convert returned value to PChar), not to a copy of it, so you should not free it. Use SetCurrentTag to change tag of item at the caret position, as an editing operations.

This method must be called only when the document is formatted.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining items;

•	Item types;

•	"Tags".


TRichViewEdit.InsertBreak
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertBreak

Inserts break (horizontal line) in the position of caret.

function InsertBreak(Width: Byte; Style: TRVBreakStyle; Color: TColor): Boolean;

Parameters:

Width – width of line (can be in range from 1 to 10);

Style – break type;

Color – color of line. If it is equal to clNone, the break has the color of the 0th text style.

Method type:  editing-style method for insertion.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods of TCustomRichView:

•	AddBreakEx and others.

See also:

•	Inserting items in position of caret;

•	Item types.


TRichViewEdit.InsertBullet
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertBullet

Inserts bullet in the position of caret.

function InsertBullet(ImageIndex: Integer; ImageList: TCustomImageList): Boolean;

Parameters:

Name – name of bullet, any string. Name must not contain CR and LF characters. RichViewEdit does not use item names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

ImageIndex – index of image in ImageList.

ImageList – image list for this bullet. RichView does not own, does not copy and does not destroy image lists, it just holds pointers to them. So this image list is not destroyed when the document is cleared.

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods of TCustomRichView:

•	AddBulletEx and others;

See also:

•	Inserting items in position of caret;

•	Item types.


TRichViewEdit.InsertCheckpoint
 TRichView Reference | TRichViewEdit

TRichViewEdit.InsertCheckpoint

Inserts checkpoint in the position of caret.

procedure InsertCheckpoint(ATag: Integer; const AName: String;

 ARaiseEvent: Boolean);

(introduced in version 10)

This method is similar to SetCurrentCheckpointInfo, but inserts checkpoint exactly in the position of caret.

If the caret is at the beginning of item, this methods calls SetCheckpointInfoEd to add checkpoint for this item.

If the caret is at the middle of text item, this method splits this item at the position of caret, and calls SetCheckpointInfoEd to add checkpoint for the item to the right.

If the caret is at the end of paragraph, the method moves it to the beginning of the next paragraph, and calls SetCheckpointInfoEd to add checkpoint for the first paragraph item (or the second item, if the first one is list marker).

If the caret is at the end of document, this methods does nothing.

This method is used in conjunction with GetCheckpointAtCaret and RemoveCheckpointAtCaret (GetCurrentCheckpoint and RemoveCurrentCheckpoint cannot be used, because checkpoint added by this method is not necessary belongs to the current item (that is usually the item to the left of the caret).

Parameters.

ATag – tag of checkpoint; it can be an integer value or a pointer to dynamically allocated string (see rvoTagsArePChars in RichView.Options)

AName – name of the checkpoint, any string without line break (CR, LF) characters.

ARaiseEvent – "raise event" flag; if set, RichView can generate OnCheckpointVisible event for this checkpoint.

Method type:  editing-style.

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also:

•	Modifying RichView items;

•	"Checkpoints";

•	"Tags".


TRichViewEdit.InsertControl
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertControl

Inserts Delphi/C++Builder control in the position of caret.

function InsertControl(const Name: TRVAnsiString; ctrl: TControl;

  VAlign: TRVVAlign): Boolean;

Parameters:

Name – name of this control item, any string. Name must not contain CR and LF characters. RichView does not use item names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles. Do not confuse with ctrl.Name property.

ctrl – control to insert. You should create control but should not destroy it (RichViewEdit will do it for you).

VAlign – vertical align of this control, relative to its line, see TRVVAlign for possible values.

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

Return value

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods of TCustomRichView:

•	AddControlEx and others;

See also:

•	Inserting items in position of caret;

•	Item types.


TRichViewEdit.InsertHotPicture
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertHotPicture

Inserts picture with hypetext link in the position of caret.

function InsertHotPicture(const Name: TRVAnsiString; gr: TGraphic;

  VAlign: TRVVAlign): Boolean;

(introduced in version 1.5)

The same as InsertPicture, but this picture will be a hypertext link.

Method type:  editing-style method for insertion.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods of TCustomRichView:

•	AddHotPicture and others.

See also:

•	Inserting items in position of caret;

•	Hypertext in RichView;

•	Item types.


TRichViewEdit.InsertHotspot
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertHotspot

Inserts hotspot in the position of caret.

function InsertHotspot(ImageIndex, HotImageIndex: Integer;

  ImageList: TCustomImageList): Boolean;

Parameters:

Name – name of hotspot, any string. Name must not contain CR and LF characters. RichViewEdit does not use item names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

ImageIndex – index of image in ImageList.

HotImageIndex – index of "hot" image in ImageList. It is displayed when the mouse pointer is above this hotspot.

ImageList – image list for this bullet. RichView does not own, does not copy and does not destroy image lists, it just holds pointers to them. So this image list is not destroyed when the document is cleared.

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods of TCustomRichView:

•	AddHotspotEx and others.

See also:

•	Inserting items in position of caret;

•	Hypertext in RichView;

•	Item types.


TRichViewEdit.InsertItem
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertItem

Inserts item in the position of caret.

function InsertItem(const Name: String;

  Item: TCustomRVItemInfo): Boolean;

(introduced in version 1.4)

This is the most general method for inserting items. It can be used to insert items of custom types.

This method is usually used for inserting tables, labels, sequences, footnotes, endnotes, references to notes.

The detailed description of item types is beyond the scope of this help file. Briefly, standard item types are declared and implemented in RVItem unit. All item types are classes derived from one base class – TCustomRVItemInfo.

Parameters:

Text – some text associated with this item (the name of item). It must not contain CR and LF characters.

Item – item itself. Item.ParaNo defines paragraph style of item (index in Style.ParaStyles).

Method type:  editing-style method for insertion.

 Unicode note: for Delphi/Unicode 2009 or newer, Text is Unicode string; for the older versions of Delphi/C++Builder, Text is ANSI string. It is converted to ANSI/Unicode, if necessary. Names of non-text items are ANSI strings.

Return value:

If True, the item was inserted successfully.

If False, the item can not be inserted (because text is read-only or protected, or when inserting in table having multicell selection); in this case Item was destroyed (freed) by InsertItem.

See also methods of TCustomRichView:

•	AddItem.

See also:

•	Inserting items in position of caret;

•	Item types.


TRichViewEdit.InsertOEMTextFromFile
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertOEMTextFromFile

Loads text file (in OEM-defined character set) FileName and inserts its content in the position of caret.

function InsertOEMTextFromFile(const FileName: String):Boolean;

"OEM" stands for "original equipment manufacturer". This is character set of MS DOS.

The inserted text (one or more text items) has current text and paragraph styles.

Method type:  editing-style method for insertion.

 Unicode note: File content must be in OEM charset. Text will be converted to ANSI or to Unicode, depending on Unicode property of the current text style.

Return value:

"Was reading from from file successful?"

See also methods:

•	InsertTextFromFile;

•	InsertText.

See also properties:

•	CurParaStyleNo;

•	CurTextStyleNo.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	Saving and loading;

•	Inserting items in position of caret.


TRichViewEdit.InsertPageBreak
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertPageBreak

Inserts explicit page break in the position of caret.

procedure InsertPageBreak

(introduced in version 1.2)

The method deselects the document before performing its work.

If the caret is not at the beginning of some item which is always displayed from the new line (see IsFromNewLine), the method breaks the current line (just like if user pressed  Enter  key).

The method sets "explicit page break" flag for the item in the position of caret (see PageBreaksBeforeItems).

Method type:  editing-style.

See also:

•	RemoveCurrentPageBreak.

See also properties of RichView:

•	PageBreaksBeforeItems;

•	Options (rvoShowPageBreaks).

See also properties of RVStyle:

•	PageBreakColor.


TRichViewEdit.InsertPicture
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertPicture

Inserts picture in the position of caret.

function InsertPicture(const Name: TRVAnsiString; gr: TGraphic;

  VAlign: TRVVAlign): Boolean;

Parameters:

Name – name of this picture item, any string. Name must not contain CR and LF characters. RichView does not use items names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles.

gr – picture to insert. You should create picture yourself, and should not free it (RichViewEdit will do it for you).

VAlign – vertical align of this picture, relative to its line, see TRVVAlign for possible values.

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

If you want this picture to be a hypertext link, use InsertHotPicture instead.

Return value

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

Example (inserting icon from file)

var ico: TIcon;

...

ico := TIcon.Create;

ico.LoadFromFile('My Icon.ico');

MyRichViewEdit.InsertPicture('',ico, rvvaBaseline);

Example 2 (inserting picture of any supported format):

var gr: TGraphic;

    pic: TPicture;

...

if OpenPictureDialog1.Execute then begin

  pic := TPicture.Create;

  try

    pic.LoadFromFile(OpenPictureDialog1.FileName);

    gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));

    gr.Assign(pic.Graphic);

    MyRichViewEdit.InsertPicture('', gr, rvvaBaseline);

  finally

    pic.Free;

  end;

end;

See also methods of TCustomRichView:

•	AddPicture and others.

See also:

•	Inserting items in position of caret;

•	Hypertext in RichView;

•	Item types.


TRichViewEdit.InsertRTFFromFileEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertRTFFromFileEd

Inserts RTF (Rich Text Format) from file FileName in the position of caret.

function InsertRTFFromFileEd(const FileName: String): Boolean;

(Introduced in version 1.5)

Parameters for loading are in TRichView.RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

Method type:  editing-style method for insertion.

Return value:

"successful reading?" (extended information is in TRichView.RTFReadProperties.ErrorCode)

 Unicode note: Text can be imported as Unicode or not, depending on value of RTFReadProperties.UnicodeMode.

See also methods of TRichViewEdit:

•	InsertRTFFromStreamEd;

•	PasteRTF.

See also methods of TRichView:

•	LoadRTF.

See also events of TRichView:

•	OnImportPicture;

•	OnReadHyperlink.

See also:

•	Saving and loading;

•	Inserting items in position of caret.


TRichViewEdit.InsertRTFFromStreamEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertRTFFromStreamEd

Inserts RTF (Rich Text Format) from the Stream in the position of caret.

function InsertRTFFromStreamEd(Stream: TStream): Boolean;

(Introduced in version 1.5)

Parameters for loading are in TRichView.RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

Method type:  editing-style method for insertion.

Return value:

"successful reading?" (extended information is in TRichView.RTFReadProperties.ErrorCode)

 Unicode note: Text can be imported as Unicode or not, depending on value of RTFReadProperties.UnicodeMode.

See also methods of TRichViewEdit:

•	InsertRTFFromFileEd;

•	PasteRTF.

See also methods of TRichView:

•	LoadRTFFromStream.

See also events of TRichView:

•	OnImportPicture;

•	OnReadHyperlink.

See also:

•	Saving and loading;

•	Inserting items in position of caret.


TRichViewEdit.InsertRVFFromFileEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertRVFFromFileEd

Inserts RVF (RichView Format) from the file FileName in the position of caret.

function InsertRVFFromFileEd(const FileName: String):Boolean;

Settings for RVF loading can be changed in the TRichView component editor.

Method type:  editing-style method for insertion.

Return value: "successful reading?"

See also methods of TRichViewEdit:

•	InsertRVFFromStreamEd.

See also methods of TRichView:

•	LoadRVF.

•	See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF insertion);

•	RVFParaStylesReadMode (this method type: RVF insertion).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also:

•	TRichView component editor;

•	Saving and loading;

•	Inserting items in position of caret;

•	RVF.


TRichViewEdit.InsertRVFFromStreamEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertRVFFromStreamEd

Inserts RVF (RichView Format) from the Stream in the position of caret.

function InsertRVFFromStreamEd(Stream: TStream):Boolean;

Settings for RVF loading can be changed in the TRichView component editor.

Method type:  editing-style method for insertion.

Return value: "successful reading?"

See also methods of TRichViewEdit:

•	InsertRVFFromFileEd.

See also methods of TRichView:

•	LoadRVFFromStream;

•	InsertRVFFromStream;

•	AppendRVFFromStream.

•	See also properties:

•	RVFOptions;

•	RVFWarnings;

•	RVFTextStylesReadMode (this method type: RVF insertion);

•	RVFParaStylesReadMode (this method type: RVF insertion).

See also events:

•	OnRVFImageListNeeded;

•	OnRVFControlNeeded;

•	OnRVFPictureNeeded;

•	OnControlAction (ControlAction=rvcaAfterRVFLoad).

See also:

•	TRichView component editor;

•	Saving and loading;

•	Inserting items in position of caret;

•	RVF.


TRichViewEdit.InsertStringTag -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertStringTag, InsertStringATag, InsertStringWTag

The methods Insert text string s with associated Tag in the position of caret.

function InsertStringTag(const s: String; Tag: Integer): Boolean;

function InsertStringATag(const s: TRVAnsiString; Tag: Integer): Boolean;

function InsertStringWTag(const s: TRVUnicodeString; Tag: Integer): Boolean;

(introduced in version 1.6)

Inserted text (one text item) has the current text and current paragraph style.

Methods type:  editing-style method for insertion.

Unlike InsertText:

•	s parameter must not contain CR, LF characters (#13 and #10) and page break character (#12);

•	TAB characters are always replaced with spaces, even if SpacesInTab=0.

•	the inserted string is not merged with surrounding text items, even if it has the same text style and tag.

Do not overuse these methods. Use InsertText when possible.

 Unicode note:

•	InsertStringATag: if the current text style is Unicode, s text will be converted to Unicode (conversion is based on charset of current text style).

•	InsertStringWTag: if the current text style is ANSI, s text will be converted to ANSI (conversion is based on charset of current text style).

•	InsertStringTag works like InsertStringWTag in Delphi/C++Builder 2009 or newer, and like InsertStringATag in the older versions of Delphi/C++Builder.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also methods:

•	InsertText, -A, -W.

See also properties:

•	CurParaStyleNo;

•	CurTextStyleNo.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	Inserting items in position of caret;

•	Tags.


TRichViewEdit.InsertTab
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertTab

Inserts tabulator in the position of caret.

function InsertTab: Boolean;

(introduced in v1.9)

Inserted tabulator has the current text and the current paragraph style.

This method always inserts a tabulator, regardless of RVStyle.SpacesInTab mode.

If RVStyle.SpacesInTab=0, this method does the same work as InsertText(#9).

Method type:  editing-style method for insertion.

Return value:

True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)

See also method of TRichView:

•	AddTab.


TRichViewEdit.InsertText -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertText, InsertTextA, InsertTextW

TRichViewEdit

The methods insert text in the position of caret.

procedure InsertText(const text: String; CaretBefore: Boolean=False);

procedure InsertTextA(const text: TRVAnsiString; CaretBefore: Boolean=False);

procedure InsertTextW(const text: TRVUnicodeString; CaretBefore: Boolean=False);

Inserted text has current text and current paragraph style.

Text may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

InsertTextW supports the Unicode byte order marks characters (if it's present, it must be the first character in text).

If CaretBefore=True, the caret will be positioned before the inserted text after insertion (default positioning is after the text). Set it to True when performing search-and-replace in down-up direction (note: the standard replace dialog does not allow to choose down-up direction) to avoid infinite loop (when replacing, for example, 'a' with 'aa').

Methods type:  editing-style method for insertion.

 Unicode note:

•	InsertTextA: if the current text style is Unicode, text will be converted to Unicode (conversion is based on the charset of the current text style).

•	InsertTextW: if the current text style is ANSI, text will be converted to ANSI (conversion is based on the charset of the current text style).

•	InsertText works like InsertTextW in Delphi/C++Builder 2009+, and like InsertTextA in older versions of Delphi/C++Builder.

See also methods:

•	InsertStringTag, InsertStringATag, InsertStringWTag.

See also properties:

•	CurParaStyleNo;

•	CurTextStyleNo.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	Inserting items in position of caret.


TRichViewEdit.InsertTextFromFile -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.InsertTextFromFile, InsertTextFromFileW

The methods load text file FileName and insert its content in the position of caret. InsertTextFromFile  inserts text from ANSI text files, InsertTextFromFileW inserts text from Unicode (UTF-16) text files.

function InsertTextFromFile(const FileName: String): Boolean;

function InsertTextFromFileW(const FileName: String): Boolean;

Inserted text has current text and current paragraph style.

File may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

InsertTextFromFileW supports the Unicode byte order marks characters (if it's present, it must be the first character in file).

Methods type:  editing-style method for insertion.

 Unicode note:

•	InsertTextFromFile: if the current text style is Unicode, text will be converted to Unicode (conversion is based on the charset of the current text style).

•	InsertTextFromFileW: if the current text style is ANSI, text will be converted to ANSI (conversion is based on the charset of the current text style).

Return value: "Was reading from from the file successful?"

See also methods:

•	InsertOEMTextFromFile;

•	InsertText, -A, -W.

See also methods of TRichView:

•	LoadText, LoadTextW.

See also properties:

•	CurParaStyleNo;

•	CurTextStyleNo.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	Saving and loading;

•	Inserting items in position of caret.


TRichViewEdit.Paste
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Paste

Pastes document from the Clipboard.

procedure Paste;

First, it generates OnPaste event, allowing the programmer to insert data in custom format.

If DoDefault parameter of OnPaste was set to False, Paste finishes.

Next, it tries to paste as RVF, see PasteRVF.

Next, it tries to paste as RTF, see PasteRTF.

If unsuccessful, it tries to paste as text, see PasteTextA and PasteTextW (if the current text style is ANSI, it uses PasteTextA; if Unicode – PasteTextW).

If unsuccessful, it tries to paste image files, see PasteGraphicFile.

If unsuccessful, it tries to paste as picture, see PasteBitmap.

This method is executed automatically when user presses  Ctrl + V  or  Shift + Insert .

Method type:  editing-style method for insertion.

See also methods:

•	CanPaste.

See also:

•	RichView and Clipboard.


TRichViewEdit.PasteBitmap
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.PasteBitmap

Inserts Windows bitmap from the Clipboard in the position of caret

function PasteBitmap(TextAsName: Boolean): Boolean;

This method does nothing if the Clipboard does not contain Windows bitmap;

It inserts a new picture item with bitmap (TBitmap) from the Clipboard; if TextAsName=True and the Clipboard contains text, it sets name of this item to the text from the Clipboard (warning: if you want to save this document to RVF, names of items should not contain CR and LF characters).

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

Return value:

True, if image was inserted.

See also methods:

•	Paste;

•	InsertPicture.

See also:

•	RichView and Clipboard.


TRichViewEdit.PasteGraphicFiles
 TRichView Reference | TRichViewEdit

TRichViewEdit.PasteGraphicFiles

Inserts graphic files from the Clipboard (CF_HDROP format).

function TCustomRichViewEdit.PasteGraphicFiles(

  FileNamesAsNames,StoreFileNames: Boolean): Boolean;

(introduced in version 10)

This method does nothing if the Clipboard does not contain graphic files in CF_HDROP format. This format is copied, for example, by Windows Explorer, or by Internet Explorer, when user copies an image (a link to the file in the browser's cache is copied).

Parameters:

If FileNamesAsNames = True, the full file name is stored in the picture item name.

If StoreFileNames = True, the full file name is is stored in rvespImageFileName extra string property.

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items and extra item string properties are ANSI strings.

Return value:

True, if at least one of pictures was inserted.

See also methods:

•	Paste;

•	InsertPicture.

See also:

•	RichView and Clipboard.


TRichViewEdit.PasteMetafile
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.PasteMetafile

Inserts metafile from the Clipboard in the position of caret

function PasteMetafile(TextAsName: Boolean): Boolean;

This method does nothing if the Clipboard does not contain a Windows metafile.

It inserts a new picture item with metafile (TMetafile) from the Clipboard; if TextAsName=True and the Clipboard contains text, it sets name of this item to the text from the Clipboard (warning: if you want to save this document to RVF, names of items should not contain CR and LF characters).

Method type:  editing-style method for insertion.

 Unicode note: names of non-text items are ANSI strings.

Return value:

True, if image was inserted.

See also methods:

•	Paste;

•	InsertPicture.

See also:

•	RichView and Clipboard.


TRichViewEdit.PasteRTF
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.PasteRTF

Inserts RTF (Rich Text Format) from the Clipboard in the position of caret

procedure PasteRTF;

(Introduced in version 1.5)

This method does nothing if the Clipboard does not contain RTF.

If the Clipboard has RTF, and there was an error during reading, you can get additional information in TRichView.RTFReadProperties.ErrorCode property.

Parameters for loading are in TRichView.RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

If the Clipboard contains HTML format as well, RichViewEdit reads base path for external images from it.

Method type:  editing-style method for insertion.

 Unicode note: Text can be imported as Unicode or not, depending on value of RTFReadProperties.UnicodeMode.

See also methods:

•	CanPasteRTF;

•	InsertRTFFromFileEd;

•	InsertRTFFromStreamEd.

See also:

•	RichView and Clipboard


TRichViewEdit.PasteRVF
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.PasteRVF

Inserts RVF (RichView Format) from the Clipboard in the position of caret

procedure PasteRVF;

This method does nothing if the Clipboard does not contain RVF.

Method type:  editing-style method for insertion.

See also methods:

•	CanPasteRVF;

•	Paste;

•	InsertRVFFromStreamEd.

See also:

•	RichView and Clipboard;

•	RVF.


TRichViewEdit.PasteText -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.PasteText, PasteTextW

These methods Insert text from the Clipboard in the position of caret

procedure PasteText;

procedure PasteTextA;

procedure PasteTextW;

PasteTextA pastes text in CF_TEXT format. PasteTextW pastes text in CF_UNICODETEXT.

In Windows 95/98/ME, CF_TEXT and CF_UNICODETEXT are independent Clipboard formats.

In Windows NT/2000/XP/Vista, Windows automatically converts them to each other, using the language of the keyboard layout that was used at the moment of copying.

These methods do nothing if the Clipboard does not contain ANSI/Unicode text.

Text is inserted in the position of caret, using the current text and paragraph styles.

Text from the Clipboard may contain special characters: CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported. PasteTextW supports the Unicode byte order marks characters (if it's present, it must be the first character).

Methods type:  editing-style method for insertion.

 Unicode note:

•	PasteTextA: if the current text style is Unicode, text from the Clipboard will be converted to Unicode (conversion is based on the charset of the current text style).

•	PasteTextW: if the current text style is ANSI, text from the Clipboard will be converted to ANSI (conversion is based on the charset of the current text style).

•	PasteText works like PasteTextW in Delphi/C++Builder 2009+, and like PasteTextA in the older versions of Delphi/C++Builder.

See also methods:

•	Paste;

•	InsertText, -A, -W.

See also properties:

•	CurParaStyleNo;

•	CurTextStyleNo.

See also properties of TRVStyle:

•	TextStyles;

•	ParaStyles;

•	SpacesInTab.

See also:

•	RichView and Clipboard.


TRichViewEdit.Redo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Redo

Redoes the last undone editing operation.

procedure Redo;

(Introduced in version 1.3)

This method does nothing if there is no operation to redo.

Information about the operation to redo is returned by the methods RedoAction and RedoName.

This method must be called only when the document is formatted.

This method is called when the user presses  Shift + Ctrl + Z  or  Shift + Alt + Backspace .

Method type:  editing-style.

See also:

•	Undo;

•	Undo in RichViewEdit.


TRichViewEdit.RedoAction
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RedoAction

Returns type of the operation to be redone next.

function RedoAction: TRVUndoType;

(Introduced in version 1.3)

See TRVUndoType for the list of operations. If the returned value is rvutCustom, you can use RedoName.

See also:

•	UndoAction;

•	Undo in RichViewEdit.


TRichViewEdit.RedoName
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RedoName

Returns name of the operation to be redone next.

function RedoName: String;

(Introduced in version 1.3)

Returns empty string for the standard undo/redo operations, i.e. all operations but rvutCustom (see RedoAction).

Returns non-empty string only for custom redo action, initiated by BeginUndoCustomGroup.

See also:

•	UndoName;

•	Undo in RichViewEdit.


TRichViewEdit.RemoveCheckpointAtCaret
 TRichView Reference | TRichViewEdit

TRichViewEdit.RemoveCheckpointAtCaret

Deletes checkpoint at the position of caret.

procedure RemoveCheckpointAtCaret;

(introduced in version 10)

This method deletes checkpoint only if the caret is at the beginning of item.

This method deletes the checkpoint that is returned by GetCheckpointAtCaret.

This method is used in conjunction with InsertCheckpoint and GetCheckpointAtCaret. The alternative set of methods is: SetCurrentCheckpointInfo, GetCurrentCheckpoint and RemoveCurrentCheckpoint.

Method type:  editing-style, unlike RemoveCheckpoint.

See also:

•	"Checkpoints".


TRichViewEdit.RemoveCheckpointEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RemoveCheckpointEd

Editing-style method for deleting checkpoint associated with the ItemNo-th item.

procedure RemoveCheckpointEd(ItemNo: Integer);

Method type:  editing-style, unlike RemoveCheckpoint.

See also methods of TRichViewEdit:

•	RemoveCurrentCheckpoint;

•	SetCheckpointInfoEd.

See also methods of TRichView:

•	GetItemCheckpoint;

•	RemoveCheckpoint.

See also:

•	Modifying RichView items;

•	"Checkpoints".


TRichViewEdit.RemoveCurrentCheckpoint
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RemoveCurrentCheckpoint

Deletes checkpoint associated with the item at the position of caret.

procedure RemoveCurrentCheckpoint;

RemoveCurrentCheckpoint is equivalent to TopLevelEditor.RemoveCheckpointEd(TopLevelEditor.CurItemNo).

Method type:  editing-style.

See also methods:

•	GetCurrentCheckpoint;

•	SetCurrentCheckpointInfo;

•	RemoveCheckpointEd.

See also properties:

•	CurItemNo.

See also:

•	Modifying RichView items;

•	"Checkpoints".


TRichViewEdit.RemoveCurrentPageBreak
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RemoveCurrentPageBreak

Removes explicit page break before the item at the position of caret

procedure RemoveCurrentPageBreak;

(Introduced in version 1.2)

The method removes "explicit page break" flag of item at the position of caret (see PageBreaksBeforeItems), if this flag was set.

Method type:  editing-style.

See also:

•	InsertPageBreak.

See also properties of RichView:

•	PageBreaksBeforeItems;

•	Options (rvoShowPageBreaks).

See also properties of RVStyle:

•	PageBreakColor.


TRichViewEdit.RemoveLists
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.RemoveLists

Removes markers (bullets and numbering) from the selected paragraphs.

procedure RemoveLists(ARecursive: Boolean);

(introduced in version 1.7)

Parameter:

ARecursive – reserved for future use. Set it to False.

Method type:  editing-style.

See also:

•	ApplyListStyle;

•	ChangeListLevels.

See also methods of TCustomRichView:

•	SetListMarkerInfo;

•	GetListMarkerInfo.


TRichViewEdit.ResizeControl
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ResizeControl

Resizes control in the ItemNo-th item, and quickly reformats the affected part of the document.

procedure ResizeControl(ItemNo, NewWidth, NewHeight: Integer);

The ItemNo-th item must be of "inserted control" type (rvsComponent), otherwise the method raises ERichViewError exception.

The control's width will be set to NewWidth, height to NewHeight.

Method type:  editing-style.

See also methods:

•	ResizeCurrentControl;

•	SetControlInfoEd;

•	AdjustControlPlacement;

•	GetItemStyle.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types.


TRichViewEdit.ResizeCurrentControl
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.ResizeCurrentControl

Resizes control at the position of caret and quickly reformats the affected part of the document.

procedure ResizeCurrentControl(NewWidth, NewHeight: Integer);

(introduced in version 1.4)

ResizeCurrentControl(...) is equivalent to TopLevelEditor.ResizeControl(TopLevelEditor.CurItemNo, ...).

Method type:  editing-style.

See also methods:

•	ResizeControl;

•	SetControlInfoEd;

•	AdjustControlPlacement;

•	GetItemStyle.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types.


TRichViewEdit.SearchText -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SearchText, SearchTextA, SearchTextW

The methods search for the substring s in the document.

function SearchText(s: String; SrchOptions: TRVESearchOptions): Boolean;

function SearchTextA(s: TRVAnsiString; SrchOptions: TRVESearchOptions): Boolean;

function SearchTextW(s: TRVUnicodeString; SrchOptions: TRVESearchOptions): Boolean;

When found, these methods select substring and move the caret to the end of selection.

The methods start searching from the caret position, up or down depending on SrchOptions.

If rvseoMultiItem is included, the search can match substrings of several text items. If not included, the text is searched in each text item separately. For example, if the document contains the text Hello, the substring 'Hello' can be found only if this option is included, because 'He' and 'llo' belong to different items.

 Unicode note:  The methods allow searching both in ANSI and in Unicode text items. When SearchTextA compares Unicode text with s, the conversion is based on RVStyle.DefCodePage. When SearchTextW compares ANSI text with s, the conversion is based on the character set of the text style. SearchText works like SearchTextW in Delphi/C++Builder 2009 or newer, and like SearchTextA in the older versions.

These methods can be used for search-and-replace operation as well. SearchText selects the found string, InsertText replaces it with the new one. See important note about search and replace in down-up direction in the topic about InsertText.

History and compatibility

Since version 1.2 SearchText can search upwards.

Since version 1.5 SearchText can search whole words (substring must be delimited with characters from Delimiters)

SearchTextW is introduced in version 10.

rvsroMultiItem is introduced in version 12.

Note: There is incompatibility with programs written with the older version of RichView (1.0 – 1.1.4). Now if rvsroDown is not included in SrchOptions, the methods search upwards. In the older versions there was no rvsroDown option, and SearchText searched downwards only.

These methods must be called only when the document is formatted.

Return value:

Is the substring found?

See also:

•	TRichView.SearchText, -A, W;

•	GetRVESearchOptions global function;

•	Searching in RichView and RichViewEdit.


TRichViewEdit.SelectCurrentLine
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SelectCurrentLine

Selects the line containing the caret.

procedure SelectCurrentLine;

(introduced in version 1.6)

The line beginning and ending position may depend on word wrapping.

This method repaints document, moves caret to the end of line and generates OnSelect event.

This method must be called only when the document is formatted.

See also methods:

•	SelectCurrentWord;

•	GetSelText.

See also:

•	Selecting in RichView document.


TRichViewEdit.SelectCurrentWord
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SelectCurrentWord

Selects word at the position of caret. If there is non text item at the caret position, this method does nothing.

procedure SelectCurrentWord;

This method repaints document, moves the caret to the end of word and generates OnSelect event.

"Word" is defined as a part of string between delimiters. Delimiters are listed in Delimiters property.

This method must be called only when the document is formatted.

See also methods:

•	SelectWordAt;

•	GetSelText;

•	SelectCurrentLine.

See also:

•	Selecting in RichView document.


TRichViewEdit.SetBreakInfoEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetBreakInfoEd

An editing-style method for changing properties of the ItemNo-th item of RichView, if this item is a break.

procedure SetBreakInfoEd(ItemNo: Integer; AWidth: Byte;

  AStyle: TRVBreakStyle; AColor: TColor; ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of break type (rvsBreak), otherwise the method raises ERichViewError exception. 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.SetBreakInfoEd (or use SetCurrentBreakInfo).

AWidth – line width (or rectangle height). Must be in range from 1 to 10.

AStyle – visual style of this break, see TRVBreakStyle for possible values.

AColor – line color. If it is equal to clNone, Style.TextStyles[0].Color is used.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetBreakInfo or GetItemTag for this item. The tag can also be set by SetItemTagEd method.

Method type:  editing-style (unlike SetBreakInfo).

Additional item properties are assigned by the methods SetItemExtraIntPropertyEd and SetItemExtraStrPropertyEd.

When possible, use SetCurrentBreakInfo instead of this method.

See also methods of TCustomRichView:

•	GetBreakInfo;

•	GetItemStyle;

•	SetBreakInfo.

See also methods:

•	SetCurrentBreakInfo.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetBulletInfoEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetBulletInfoEd

An editing-style method for changing properties of the ItemNo-th item of RichView, if this item is a bullet or hotspot.

procedure SetBulletInfoEd(ItemNo: Integer; const AName: TRVAnsiString;

  AImageIndex: Integer; AImageList: TCustomImageList; ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of bullet or hotspot type (rvsBullet or rvsHotspot), otherwise the method raises ERichViewError exception. 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.SetBulletInfoEd (or use SetCurrentBulletInfo).

AName – name of bullet, any string without line break (CR, LF) characters. It can also be set using SetItemTextEd method.

AImageList – not used, reserved, set it to nil.

AImageIndex – index of image in image list.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetBulletInfo or GetItemTag for this item. The tag can also be set by SetItemTagEd method.

Method type:  editing-style (unlike SetBulletInfo).

Additional item properties are assigned by the methods SetItemExtraIntPropertyEd and SetItemExtraStrPropertyEd.

 Unicode note: names of non-text items are ANSI strings.

When possible, use SetCurrentBulletInfo instead of this method.

See also methods of TCustomRichView:

•	GetBulletInfo;

•	GetItemStyle;

•	SetBulletInfo.

See also methods:

•	SetCurrentBulletInfo.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCheckpointInfoEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCheckpointInfoEd

An editing-style method for creating new or modifying the existing checkpoint associated with the ItemNo-th item

procedure SetCheckpointInfoEd(ItemNo: Integer; ATag: Integer;

  const AName: String; ARaiseEvent: Boolean);

Parameters

ItemNo – index of the item, from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetCheckpointInfoEd (or use SetCurrentCheckpointInfo). If this item already has a checkpoint, its properties are modified; otherwise, a new checkpoint is created.

ATag – tag of checkpoint; it can be an integer value or a pointer to dynamically allocated string (see rvoTagsArePChars in RichView.Options)

AName – name of the checkpoint, any string without line break (CR, LF) characters.

ARaiseEvent – "raise event" flag; if set, RichView can generate OnCheckpointVisible event for this checkpoint.

Method type:  editing-style (unlike SetCheckpointInfo).

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

When possible, use SetCurrentCheckpointInfo instead of this method.

See also methods of TCustomRichView:

•	GetItemCheckpoint;

•	SetCheckpointInfo.

See also methods:

•	SetCurrentCheckpointInfo.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	"Checkpoints";

•	"Tags".


TRichViewEdit.SetControlInfoEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetControlInfoEd

An editing-style method for changing properties of the ItemNo-th item of RichView, if this item is "inserted control".

procedure SetControlInfoEd(ItemNo: Integer;

  const AName: TRVAnsiString; AVAlign: TRVVAlign;

  ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of control type (rvsComponent), otherwise the method raises ERichViewError exception. 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.SetControlInfoEd (or use SetCurrentControlInfo).

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetItemTextEd method. This is not a Name property of the control!

AVAlign – vertical alignment of this item, see TRVVAlign for possible options.

ATag – tag of the item. Do not confuse with Tag property of the control! If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetControlInfo or GetItemTag for this item. The tag can also be set by  SetItemTagEd method.

Method type:  editing-style (unlike SetControlInfo).

Additional item properties are assigned by the methods SetItemExtraIntPropertyEd and SetItemExtraStrPropertyEd.

 Unicode note: names of non-text items are ANSI strings.

When possible, use SetCurrentControlInfo instead of this method.

See also methods of TCustomRichView:

•	GetControlInfo;

•	GetItemStyle;

•	SetControlInfo.

See also methods:

•	SetCurrentControlInfo;

•	ResizeControl;

•	AdjustControlPlacement.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentBreakInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentBreakInfo

Changes properties for the item at the position of caret, if this item is a break

procedure SetCurrentBreakInfo(AWidth: Byte;

  AStyle: TRVBreakStyle;  AColor: TColor; ATag: Integer);

SetCurrentBreakInfo(...) is equivalent to TopLevelEditor.SetBreakInfoEd(TopLevelEditor.CurItemNo, ...).

This method can be used if CurItemStyle returns rvsBreak.

Parameters:

AWidth – line width (or rectangle height). Must be in range from 1 to 10.

AStyle – visual style of this break, see TRVBreakStyle for possible values.

AColor – line color. If it is equal to clNone, Style.TextStyles[0].Color is used.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetCurrentBreakInfo or GetCurrentTag for this item. The tag can also be set by SetCurrentTag method.

Method type:  editing-style.

Additional item properties are assigned by the methods SetCurrentItemExtraIntProperty and SetCurrentItemExtraStrProperty.

See also methods:

•	GetCurrentBreakInfo;

•	SetBreakInfoEd.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentBulletInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentBulletInfo

Changes properties for the item at the position of caret, if this item is a bullet or hotspot.

procedure SetCurrentBulletInfo(const AName: TRVAnsiString;

  AImageIndex: Integer; AImageList: TCustomImageList;

  ATag: Integer);

SetCurrentBulletInfo(...) is equivalent to TopLevelEditor.SetBulletInfoEd(TopLevelEditor.CurItemNo, ...).

This method can be used if CurItemStyle returns rvsBullet or rvsHotspot.

Parameters:

AName – name of bullet, any string without line break (CR, LF) characters. It can also be set using SetCurrentItemText method.

AImageList – not used, reserved, set it to nil.

AImageIndex – index of image in image list.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetCurrentBulletInfo or GetCurrentTag for this item. The tag can also be set by SetCurrentTag method.

Method type:  editing-style.

Additional item properties are assigned by the methods SetCurrentItemExtraIntProperty and SetCurrentItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	GetCurrentBulletInfo;

•	SetBulletInfoEd.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentCheckpointInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentCheckpointInfo

Creates or modifies checkpoint associated with the item at the position of caret.

procedure SetCurrentCheckpointInfo(ATag: Integer;

  const AName: String; ARaiseEvent: Boolean);

SetCurrentCheckpointInfo(...) is equivalent to TopLevelEditor.SetCheckpointInfoEd(TopLevelEditor.CurItemNo, ...).

If the item at the position of caret already has a checkpoint (see GetCurrentCheckpoint), its properties are modified; otherwise, a new checkpoint is created.

This method is used in conjunction with GetCurrentCheckpoint and RemoveCurrentCheckpoint. The alternative set of methods is: InsertCheckpoint, GetCheckpointAtCaret and RemoveCheckpointAtCaret.

Parameters.

ATag – tag of checkpoint; it can be an integer value or a pointer to dynamically allocated string (see rvoTagsArePChars in RichView.Options)

AName – name of the checkpoint, any string without line break (CR, LF) characters.

ARaiseEvent – "raise event" flag; if set, RichView can generate OnCheckpointVisible event for this checkpoint.

Method type:  editing-style.

 Unicode note: names of checkpoints are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	GetCurrentCheckpoint, RemoveCurrentCheckpoint;

•	InsertCheckpoint, GetCheckpointAtCaret, RemoveCheckpointAtCaret;

•	SetCheckpointInfoEd.

See also properties:

•	CurItemNo.

See also:

•	Modifying RichView items;

•	"Checkpoints";

•	"Tags".


TRichViewEdit.SetCurrentControlInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentControlInfo

Modifies the item at the position of caret, if this item is an inserted control.

procedure SetCurrentControlInfo(const AName: TRVAnsiString;

  AVAlign: TRVVAlign; ATag: Integer);

SetCurrentControlInfo(...) is equivalent to TopLevelEditor.SetControlInfoEd(TopLevelEditor.CurItemNo, ...).

This method can be used if CurItemStyle returns rvsComponent.

Parameters:

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetCurrentItemText method. This is not a Name property of the control!

AVAlign – vertical alignment of this item, see TRVVAlign for possible options.

ATag – tag of the item. Do not confuse with Tag property of the control! If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetCurrentControlInfo or GetCurrentTag for this item. The tag can also be set by SetCurrentTag method.

Method type:  editing-style.

Additional item properties are assigned by the methods SetCurrentItemExtraIntProperty and SetCurrentItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	GetCurrentControlInfo;

•	SetControlInfoEd.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentHotspotInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentHotspotInfo

Modifies the item at the position of caret, if this item is a hotspot.

procedure SetCurrentHotspotInfo(const AName: TRVAnsiString;

  AImageIndex, AHotImageIndex: Integer; AImageList: TCustomImageList;

  ATag: Integer);

SetCurrentHotspotInfo(...) is equivalent to TopLevelEditor.SetHotspotInfoEd(TopLevelEditor.CurItemNo, ...).

This method can be used if CurItemStyle returns rvsHotspot.

Parameters:

AName – name of hotspot, any string without line break (CR, LF) characters. It can also be set using SetCurrentItemText method.

AImageList – not used, reserved, set it to nil..

AImageIndex – index of image in image list.

AImageIndex – index of "hot" image in image list. This image is displayed under the mouse pointer (in TRichView, or in TRichViewEdit in hypertext mode), or when user moves the caret to this item (in TRichViewEdit).

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetCurrentHotspotInfo or GetCurrentTag for this item. The tag can also be set by SetCurrentTag method.

Method type:  editing-style.

Additional item properties are assigned by the methods SetCurrentItemExtraIntProperty and SetCurrentItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	GetCurrentHotspotInfo;

•	SetHotspotInfoEd.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentItemExtraIntProperty
 TRichView Reference | TRichViewEdit

 TCustomRichViewEdit.SetCurrentItemExtraIntProperty

Changes value of additional integer property for the item at the position of caret.

procedure SetCurrentItemExtraIntProperty(Prop: TRVExtraItemProperty;

  Value: Integer; AutoReformat: Boolean);

(introduced in version 1.7)

SetCurrentItemExtraIntProperty(...) is equivalent to TopLevelEditor.SetItemExtraIntPropertyEd(TopLevelEditor.CurItemNo, ...).

This method sets a new Value of the item's property identified by Prop. See TRVExtraItemProperty for the list of available integer properties.

If AutoReformat=True, this method automatically reformats document and calls OnChange.

If AutoReformat=False (this can be useful if you set several properties of item at once), you need to call it between calls of BeginItemModify and EndItemModify, and call Change after.

Method type:  editing-style.

See also methods:

•	GetCurrentItemExtraIntProperty;

•	SetItemExtraIntPropertyEd;

•	SetCurrentItemExtraStrProperty;

See also methods of TCustomRichView:

•	SetItemExtraIntProperty.


TRichViewEdit.SetCurrentItemExtraStrProperty
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentItemExtraStrProperty

Changes value of additional string property for the item at the position of caret

procedure SetCurrentItemExtraStrProperty(Prop: TRVExtraItemStrProperty;

  const Value: String; AutoReformat: Boolean);

(introduced in version 1.9)

SetCurrentItemExtraStrProperty(...) is equivalent to TopLevelEditor.SetItemExtraStrPropertyEd(TopLevelEditor.CurItemNo, ...).

This method sets a new Value of the item's property identified by Prop. See TRVExtraItemStrProperty for the list of available string properties.

If AutoReformat=True, this method automatically reformats document and calls OnChange.

If AutoReformat=False (this can be useful if you set several properties of item at once), you need to call Change after.

Method type:  editing-style.

 Unicode note: string properties are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	GetCurrentItemExtraStrProperty;

•	SetItemExtraStrPropertyEd;

•	SetCurrentItemExtraIntProperty.

See also methods of TCustomRichView:

•	SetItemExtraStrProperty.


TRichViewEdit.SetCurrentItemText -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentItemText, SetCurrentItemTextA, SetCurrentItemTextW

Changes text of text item or a name of non-text item at the position of caret.

procedure SetCurrentItemText(const s: String);

procedure SetCurrentItemTextA(const s: TRVAnsiString);

procedure SetCurrentItemTextW(const s: TRVUnicodeString);

(Introduced in version 1.4, 1.7)

•	SetCurrentItemText(s) is equivalent to TopLevelEditor.SetItemTextEd(TopLevelEditor.CurItemNo, s).

•	SetCurrentItemTextA(s) is equivalent to TopLevelEditor.SetItemTextEdA(TopLevelEditor.CurItemNo, s).

•	SetCurrentItemTextW(s) is equivalent to TopLevelEditor.SetItemTextEdW(TopLevelEditor.CurItemNo, s).

Parameters:

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 notes:

SetCurrentItemTextA 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).

SetCurrentItemTextW 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).

SetCurrentItemText works like SetCurrentItemTextW in Delphi/C++Builder 2009 or newer, and like SetCurrentItemTextA in the older versions of Delphi/C++Builder.

Methods type:  editing-style.

See also methods:

•	GetCurrentItemText -A -W;

•	SetItemTextEd -A -W.

See also methods of TCustomRichView:

•	SetItemText -A -W.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Obtaining RichView items;

•	Item types;

•	"Tags";

•	Unicode in RichView.


TRichViewEdit.SetCurrentItemVAlign
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentItemVAlign

Changes vertical alignment (position relative to the line) of the item at the position of caret.

procedure SetCurrentItemVAlign(VAlign: TRVVAlign);

(introduced in version 12)

SetCurrentItemVAlign(VAlign) is equivalent to TopLevelEditor.SetItemVAlignEd(TopLevelEditor.CurItemNo, VAlign).

Method type:  editing-style.

This method must not be called if the current item is one of: text items, tables, breaks, tabs, list markers, footnotes and endnotes.

See also methods:

•	GetCurrentItemVAlign;

•	SetItemVAlignEd.

See also properties:

•	CurItemNo.

See also:

•	Modifying RichView items.


TRichViewEdit.SetCurrentPictureInfo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentPictureInfo

Modifies the item at the position of caret, if this item is a picture or hot-picture.

procedure SetCurrentPictureInfo(const AName: TRVAnsiString;

  Agr: TGraphic; AVAlign: TRVVAlign; ATag: Integer);

SetCurrentPictureInfo(...) is equivalent to TopLevelEditor.SetPictureInfoEd(TopLevelEditor.CurItemNo, ...).

This method can be used if CurItemStyle returns rvsPicture.

Parameters:

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetCurrentItemText method.

Agr – graphic object. It must be an unique graphic object (you cannot assign the same graphic object to two or more items) or value returned by GetCurrentPictureInfo.

AVAlign – vertical alignment of the picture.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetCurrentPictureInfo or GetCurrentTag for this item. The tag can also be set by SetCurrentTag method.

Method type:  editing-style.

Additional item properties are assigned by the methods SetCurrentItemExtraIntProperty and SetCurrentItemExtraStrProperty.

 Unicode note: names of non-text items are ANSI strings.

See also methods:

•	GetCurrentPictureInfo;

•	SetPictureInfoEd;

•	SetCurrentItemExtraIntProperty.

See also properties:

•	CurItemNo;

•	CurItemStyle.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetCurrentTag
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetCurrentTag

Changes tag of the item at the position of caret.

procedure SetCurrentTag(ATag: Integer);

SetCurrentTag(Tag) is equivalent to TopLevelEditor.SetItemTagEd(TopLevelEditor.CurItemNo, Tag).

Tag can be an integer value or a pointer to dynamically allocated string, see Tags.

Method type:  editing-style.

See also methods:

•	GetCurrentTag;

•	SetItemTagEd.

See also properties:

•	CurItemNo.

See also:

•	Modifying RichView items;

•	"Tags".


TRichViewEdit.SetHotspotInfoEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetHotspotInfoEd

An editing-style method for changing properties of the ItemNo-th item of RichView, if this item is a hotspot.

procedure SetHotspotInfoEd(ItemNo: Integer; const AName: TRVAnsiString;

  AImageIndex,  AHotImageIndex: Integer;

  AImageList: TCustomImageList; ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of hotspot type (rvsHotspot), otherwise the method raises ERichViewError exception. 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.SetHotspotInfoEd (or use SetCurrentHotspotInfo).

AName – name of hotspot, any string without line break (CR, LF) characters. It can also be set using SetItemTextEd method.

AImageList – not used, reserved, set it to nil..

AImageIndex – index of image in image list.

AImageIndex – index of "hot" image in image list. This image is displayed under the mouse pointer (in TRichView, or in TRichViewEdit in hypertext mode), or when user moves the caret to this item (in TRichViewEdit).

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetHotspotInfo or GetItemTag for this item. The tag can also be set by SetItemTagEd method.

Method type:  editing-style (unlike SetHotspotInfo).

Additional item properties are assigned by the methods SetItemExtraIntPropertyEd and SetItemExtraStrPropertyEd.

 Unicode note: names of non-text items are ANSI strings.

When possible, use SetCurrentHotspotInfo instead of this method.

See also methods of TCustomRichView:

•	GetHotspotInfo;

•	GetItemStyle;

•	SetHotspotInfo.

See also methods:

•	SetCurrentHotspotInfo.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetItemExtraIntPropertyEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetItemExtraIntPropertyEd

An editing-style method for changing value of the specified additional integer property of the ItemNo-th item..

procedure SetItemExtraIntPropertyEd(ItemNo: Integer;
  Prop: TRVExtraItemProperty; Value: Integer;
  AutoReformat: Boolean);

(introduced in version 1.7)

This method sets new Value of the item property identified by Prop. See TRVExtraItemProperty for the list of available integer properties.

ItemNo – index of the item, from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemExtraIntPropertyEd (or use SetCurrentItemExtraIntProperty).

If AutoReformat=True, this method automatically reformats document and calls OnChange.

If AutoReformat=False (this can be useful if you set several properties of item at once), you need to call it between calls of BeginItemModify and EndItemModify, and call Change after.

Method type:  editing-style (unlike SetItemExtraIntProperty).

When possible, use SetCurrentItemExtraIntProperty instead of this method.

See also methods:

•	SetItemExtraStrPropertyEd;

•	SetCurrentItemExtraIntProperty.

See also methods of TCustomRichView:

•	SetItemExtraIntProperty.


TRichViewEdit.SetItemExtraStrPropertyEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetItemExtraStrPropertyEd

An editing-style method for changing value of the specified additional string property of the ItemNo-th item..

procedure SetItemExtraStrPropertyEd(ItemNo: Integer;

  Prop: TRVExtraItemStrProperty; const Value: String;

  AutoReformat: Boolean);

(introduced in version 1.9)

This method sets new Value of the item property identified by Prop. See TRVExtraItemStrProperty for the list of available string properties.

ItemNo – index of the item, from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemExtraStrPropertyEd (or use SetCurrentItemExtraStrProperty).

If AutoReformat=True, this method automatically reformats document and calls OnChange.

If AutoReformat=False (this can be useful if you set several properties of item at once), call Change after it.

Method type:  editing-style (unlike SetItemExtraStrProperty).

When possible, use SetCurrentItemExtraStrProperty instead of this method.

 Unicode note: string properties are Unicode strings for Delphi/C++Builder 2009 or newer, and ANSI strings for older versions of Delphi/C++Builder.

See also methods:

•	SetCurrentItemExtraStrProperty;

•	SetItemExtraIntPropertyEd.

See also methods of TCustomRichView:

•	SetItemExtraStrProperty.


TRichViewEdit.SetItemTagEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetItemTagEd

Changes tag of the ItemNo-th item.

procedure SetItemTagEd(ItemNo: Integer; ATag: Integer);

Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemTagEd (or use SetCurrentTag).

Tag can be an integer value or a pointer to dynamically allocated string, see Tags.

Method type:  editing-style, unlike SetItemTag.

When possible, use SetCurrentTag instead of this method.

See also methods of TCustomRichView:

•	GetItemTag;

•	SetItemTag.

See also methods:

•	SetCurrentTag.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	"Tags".


TRichViewEdit.SetItemTextEd -A -W
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetItemTextEd, SetItemTextEdA, SetItemTextEdW

Editing-methods for changing text of text item or name of non-text item.

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

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

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

(Introduced in version 1.4, 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.SetItemTextEd* (or use SetCurrentItemText*).

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 notes:

SetItemTextEdA 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).

SetItemTextEdW 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).

SetItemTextEd works like SetItemTextEdW in Delphi/C++Builder 2009 or newer, and like SetItemTextEdA in the older versions of Delphi/C++Builder.

Methods type:  editing-style.

See also methods:

•	SetCurrentItemText -A -W.

See also methods of TCustomRichView:

•	GetItemText -A -W;

•	SetItemText -A -W.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	"Tags";

•	Unicode in RichView.


TRichViewEdit.SetItemVAlignEd
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetItemVAlignEd

Changes vertical alignment (position relative to the line) of the ItemNo-th item.

procedure SetItemVAlignEd(ItemNo: Integer; VAlign: TRVVAlign);

(introduced in version 12)

Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetItemVAlignEd (or use SetCurrentItemVAlign).

Method type:  editing-style, unlike SetItemVAlign.

This method must not be called for text items, tables, breaks, tabs, list markers, footnotes and endnotes.

When possible, use SetCurrentItemVAlign instead of this method.

See also methods of TCustomRichView:

•	GetItemVAlign;

•	SetItemVAlign.

See also methods:

•	SetCurrentItemVAlign.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items.


TRichViewEdit.SetPictureInfoEd
 TRichView Reference | TRichViewEdit

 TCustomRichViewEdit.SetPictureInfoEd

An editing-style method for changing properties of the ItemNo-th item of RichView, if this item is a picture or hot-picture.

procedure SetPictureInfoEd(ItemNo: Integer; const AName: TRVAnsiString;

  Agr: TGraphic; AVAlign: TRVVAlign; ATag: Integer);

Parameters:

ItemNo – index of the item. The item must be of picture or hot-picture type (rvsPicture or rvsHotPicture), otherwise the method raises ERichViewError exception. 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.SetPictureInfoEd (or use SetCurrentPictureInfo).

AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetItemTextEd method.

Agr – graphic object. It must be an unique graphic object (you cannot assign the same graphic object to two or more items) or value returned by GetPictureInfo.

AVAlign – vertical alignment of the picture.

ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetPictureInfo or GetItemTag for this item. The tag can also be set by SetItemTagEd method.

Method type:  editing-style (unlike SetPictureInfo).

Additional item properties are assigned by the methods SetItemExtraIntPropertyEd and SetItemExtraStrPropertyEd.

 Unicode note: names of non-text items are ANSI strings.

When possible, use SetCurrentPictureInfo instead of this method.

See also methods of TCustomRichView:

•	GetPictureInfo;

•	GetItemStyle;

•	SetPictureInfo.

See also methods:

•	SetCurrentPictureInfo.

See also properties:

•	ItemCount.

See also:

•	Modifying RichView items;

•	Item types;

•	"Tags".


TRichViewEdit.SetUndoGroupMode
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SetUndoGroupMode

Begins or ends group of editing operations which will be undone/redone as a single operation.

procedure SetUndoGroupMode(GroupUndo: Boolean);

(Introduced in version 1.3)

See Undo in RichViewEdit.

See also methods:

•	BeginUndoGroup;

•	BeginUndoCustomGroup.


TRichViewEdit.Undo
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.Undo

Undoes the last editing operation.

procedure Undo;

(Introduced in version 1.3)

This method does nothing if there is no action to undo.

Information about the operation to redo is returned by the methods UndoAction and UndoName.

This method must be called only when the document is formatted.

This method is called when the user presses  Ctrl + Z  or  Alt + Backspace .

Method type:  editing-style.

See also:

•	Redo;

•	Undo in RichViewEdit.


TRichViewEdit.UndoAction
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.UndoAction

Returns type of operation to be undone next.

function UndoAction: TRVUndoType;

(Introduced in version 1.3)

See TRVUndoType for the list of operations. If the returned value is rvutCustom, you can use UndoName.

See also:

•	RedoAction;

•	Undo in RichViewEdit.


TRichViewEdit.UndoName
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.UndoName

Returns name of operation to be undone next.

function UndoName: String;

(Introduced in version 1.3)

Returns empty string for the standard undo operations, i.e. all operations but rvutCustom (see UndoAction).

Returns non-empty string only for custom undo operation initiated by BeginUndoCustomGroup.

See also:

•	RedoName;

•	Undo in RichViewEdit.


TRichViewEdit.OnCaretGetOut
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnCaretGetOut

Occurs when user presses arrow keys at the beginning/end of document in "outside" direction.

type

  TRVGetOutDirection = (rvdLeft, rvdUp, rvdRight, rvdDown,

    rvdTop, rvdBottom);

  TRVOnCaretGetOutEvent =

    procedure (Sender: TCustomRichViewEdit;

     Direction: TRVGetOutDirection) of object;

property OnCaretGetOut:TRVOnCaretGetOutEvent;

(introduced in version 1.4, 1.5)

Direction	The event happens if...
rvdLeft	User pressed  ←  (or  → , if BiDiMode=rvbdRightToLeft) while the caret is at the beginning of the document
rvdUp	User pressed    while the caret is in the first line of  the document
rvdRight	User pressed  →  (or  ← , if BiDiMode=rvbdRightToLeft) while the caret is at the end of the document
rvdDown	User pressed  ?  while the caret is in the last line of  the document.
rvdTop	User pressed  Ctrl + Home
rvdBottom	User pressed  Ctrl + End
This event can be used to move focus to another control.


TRichViewEdit.OnCaretMove
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnCaretMove

Occurs when the caret is moved to the another position within the document

property OnCaretMove: TNotifyEvent;

(introduced in version 1.5)

Warning: This event may occur when document is not completely formatted! Do not use any methods relying on formatting inside this event, including methods working with selection (for example, do not use SelectionExists here). If you need to update user interface reflecting selection, use OnSelect.

In this event, you can use the following:

•	CurItemNo property;

•	OffsetInCurItem property;

•	GetCurrentLineCol method.


TRichViewEdit.OnChange
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnChange

Occurs when document is changed.

property OnChange: TNotifyEvent;

This event occurs when:

•	user edits document, or

•	calling any [image] editing-style method, or

•	calling Change.

 Viewer-style methods do not generate this event.

See also property:

•	Modified.


TRichViewEdit.OnChanging
 TRichView Reference | TRichViewEdit

 TCustomRichViewEdit.OnChanging

Occurs before editing operations

type

  TRVChangingEvent = procedure (Sender: TCustomRichViewEdit;

    var CanEdit: Boolean) of object;

property OnChanging: TRVChangingEvent;

Set CanEdit to False to prevent editing.

This event occurs when:

•	user tries to edit text, or

•	calling any [image] editing-style method (before changes are actually done).

 Viewer-style methods do not generate this event.

See also:

•	OnChange event;

•	ReadOnly property.


TRichViewEdit.OnCurParaStyleChanged
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnCurParaStyleChanged

Occurs when the index of current paragraph style (value of CurParaStyleNo property) is changed.

property OnCurParaStyleChange: TNotifyEvent;

This event can occur when user moves caret with mouse or keyboard, or when he/she edits document. Some methods of RichViewEdit can also invoke this event.

Use this event to update user interface in your application.

See also properties:

•	CurParaStyleNo.

See also events:

•	OnCurTextStyleChanged.


TRichViewEdit.OnCurTextStyleChanged
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnCurTextStyleChanged

Occurs when the index of current text style (value of CurTextStyleNo property) is changed.

property OnCurTextStyleChange: TNotifyEvent;

This event can occur when user moves caret with mouse or keyboard, or when he/she edits document. Some methods of RichViewEdit can also invoke this event.

Use this event to update user interface in your application.

See also properties:

•	CurTextStyleNo.

See also events:

•	OnCurParaStyleChanged.


TRichViewEdit.OnDrawCustomCaret
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnDrawCustomCaret

Allows to draw a custom caret.

type

  TRVDrawCustomCaretEvent = procedure (Sender: TCustomRichViewEdit; Canvas: TCanvas;

    const Rect: TRect) of object;

property OnDrawCustomCaret: TRVDrawCustomCaretEvent;

(introduced in version 10)

Custom caret is drawn if CustomCaretInterval>0.

OnMeasureCustomCaret event occurs before each call of this event.

Example

This example draws a rectangle/ellipse caret. In combination with the example in OnMeasureCustomCaret topic, it draws rectangle/ellipse around the character to the right of the caret.

procedure TMyForm.MyRichViewEditDrawCustomCaret(Sender: TCustomRichViewEdit;

  Canvas: TCanvas; const Rect: TRect);

const f: Boolean=True;

var r: TRect;

begin

  if f then

    Canvas.Pen.Color := clRed

  else

    Canvas.Pen.Color := clBlue;

  f := not f;

  r := Rect;

  Canvas.Brush.Style := bsClear;

  if f then

    Canvas.Rectangle(r)

  else

    Canvas.Ellipse(r);

end;


TRichViewEdit.OnDropFiles
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnDropFiles

Occurs when dropping files in the editor (as a result of drag&drop operation, for example from Windows Explorer)

type

  TRVDropFilesEvent =

    procedure (Sender: TCustomRichViewEdit;

      Files: TStrings; var FileAction: TRVDropFileAction;

      var DoDefault: Boolean) of object;

  TRVDropFileAction = (rvdfNone, rvdfInsert, rvdfLink);

property OnDropFiles: TRVDropFilesEvent;

(introduced in v1.8)

rvddFiles must be included in AcceptDragDropFormats property, otherwise the editor will not accept files.

Input parameters:

Files – list of names of dropped files.

FileAction = rvdfNone.

DoDefault = True.

Output parameters:

FileAction – operation that you have performed with these files:

•	rvdfNone – nothing,

•	rvdfInsert – the files were inserted,

•	rvdfLink – hyperlinks to the files were inserted.

FileAction is ignored if DoDefault is set to True.

DoDefault – set it to False if you have processed the files yourself in this event. By default, RichViewEdit inserts graphic files, *.RTF, *.RVF, *.TXT.

See the example (how to insert files of all formats supported by Microsoft Office text import converters).

See also:

•	Drag&Drop.


TRichViewEdit.OnItemResize
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnItemResize

Occurs after resizing image, control or table with the mouse.

type

  TRVItemResizeEvent = procedure(Sender: TCustomRichViewEdit;

    RVData: TCustomRVFormattedData; ItemNo, Val1, Val2: Integer) of object;

property OnItemResize: TRVItemResizeEvent;

(introduced in version 10)

Parameters:

RVData and ItemNo identify the resized item. RVData – document containing this item; it can be Sender.RVData, table cell, or RVData of cell inplace-editor. ItemNo – index of this item inside RVData.

(Val1, Val2) are:

•	for images and controls: (-1, -1).

•	for tables: (0, row index) after resizing row, or (1, column index) after resizing columns.


TRichViewEdit.OnItemTextEdit
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnItemTextEdit

Occurs when text item's text is changed as a result of editing operation.

type

  TRVItemTextEditEvent = procedure (Sender: TCustomRichViewEdit;

    const OldText: TRVRawByteString; RVData: TCustomRVData; ItemNo: Integer;

    var NewTag, NewStyleNo: Integer) of object;

property OnItemTextEdit: TRVItemTextEditEvent;

(introduced in version 10)

This event is designed to update tags of hyperlinks.

This event is called when document is not completely formatted, so do not use any methods for changing document or methods requiring formatted document in this event.

Input Parameters:

OldText – the item text before the editing operation. For Unicode items, this is a "raw" Unicode text.

RVData, ItemNo – identify the item. RVData – document containing this item; it can be Sender.RVData, table cell, or RVData of cell inplace-editor. ItemNo – index of this item inside RVData. You can get text after the editing operation using RVData.GetItemTextR(ItemNo).

NewTag – the item tag, the same as RVData.GetItemTag(ItemNo)

NewStyleNo – the item style, index in the collection Style.TextStyles, the same as RVData.GetItemStyle(ItemNo)

Output Parameters:

NewTag – value of tag to assign to this item.

NewStyleNo – style index to assign to this item.


TRichViewEdit.OnMeasureCustomCaret
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnMeasureCustomCaret

Allows to define size and position for custom caret.

type

  TRVMeasureCustomCaretEvent = procedure (Sender: TCustomRichViewEdit;

    var Rect: TRect) of object;

property OnMeasureCustomCaret: TRVMeasureCustomCaretEvent;

(introduced in version 10)

Custom caret is drawn if CustomCaretInterval>0.

This event is called before each call to OnDrawCustomCaret. It allows to set your own size and position for the caret. The default size and position are the same as of the default system caret. The editor stores background under the Rect, it will be restored after the call to OnDrawCustomCaret.

Example

This example defines the custom caret width. For non-text items, or at the end of item, it sets the caret width = default width + 10.For text items, it sets the caret width equal to width of character to the right of the caret.

This example uses TMyForm.Canvas to calculate character width.

procedure TMyForm.MyRichViewEditMeasureCustomCaret(Sender: TCustomRichViewEdit;

  var Rect: TRect);

var s: String;

begin

  Sender := Sender.TopLevelEditor;

  if Sender.CurItemStyle<0 then begin

    inc(Rect.Right, 10);

    exit;

  end;

  if Sender.OffsetInCurItem>=Sender.GetOffsAfterItem(Sender.CurItemNo) then

  begin

    inc(Rect.Right, 10);

    exit;

  end;

  s := Sender.GetItemText(Sender.CurItemNo);

  Canvas.Font.Assign(Sender.Style.TextStyles[Sender.CurItemStyle]);

  Rect.Right := Rect.Right+Canvas.TextWidth(s[Sender.OffsetInCurItem]);

end;


TRichViewEdit.OnOleDragEnter
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnOleDragEnter

OLE drag&drop event. It occurs when the user drags the mouse pointer into the editor. Indicates whether a drop can be accepted, and, if so, the effect of the drop.

type

  TRVOleDragEnterEvent = procedure (Sender: TCustomRichView;

    const DataObject: IDataObject; Shift: TShiftState;

    X, Y: Integer; PossibleDropEffects: TRVOleDropEffects;

    var DropEffect: TRVOleDropEffect) of object;

property OnOleDragEnter: TRVOleDragEnterEvent;

(introduced in version 10)

This is a low level event. Do not use it if you are not familiar with OLE drag&drop.

After calling this event, OnOleDragOver will be called while the user moves the mouse pointer inside the editor. Dragging will be finished either by calling OnOleDrop (successfully) or by calling OnOleDragLeave (canceled, or mouse left the editor).

Input Parameters:

DataObject – dragged data (IDataObject is declared in ActiveX unit).

Shift – keyboard state.

PossibleDropEffects – a list of allowed operations, set of rvdeCopy, rvdeMove, rvdeLink.

DropEffect – operation that the editor would choose by default.

Output Parameters:

DropEffect – operation that you want to perform with the dragged data (one of PossibleDropEffects, or rvdeNone if you do not want to accept it).

See also events:

•	OnOleDragOver;

•	OnOleDragLeave;

•	OnOleDrop.

See also:

•	Drag&drop in TRichView.


TRichViewEdit.OnOleDragLeave
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnOleDragLeave

OLE drag&drop event. It occurs when the user drags the mouse cursor out of the editor or cancels the current drag&drop operation.

property OnOleDragLeave: TNotifyEvent;

(introduced in version 10)

This is a low level event. Do not use it if you are not familiar with OLE drag&drop.

The first event in sequence is OnOleDragEnter, it occurs when the user moves the mouse pointer into the editor while dragging. After that, OnOleDragOver is called while the user moves the mouse inside the editor. Dragging is finished either by calling OnOleDrop (successfully) or by calling this event.

Input Parameters:

DataObject – dragged data (IDataObject is declared in ActiveX unit).

Shift – keyboard state.

PossibleDropEffects – a list of allowed operations, set of rvdeCopy, rvdeMove, rvdeLink.

DropEffect – operation that the editor would choose by default.

Output Parameters:

DropEffect – operation that you want to perform with the dragged data (one of PossibleDropEffects, or rvdeNone if you do not want to accept it).

See also events:

•	OnOleDragEnter;

•	OnOleDragOver;

•	OnOleDrop.

See also:

•	Drag&drop in TRichView.


TRichViewEdit.OnOleDragOver
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnOleDragOver

OLE drag&drop event. It occurs when the user moves the mouse pointer over the editor. Called only if the dragging was accepted in OnOleDragEnter (or automatically by the editor).

type

  TRVOleDragOverEvent = procedure (Sender: TCustomRichView;

    Shift: TShiftState; X, Y: Integer;

    PossibleDropEffects: TRVOleDropEffects;

    var DropEffect: TRVOleDropEffect) of object;

property OnOleDragOver: TRVOleDragOverEvent;

(introduced in version 10)

This is a low level event. Do not use it if you are not familiar with OLE drag&drop.

OnOleDragEnter occurs before this event, with DataObject in parameters. Dragging will be finished either by calling OnOleDrop (successfully) or by calling OnOleDragLeave (canceled, or mouse left the editor).

Input Parameters:

DataObject – dragged data (IDataObject is declared in ActiveX unit).

Shift – keyboard state.

X,Y – mouse cursor coordinates, relative to the top left corner of Sender.

PossibleDropEffects – a list of allowed operations, set of rvdeCopy, rvdeMove, rvdeLink.

DropEffect – operation that the editor would choose by default.

Output Parameters:

DropEffect – operation that you want to perform with the dragged data (one of PossibleDropEffects, or rvdeNone if you do not want to accept it).

See also events:

•	OnOleDragEnter;

•	OnOleDragLeave;

•	OnOleDrop.

See also:

•	Drag&drop in TRichView.


TRichViewEdit.OnOleDrop
 TRichView Reference | TRichViewEdit

TRichViewEdit.OnOleDrop

OLE drag&drop event. It occurs when the user completes drag&drop operation into the editor.This event allows you to insert data in your own format.

type

  TRVOleDropEvent = procedure (Sender: TCustomRichView;

    const DataObject: IDataObject; Shift: TShiftState; X, Y: Integer;

    PossibleDropEffects: TRVOleDropEffects;

    var DropEffect: TRVOleDropEffect; var DoDefault: Boolean) of object;

property OnOleDrop: TRVOleDropEvent;

(introduced in version 10)

This is a low level event. Do not use it if you are not familiar with OLE drag&drop

The first event in sequence is OnOleDragEnter, it occurs when the user moves the mouse pointer into the editor while dragging. After that, OnOleDragOver is called while the user moves the mouse inside the editor. Dragging is finished either by calling this event (successfully) or by calling OnOleDragLeave (canceled, or mouse left the editor).

Input Parameters:

DataObject – dragged data (IDataObject is declared in ActiveX unit).

Shift – keyboard state.

X,Y – mouse cursor coordinates, relative to the top left corner of Sender.

PossibleDropEffects – a list of allowed operations, set of rvdeCopy, rvdeMove, rvdeLink.

DropEffect – operation that the editor would choose by default.

Output Parameters:

DropEffect – the operation that you have performed (one of PossibleDropEffects, or rvdeNone if you canceled the insertion). If it is rvdeMove, it instructs to delete the dragged object from its source location. The value of this parameter is used only if you set DoDefault=False, otherwise the editor does the default processing. If you inserted some data in editor in this event, they are automatically selected afterwards.

Limitation: when dragging from the same editor, it decides by itself whether it should move or copy data, and it ignores DropEffect.

See also events:

•	OnOleDragEnter;

•	OnOleDragOver;

•	OnOleDragLeave;

•	OnDropFiles.

See also:

•	Drag&drop in TRichView';

•	How to make one line, plain text editor.


TRichViewEdit.OnParaStyleConversion
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnParaStyleConversion

Occurs while executing ApplyParaStyleConversion method.

type

  TRVStyleConversionEvent =

    procedure (Sender: TCustomRichViewEdit;

      StyleNo, UserData: Integer; AppliedToText: Boolean;

      var NewStyleNo: Integer) of object;

property OnParaStyleConversion:TRVStyleConversionEvent;

(introduced in version 1.7)

This event allows you to create custom conversion procedure for styles of the selected paragraphs. This event is called for all selected items allowing to change their paragraph style.

It can be useful for implementing commands like "change paragraph alignment", "change paragraph indents", etc.

Parameters:

StyleNo – current paragraph style (index in collection of styles, Style.ParaStyles);

UserData – value passed as a parameter in ApplyParaStyleConversion;

AppliedToText – not used

NewStyleNo – initially equals to StyleNo; assign a new value to this parameter to change paragraph style.

Example:

procedure TMyForm.MyRichViewEditParaStyleConversion(Sender: TCustomRichViewEdit;

  StyleNo, UserData: Integer; AppliedToText: Boolean;

  var NewStyleNo: Integer);

var ParaInfo: TParaInfo;

begin

  // creating paragraph style with the desired attributes

  ParaInfo := TParaInfo.Create(nil);

  try

    ParaInfo.Assign(RVStyle1.ParaStyles[StyleNo]);

    case UserData of

      PARA_ALIGNMENT:

        ParaInfo.Alignment := GetAlignment;

      PARA_INDENTINC:

        begin

          ParaInfo.LeftIndent := ParaInfo.LeftIndent+20;

          if ParaInfo.LeftIndent>1000 then

            ParaInfo.LeftIndent := 1000;

        end;

      PARA_INDENTDEC:

        begin

          ParaInfo.LeftIndent := ParaInfo.LeftIndent-20;

          if ParaInfo.LeftIndent<0 then

            ParaInfo.LeftIndent := 0;

        end;

      PARA_COLOR:

        ParaInfo.Background.Color := ColorDialog1.Color;

      // add your code here....

    end;

    // if such paragraph style already exists, reusing it

    NewStyleNo := RVStyle1.ParaStyles.FindSuchStyle(StyleNo,ParaInfo,RVAllParaInfoProperties);

    if NewStyleNo<0 then begin

      // if not, adding it

      RVStyle1.ParaStyles.Add;

      NewStyleNo := RVStyle1.ParaStyles.Count-1;

      RVStyle1.ParaStyles[NewStyleNo].Assign(ParaInfo);

      RVStyle1.ParaStyles[NewStyleNo].Standard := False;

    end;

  finally

    ParaInfo.Free;

  end;

end;

This example shows how to implement the following commands:

•	change paragraph alignment,

•	increase left indent,

•	decrease left indent,

•	change paragraph background color.

In this code:

•	PARA_*** – user-defined integer constants with unique values; these constants identify commands; they are passed to ApplyParaStyleConversion as UserData;

•	RVStyle1 – TRVStyle component linked with the MyRichViewEdit;

•	ColorDialog1: TColorDialog;

•	GetAlignment – function returning paragraph alignment chosen by the user.

You can see that for new paragraph styles added in this event, Standard property is set to False. It is important, otherwise DeleteUnusedStyles will not be able to delete this style, even if all paragraphs of this style will be removed.

See demos:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

See also:

•	OnStyleConversion.

See also methods:

•	ApplyParaStyleConversion.


TRichViewEdit.OnPaste
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnPaste

Allows to paste data from the Clipboard in custom formats.

type

  TRVPasteEvent =

    procedure (Sender: TCustomRichViewEdit;

               var DoDefault: Boolean) of object;

property OnPaste: TRVPasteEvent;

(introduced in version 1.3)

Occurs before any data are pasted in editor (Paste method, or  Ctrl + V  /  Shift + Insert ).

You can insert data in your own format here and/or forbid default pasting procedure (set DoDefault to False).

Note: see standard priorities of formats for pasting in Paste method.

Example (allowing to paste only one line of plain text):

procedure TMyForm.MyRichViewEditPaste(Sender: TCustomRichViewEdit;

  var DoDefault: Boolean);

var s: String;

begin

  s := Clipboard.AsText;

  if (Pos(#10,s)=0) and (Pos(#13,s)=0) then

    MyRichViewEdit.InsertText(s,False);

  DoDefault := False;

end;

See also:

•	RichView and Clipboard;

•	How to make a plain text editor.


TRichViewEdit.OnSmartPopupClick
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnSmartPopupClick

Occurs when user clicks "smart popup" button.

type

  TRVSmartPopupClickEvent = procedure (Sender: TCustomRichView;

    Button: TCustomControl) of object;

property OnSmartPopupClick: TRVSmartPopupClickEvent;

(introduced in version 10)

This event allows implementing your own effect when clicking "smart popup" button (or on pressing ShortCut). If you use menu, it's not necessary to process this event.


TRichViewEdit.OnStyleConversion
 TRichView Reference | TRichViewEdit

TCustomRichViewEdit.OnStyleConversion

Occurs while executing ApplyStyleConversion method.

type

  TRVStyleConversionEvent =

    procedure (Sender: TCustomRichViewEdit;

     StyleNo, UserData: Integer; AppliedToText: Boolean;

     var NewStyleNo: Integer) of object;

property OnStyleConversion:TRVStyleConversionEvent;

This event allows you to create custom conversion procedure of text styles for the selected text. This event is called for all selected text items allowing to change their text style.

It can be useful to implement commands like "make bold", "apply font", "change text color", etc.

Parameters:

StyleNo – current text style (index in the collection of styles, Style.TextStyles);

UserData – value passed as a parameter in ApplyStyleConversion;

AppliedToText – True, if this event was called for conversion of style of text item; False, if it was called for conversion of the current text style (CurTextStyleNo);

NewStyleNo – initially equals to StyleNo; assign a new value to this parameter to change text style.

Example 1

procedure TMyForm.MyRichViewEditStyleConversion(Sender: TCustomRichViewEdit;

  StyleNo, UserData: Integer; AppliedToText: Boolean;

  var NewStyleNo: Integer);

begin

   if not (AppliedToText and

      (rvprStyleProtect in Style.TextStyles[StyleNo].Protection)) then

    NewStyleNo := UserData;

end;

This example does exactly the same work as ApplyTextStyle, i.e. MyRichViewEdit.ApplyStyleConversion(StyleNo) will be equivalent to MyRichViewEdit.ApplyTextStyle(StyleNo).

You can see that ApplyStyleConversion ignores protection of styles. If you wish to protect them, you should check protection yourself and do not change this style (like in the example above).

Example 2

procedure TMyForm.MyRichViewEditStyleConversion(Sender: TCustomRichViewEdit;

                  StyleNo, UserData: Integer;

                  AppliedToText: Boolean;

                  var NewStyleNo: Integer);

var FontInfo: TFontInfo;

begin

  // creating text style with the desired attributes

  FontInfo := TFontInfo.Create(nil);

  try

    FontInfo.Assign(RVStyle1.TextStyles[StyleNo]);

    case UserData of

      TEXT_BOLD:

        if btnBold.Down then

          FontInfo.Style := FontInfo.Style+[fsBold]

        else

          FontInfo.Style := FontInfo.Style-[fsBold];

      TEXT_ITALIC:

        if btnItalic.Down then

          FontInfo.Style := FontInfo.Style+[fsItalic]

        else

          FontInfo.Style := FontInfo.Style-[fsItalic];

      TEXT_UNDERLINE:

        if btnUnderline.Down then

          FontInfo.Style := FontInfo.Style+[fsUnderline]

        else

          FontInfo.Style := FontInfo.Style-[fsUnderline];

      TEXT_APPLYFONTNAME:

        FontInfo.FontName := FontName;

      TEXT_APPLYFONTSIZE:

        FontInfo.Size     := FontSize;

      TEXT_APPLYFONT:

        FontInfo.Assign(FontDialog1.Font);

      TEXT_COLOR:

        FontInfo.Color := ColorDialog1.Color;

      TEXT_BACKCOLOR:

        FontInfo.BackColor := ColorDialog1.Color;

      // add your code here....

    end;

    // if such text style already exists, reusing it

    NewStyleNo := RVStyle1.TextStyles.FindSuchStyle(StyleNo,FontInfo,RVAllFontInfoProperties);

    if NewStyleNo<0 then begin

      // if not, adding it

      RVStyle1.TextStyles.Add;

      NewStyleNo := RVStyle1.TextStyles.Count-1;

      RVStyle1.TextStyles[NewStyleNo].Assign(FontInfo);

      RVStyle1.TextStyles[NewStyleNo].Standard := False;

    end;

  finally

    FontInfo.Free;

  end;

end;

This example shows how to implement the following commands:

•	make bold/not bold,

•	make italic/not italic,

•	make underlined/not underlined,

•	change font name,

•	change font size,

•	apply font,

•	change text color,

•	change text background color.

In this code:

•	TEXT_*** – user defined integer constants with unique values; these constants identify commands; they are passed to ApplyStyleConversion as UserData;

•	RVStyle1 – TRVStyle component linked with the richview editor;

•	ColorDialog1: TColorDialog;

•	FontDialog1: TFontDialog;

•	btnBold, btnItalic, btnUnderline: TSpeedButton;

•	FontName: String;

•	FontSize: Integer.

See demos:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

See also:

•	OnParaStyleConversion.

See also methods:

•	ApplyStyleConversion.


TRVSmartPopupProperties
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties

Properties   Methods

Properties of "smart popup" buttons (analogs of buttons used for Microsoft Office "smart tags"). Class of TCustomRichViewEdit.SmartPopupProperties.

Unit RVPopup.

Syntax

  TRVSmartPopupProperties = class (TPersistent)

(introduced in version 10)

Hierarchy

TObject

TPersistent

Using

"Smart popups" allow to edit properties of the current (at the position of caret) item. Of course, you can use popup menu instead, but in some cases "smart popups" may be useful (for example, to show to user that some special commands available for the current item). Only one "smart popup" button can be displayed at the same time.

Use TCustomRichViewEdit.OnCaretMove event to set properties of "smart popup" and display the button. The button is displayed when you assign True to TCustomRichViewEdit.SmartPopupVisible. The editor hides this button automatically on document change or clearing. Since "smart popup" works only for the current item, you must ensure that it is displayed for the current item (update or hide it when the caret moves to another item).

The following properties define visual appearance of "smart popup" button:

•	ButtonType;

•	Color, LineColor;

•	HoverColor, HoverLineColor;

•	ImageList, ImageIndex.

Hint is displayed when user moves mouse other the button.

Position defines the button position.

When user clicks the button or presses ShortCut, Menu is displayed (if assigned). Instead of menu, you can process TCustomRichViewEdit.OnSmartPopupClick event to execute a command or display a dialog.


TRVSmartPopupProperties.ButtonType
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.ButtonType

Defines how popup buttons look like in hot (under the mouse pointer) state.

type

  TRVSmartPopupType = (rvsptDropDown, rvsptShowDialog, rvsptSimple);

property ButtonType: TRVSmartPopupType;

Note: TRVSmartPopupType is defined in RVScroll unit.

Type	Meaning	Example
rvsptDropDown	Button width is increased, triangle is shown. Recommended for buttons displaying menu or popup windows.
rvsptShowDialog	Button width is increased, ellipsis is shown. Recommended for buttons displaying dialogs.
rvsptSimple	Button width is not changed. Recommended for buttons executing immediate command.
You can change this property in TCustomRichViewEdit.OnCaretMove (to create the proper button for the item at the position of caret)

Default value:

rvsptDropDown


TRVSmartPopupProperties.Color
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.Color

Background color of button.

property Color: TColor;

Default value:

clWindow

See also:

•	LineColor;

•	HoverColor;

•	HoverLineColor.


TRVSmartPopupProperties.Hint
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.Hint

Contains the text string that can appear when the user moves the mouse over the button.

property Hint: String;

You can change this property in TCustomRichViewEdit.OnCaretMove (to create the proper button for the item at the position of caret)


TRVSmartPopupProperties.HoverColor
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.HoverColor

Background color of the button when it is below the mouse pointer.

property HoverColor: TColor;

Default value:

clInfoBk

See also:

•	Color;

•	LineColor;

•	HoverLineColor.


TRVSmartPopupProperties.HoverLineColor
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.HoverLineColor

Color of button border and the right side sign (ellipsis or triangle) when the button is under the mouse pointer.

property HoverLineColor: TColor;

Default value:

clInfoText

See also:

•	Color;

•	HoverColor;

•	HoverColor.


TRVSmartPopupProperties.ImageIndex
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.ImageIndex

Index of button image in ImageList.

property ImageIndex: Integer;

This image is displayed on button.

You can change this property in TCustomRichViewEdit.OnCaretMove (to create the proper button for the item at the position of caret)

Default value:

0


TRVSmartPopupProperties.ImageList
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.ImageList

Link to image list containing images for buttons.

property ImageIndex: Integer;

The ImageIndex-th image is shown on button.

You can change this property in TCustomRichViewEdit.OnCaretMove (to create the proper button for the item at the position of caret).


TRVSmartPopupProperties.LineColor
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.LineColor

Border color of button.

property LineColor: TColor;

Default value:

clHighlight

See also:

•	Color;

•	HoverColor;

•	HoverLineColor.


TRVSmartPopupProperties.Menu
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.Menu

Link to popup menu to display when user clicks the button or presses ShortCut.

property Menu: TPopupMenu;

Alternatively, you can process TCustomRichViewEdit.OnSmartPopupClick event to execute a command or display a dialog.

You can change this property in TCustomRichViewEdit.OnCaretMove (to create the proper button for the item at the position of caret).


TRVSmartPopupProperties.Position
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.Position

Defines position of smart popup button relative to the current item.

type

  TRVSmartPopupPosition =

    (rvsppTopLeft, rvsppTopRight, rvsppBottomRight, rvsppBottomLeft);

property Position: TRVSmartPopupPosition;

Note: TRVSmartPopupPosition is defined in RVScroll unit.


TRVSmartPopupProperties.ShortCut
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.ShortCut

Specifies the key combination users can type to execute command associated with visible "smart popup" button.

property ShortCut: TShortCut;

The effect of pressing ShortCut is the same as clicking the button.

Default value:

$6028 ( Shift + Ctrl + ? )

See also properties:

•	Menu.

See also events of TCustomRichViewEdit:

•	OnSmartPopupClick.


TRVSmartPopupProperties.SetButtonState
 TRichView Reference | TRichViewEdit | TRVSmartPopupProperties

TRVSmartPopupProperties.SetButtonState

Call SetButtonState(True) to fix the button in the "hot" state. It's useful while you display your own drop down window for the button. Call SetButtonState(False) to return it back to normal.

procedure SetButtonState(Hot: Boolean);

See also events of TCustomRichViewEdit:

•	OnSmartPopupClick.


Moving caret to the beginning of paragraph
 TRichView Reference | TRichViewEdit

Example: Moving caret to the beginning of paragraph

This example shows how to move caret to the beginning of the ParagraphIndex-th paragraph

procedure GoToParagraph(rve: TCustomRichViewEdit; ParagraphIndex: Integer);

var i: Integer;

begin

  for i := 0 to rve.ItemCount-1 do begin

    if rve.IsParaStart(i) then

      dec(ParagraphIndex);

    if ParagraphIndex<0 then begin

      rve.SetSelectionBounds(i, rve.GetOffsBeforeItem(i),

        i, rve.GetOffsBeforeItem(i));

      rve.Invalidate;

      exit;

    end;

  end;

end;

Call:

GoToParagraph(RichViewEdit1, 7);

ParagraphIndex is zero-based.


OnDropFile Example
 TRichView Reference | TRichViewEdit

Example: Using OnDropFiles to accept files of different formats

By default, TRichViewEdit accepts the following types of dropped files:

•	graphics,

•	RVF,

•	RTF,

•	plain text (ANSI).

This example shows how to use OnDropFiles event to insert all these types of files, and all file formats supported by installed Microsoft Office text import converters.

This example assumes that RVOfficeConverter1:TRVOfficeConverter is placed on the form.

procedure TForm1.RichViewEdit1DropFiles(Sender: TCustomRichViewEdit;

  Files: TStrings; var FileAction: TRVDropFileAction;

var DoDefault: Boolean);

  {....................................................}

  { This function inserts one file FileName }

  function InsertFile(const FileName: String): Boolean;

  var pic: TPicture;

  gr: TGraphic;

  Ext: String;

  i: Integer;

  begin

    Result := False;

    try

      // 1. Trying to insert as a graphic

      pic := TPicture.Create;

      try

        pic.LoadFromFile(FileName);

        gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));

        gr.Assign(pic.Graphic);

        Sender.InsertPicture('', gr, rvvaBaseline);

        Result := True;

      except;

      end;

      pic.Free;

      if Result then

        exit;

      // 2. Trying to insert as RTF file

      Ext := LowerCase(ExtractFileExt(FileName));

      if Ext='.rtf' then begin

        Sender.InsertRTFFromFileEd(FileName);

        Result := True;

        exit;

      end;

      // 3. Trying to insert as RVF file

      if Ext='.rvf' then begin

        Sender.InsertRVFFromFileEd(FileName);

        Result := True;

        exit;

      end;

      // 4. Trying to insert as text file

      if Ext='.txt' then begin

        Sender.InsertTextFromFile(FileName);

        Result := True;

        exit;

      end;

      // 5. Trying to insert using office converters

      for i := 0 to RVOfficeConverter1.ImportConverters.Count-1 do

        if Pos(Ext, RVOfficeConverter1.ImportConverters[i].Filter)>0 then

          if RVOfficeConverter1.ImportRTF(FileName, i) then begin

            RVOfficeConverter1.Stream.Position := 0;

            Sender.InsertRTFFromFileEd(RVOfficeConverter1.Stream);

            RVOfficeConverter1.Stream.SetSize(0);

            Result := True;

            exit;

          end;

    except

    end;

  end;

  {....................................................}

var i: Integer;

begin

  for i := 0 to Files.Count-1 do

    InsertFile(Files[i]);

  DoDefault := False;

end;


TDBRichView
 TRichView Reference | TDBRichView

  TDBRichView

Properties   Methods   Events

Use TDBRichView to display hypertext documents stored in database field.

Unit DBRV;

Syntax

TDBRichView = class(TCustomRichView)

DBRichView does not display its content if it is not linked to RVStyle component via Style property.

The most important property settings can be done in the component editor for TRichView. In Delphi (C++Builder) IDE, right click the DBRichView object on the form, choose "Settings" in the context menu.

If the application doesn't require the data-aware capabilities of TDBRichView, use TRichView instead, to conserve system resources.

For editing documents in database fields, use TDBRichViewEdit.

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

TRVScroller

TCustomRichView

Field Type

This component must be linked to BLOB field.

If you use RVF (RichView Format), the database field must have binary BLOB type (i.e. must have ability to store arbitrary binary data, without conversion and filtering of characters). For example, in Paradox Tables it is "Binary", in Microsoft Access tables it is "OLE Object".

You can also use text BLOB field type (memo). Memo fields cannot store binary data, so it is impossible to store documents in RVF format in them (unless you exclude rvfoSaveBinary from RVFOptions).

However, you can use memo fields:

•	to display text or RTF (Rich Text Format) fields,

•	to display text mode RVF  (that was saved with rvfoSaveBinary excluded from RVFOptions).

Starting from Delphi 2006, Unicode memo fields (Field.DataType=ftWideMemo) are supported specially. TDBRichView does not attempt loading RVF from these fields. It tries to load Unicode RTF (RTF code converted from String to WideString) or Unicode text from them.

Supported Data Formats

The supported field formats are:

•	RVF (RichView Format),

•	RTF (Rich Text Format),

•	text,

•	others (using events).

For all field types except for Unicode memos:

1.	OnLoadCustomFormat event occurs.

2.	If this event is not processed, TDBRichView tries to load RVF.

3.	If the field does not contain RVF, it tries to load RTF.

4.	If the field does not contain RTF, it loads plain ANSI text.

For Unicode memos:

1.	OnLoadCustomFormat event occurs.

2.	If this event is not processed, TDBRichView tries to load Unicode RTF (RTF code stored as WideString).

3.	If the field does not contain RTF, it loads plain Unicode text.

Events

OnNewDocument event occurs when creating a new document or before loading an existing one from the field.

When the document is loaded from the field, OnLoadDocument occurs.

OnLoadCustomFormat allows loading documents in custom formats.


TDBRichView.AutoDisplay
 TRichView Reference | TDBRichView

TDBRichView.AutoDisplay

Determines whether to automatically display the contents of field in the TDBRichView control.

property AutoDisplay: Boolean;

If AutoDisplay is True, the TDBRichView control automatically displays new data when the underlying BLOB field changes (such as when moving to a new record).

If AutoDisplay is False, the control shows only the field name whenever the underlying BLOB field changes. To display the data, the user can double-click on the control.

The effect of AutoDisplay is not purely cosmetic. When AutoDisplay is False, if the data changes, the content of TDBRichView document changes to the name of the field (written in the 0th text and paragraph style). Thus, if AutoDisplay is False, applications should be cautious about using the methods for saving contents to ascertain the value of the underlying field.

Calling the LoadField method causes component to update to the current value of the BLOB field. This change will also be reflected in the appearance of the control on screen.

Change the value of AutoDisplay to False if the automatic loading of BLOB fields seems to take too long.


TDBRichView.DataField
 TRichView Reference | TDBRichView

TDBRichView.DataField

Specifies the field from which the TDBRichView control displays data.

property DataField: String;

Use DataField to bind the TDBRichView control to the field in the dataset. To fully specify database field, both the dataset and the field within that dataset must be defined. The DataSource property of the TDBRichView control specifies the dataset which contains the DataField.

Please use only BLOB fields with TDBRichView.


TDBRichView.DataSource
 TRichView Reference | TDBRichView

TDBRichView.DataSource

Links the TDBRichView control to the dataset that contains the field it represents.

property DataSource : TDataSource;

Use DataSource to link the TDBRichView control to the dataset in which the data can be found. To fully specify database field for the DBRichView control, both the dataset and  the field within that dataset must be defined. Use the DataField property to specify the particular field within the dataset.


TDBRichView.Field
 TRichView Reference | TDBRichView

TDBRichVew.Field

Indicates the TField object for the database field the TDBRichView control represents.

property Field : TField;

Read Field to get direct access to the content and properties of the database field.

If you use RVF (RichView Format), the database field must have binary BLOB type (i.e. must have ability to store arbitrary binary data, without conversion and filtering of characters).

Using memo is not recommended (and impossible if you want to save styles, controls, pictures and tables in binary mode, or use Unicode).

However, you can use memo fields:

•	to display text or RTF (Rich Text Format) fields,

•	to display text mode RVF  (that was saved with rvfoSaveBinary excluded from RVFOptions).


TDBRichView.Create
 TRichView Reference | TDBRichView

TDBRichView.Create

A constructor, creates new DBRichView

constructor Create(AOwner: TComponent);override;

Use Create to instantiate DBRichView at runtime. DBRichViews placed on forms at design time are created automatically. Specify the owner of the new DBRichView using the AOwner parameter.

Important note: initial values of several properties of components created in code may be different from initial values of components placed on form at design time. In the latter case, initial values of these properties can be overridden by the designtime component editor (and overridden by default!)


TDBRichView.Destroy
 TRichView Reference | TDBRichView

TDBRichView.Destroy

A destructor, frees an instance of a DBRichView object.

destructor Destroy;override;

Destroy seldom needs to be called. When DBRichView is constructed without an owner by the Create method, Free should be called to release memory and dispose of the object. Free checks to see if the pointer is nil before calling Destroy.


TDBRichView.LoadField
 TRichView Reference | TDBRichView

TDBRichView.LoadField

LoadField loads the document from the field in the database into the TDBRichView control.

procedure LoadField;

LoadField allows an application to control when the TDBRichView control displays the contents of the BLOB field. Use LoadField to update the document in the TDBRichView control to the value of the field in the current record. LoadField only works when the AutoDisplay property is False, so that the value of the field is not loaded automatically.

Similar to LoadMemo in TDBRichEdit or TDBMemo.


TDBRichView.OnLoadCustomFormat
 TRichView Reference | TDBRichView

TDBRichView.OnLoadCustomFormat

This event allows loading data from field in your own format.

type

  TRVCustomFormatEvent = procedure (Sender: TCustomRichView;

    Stream: TStream; var DoDefault: Boolean) of object;

property OnLoadCustomFormat: TRVCustomFormatEvent;

(introduced in version 10)

Input parameters:

Stream contains data from DataField. Data should be loaded from Stream to Sender.

DoDefault is True.

Output parameters:

If data are loaded successfully, set DoDefault to False, otherwise the component will attempt to load RVF/RTF/text.


TDBRichView.OnLoadDocument
 TRichView Reference | TDBRichView

TDBRichView.OnLoadDocument

Occurs after loading document from the database field

property OnLoadDocument: TNotifyEvent;

(introduced in v1.9)

This event allows to preprocess the loaded document before displaying.

See also:

•	OnNewDocument.


TDBRichView.OnNewDocument
 TRichView Reference | TDBRichView

TDBRichView.OnNewDocument

Occurs when creating or before loading document

property OnNewDocument: TNotifyEvent;

(introduced in v1.9)

Occurs:

•	on creating new document (before displaying field from newly added record);

•	before loading document from the field.

Use this event to assign default values to properties (such as background, margins, styles).

See also:

•	OnLoadDocument.


TDBRichViewEdit
 TRichView Reference | TDBRichViewEdit

 TDBRichViewEdit

Properties   Methods   Events

Use TDBRichView to edit hypertext documents stored in database field.

Unit DBRV;

Syntax

TDBRichViewEdit = class(TCustomRichViewEdit)

DBRichViewEdit does not display or edit its content if it is not linked to RVStyle component via Style property.

The most important property settings can be done in the component editor for TRichView. In Delphi (C++Builder) IDE, right click the DBRichViewEdit object on the form, choose "Settings" in the context menu. If you decide to choose "Allow adding styles dynamically" mode, please set AutoDeleteUnusedStyles to True.

If the application doesn't require the data-aware capabilities of TDBRichViewEdit, use TRichViewEdit instead, to conserve system resources.

If the application doesn't require the editing capabilities of TDBRichViewEdit, use TDBRichView instead, to conserve system resources.

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

TRVScroller

TCustomRichView

TCustomRichViewEdit

Field Type

This component must be linked to BLOB field.

If you use RVF (RichView Format), the database field must have binary BLOB type (i.e. must have ability to store arbitrary binary data, without conversion and filtering of characters). For example, in Paradox Tables it is "Binary", in Microsoft Access tables it is "OLE Object".

You can also use text BLOB field type (memo). Memo fields cannot store binary data, so it is impossible to store documents in RVF format in them (unless you exclude rvfoSaveBinary from RVFOptions).

However, you can use memo fields:

•	to display text or RTF (Rich Text Format) fields,

•	to display text mode RVF  (that was saved with rvfoSaveBinary excluded from RVFOptions).

Starting from Delphi 2006, Unicode memo fields (Field.DataType=ftWideMemo) are supported specially. TDBRichView does not attempt loading RVF from these fields. It tries to load Unicode RTF (RTF code converted from String to WideString) or Unicode text from them.

Supported Data Formats

The supported field formats are:

•	RVF (RichView Format),

•	RTF (Rich Text Format),

•	text,

•	others (using events).

For all field types except for Unicode memos:

1.	OnLoadCustomFormat event occurs.

2.	If this event is not processed, TDBRichView tries to load RVF.

3.	If the field does not contain RVF, it tries to load RTF.

4.	If the field does not contain RTF, it loads plain ANSI text.

For Unicode memos:

1.	OnLoadCustomFormat event occurs.

2.	If this event is not processed, TDBRichView tries to load Unicode RTF (RTF code stored as WideString).

3.	If the field does not contain RTF, it loads plain Unicode text.

Saving data to the field:

OnSaveCustomFormat event allows saving data in your own format. If this event is not processed, documents are saved in FieldFormat.

Events

OnNewDocument event occurs when creating a new document or before loading an existing one from the field.

When the document is loaded from the field, OnLoadDocument occurs.

OnLoadCustomFormat and OnSaveCustomFormat allow saving and loading documents in custom formats.

Examples

Example 1: Using viewer-style methods in DBRichViewEdit (such as LoadRTF)

Example 2: Inserting controls what can modify themselves in DBRichViewEdit (for example, inserting TEdit; user can modify its text)


TDBRichViewEdit.AutoDeleteUnusedStyles
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.AutoDeleteUnusedStyles

If this property is set to True, the editor deletes unused text, paragraph and list styles before posting to the database field.

property TDBRichViewEdit.AutoDeleteUnusedStyles: Boolean;

(introduced in version 1.7)

Assign True to this property only if:

•	this editor uses TRVStyle object exclusively (no other RichViews are linked to this RVStyle via Style property) and

•	collections of text, paragraph and list styles are saved together with documents in the RVF field (see RVFOptions, rvfoSaveTextStyles and rvfoSaveParaStyles must be included)

If FieldFormat is a plain text, this property is ignored,

Default value:

False


TDBRichViewEdit.AutoDisplay
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.AutoDisplay

Determines whether to automatically display the contents of field in the TDBRichViewEdit control.

property AutoDisplay: Boolean;

If AutoDisplay is True, the TDBRichViewEdit control automatically displays new data when the underlying BLOB field changes (such as when moving to a new record).

If AutoDisplay is False, the control shows only the field name whenever the underlying BLOB field changes. To display the data, the user can double-click on the control.

The effect of AutoDisplay is not purely cosmetic. When AutoDisplay is False, if the data changes, the content of TDBRichViewEdit document changes to the name of the field (written in the 0th text and paragraph style). Thus, if AutoDisplay is False, applications should be cautious about using the methods for saving contents to ascertain the value of the underlying field.

Calling the LoadField method causes component to update to the current value of the BLOB field. This change will also be reflected in the appearance of the control on screen.

Change the value of AutoDisplay to False if the automatic loading of BLOB fields seems to take too long.


TDBRichViewEdit.DataField
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.DataField

Specifies the field from which the TDBRichViewEdit control displays data.

property DataField: String;

Use DataField to bind the TDBRichViewEdit control to the field in the dataset. To fully specify database field, both the dataset and the field within that dataset must be defined. The DataSource property of the TDBRichView control specifies the dataset which contains the DataField.

Please use only BLOB fields with TDBRichViewEdit.


TDBRichViewEdit.DataSource
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.DataSource

Links the TDBRichViewEdit control to the dataset that contains the field it represents.

property DataSource : TDataSource;

Use DataSource to link the TDBRichViewEdit control to the dataset in which the data can be found. To fully specify database field for the DBRichViewEdit control, both the dataset and  the field within that dataset must be defined. Use the DataField property to specify the particular field within the dataset.


TDBRichViewEdit.Field
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.Field

Indicates the TField object for the database field the TDBRichViewEdit control represents.

property Field : TField;

Read Field to get direct access to the content and properties of the database field.

If you use RVF (RichView Format), the database field must have binary BLOB type (i.e. must have ability to store arbitrary binary data, without conversion and filtering of characters).

Using memo is not recommended (and impossible if you want to save styles, controls, pictures and tables in binary mode, or use Unicode).

However, you can use memo fields:

•	to display text or RTF (Rich Text Format) fields;

•	to display text mode RVF  (that was saved with rvfoSaveBinary excluded from RVFOptions).


TDBRichViewEdit.FieldFormat
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.FieldFormat

Format for saving data in the database field

property FieldFormat: TRVDBFieldFormat;

type

  TRVDBFieldFormat = (rvdbRVF, rvdbRTF, rvdbText);

(introduced in version 1.6)

This property allows changing the field saving format to RTF or plain text.

Note: It is not guaranteed that document saved in RTF and text will be the same after reloading (some item types, text and paragraph attributes cannot be saved in RTF or plain text).

You can save data in your own format using OnSaveCustomFormat event.

Starting from Delphi 2006, Unicode memo fields (Field.DataType=ftWideMemo) are supported specially. For these fields, if FieldFormat is rvdbRVF or rvdbRTF, documents are stored as Unicode RTF (RTF code converted from String to WideString). If FieldFormat is rvdbText, documents are stored as Unicode text.

Default value:

rvdbRVF


TDBRichViewEdit.IgnoreEscape
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.IgnoreEscape

Disallows processing of  Escape  key

property IgnoreEscape: Boolean;

(introduced in version 1.8)

By default,  Escape  cancels editing in TDBRichViewEdit.

If you set this property to True,  Escape  will do nothing.

Default value:

False


TDBRichViewEdit.ReadOnly
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.ReadOnly

Determines whether the user can use the DBRichVewEdit control to change the value of the field in the current record.

property ReadOnly : Boolean;

Set ReadOnly to True to prevent the user from changing the content of the database field. When ReadOnly is True, the edit control is used only to display the content of the field. If ReadOnly is False, the user can change the field's value as long as the dataset is in edit mode.

Note: TRichViewEdit.ReadOnly property is overridden in TDBRichViewEdit to get/set read-only mode in the linked dataset.


TDBRichViewEdit.Change
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.Change

Generates OnChange event.

procedure Change; override;

TCustomRichViewEdit.Change method was overridden to support data-aware features of TDBRichViewEdit.

In addition to the actions inherited from RichViewEdit, this method also informs the linked dataset that data were modified.

Change can be useful if you need to modify document using [image] viewer-style methods, see the example: Using viewer-style methods in DBRichViewEdit.


TDBRichViewEdit.Create
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.Create

A constructor, creates new DBRichViewEdit.

constructor Create(AOwner: TComponent);override;

Use Create to instantiate DBRichViewEdit at runtime. DBRichViewEdits placed on forms at design time are created automatically. Specify the owner of the new DBRichViewEdit using the AOwner parameter.

Important note: initial values of several properties of components created in code may be different from initial values of components placed on form at design time. In the latter case, initial values of these properties can be overridden by the designtime component editor (and overridden by default!)


TDBRichViewEdit.Destroy
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.Destroy

A destructor, frees an instance of a DBRichViewEdit object

destructor Destroy;override;

Destroy seldom needs to be called. When DBRichViewEdit is constructed without an owner by the Create method, Free should be called to release memory and dispose of the object. Free checks to see if the pointer is nil before calling Destroy.


TDBRichViewEdit.LoadField
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.LoadField

LoadField loads the document from the field in the database into the TDBRichViewEdit control.

procedure LoadField;

LoadField allows an application to control when the TDBRichViewEdit control displays the contents of the BLOB field. Use LoadField to update the document in the TDBRichViewEdit control to the value of the field in the current record. LoadField only works when the AutoDisplay property is False, so that the value of the field is not loaded automatically.

Similar to LoadMemo in TDBRichEdit or TDBMemo.


TDBRichViewEdit.OnLoadCustomFormat
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.OnLoadCustomFormat

This event allows loading data from field in your own format.

type

  TRVCustomFormatEvent = procedure (Sender: TCustomRichView;

    Stream: TStream; var DoDefault: Boolean) of object;

property OnLoadCustomFormat: TRVCustomFormatEvent;

(introduced in version 10)

Input parameters:

Stream contains data from DataField. Data should be loaded from Stream to Sender.

DoDefault is True.

Output parameters:

If data are loaded successfully, set DoDefault to False, otherwise the component will attempt to load RVF/RTF/text.

See also events:

•	OnSaveCustomFormat.


TDBRichViewEdit.OnLoadDocument
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.OnLoadDocument

Occurs after loading document from the database field

property OnLoadDocument: TNotifyEvent;

(introduced in v1.9)

This event allows to preprocess the loaded document before displaying

See also:

•	OnNewDocument.


TDBRichViewEdit.OnNewDocument
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.OnNewDocument

Occurs when creating or before loading document

property OnNewDocument: TNotifyEvent;

(introduced in v1.9)

Occurs:

•	on creating new document (before displaying field from newly added record);

•	before loading document from the field.

Use this event to assign default values to properties (such as background, margins, styles).

See also:

•	OnLoadDocument.


TDBRichViewEdit.OnSaveCustomFormat
 TRichView Reference | TDBRichViewEdit

TDBRichViewEdit.OnSaveCustomFormat

This event allows saving data to field in your own format.

type

  TRVCustomFormatEvent = procedure (Sender: TCustomRichView;

    Stream: TStream; var DoDefault: Boolean) of object;

property OnSaveCustomFormat: TRVCustomFormatEvent;

(introduced in version 10)

Stream is empty initially. Save the content of Sender in Stream and set DoDefault to False,  otherwise the component will save document according to the FieldFormat property.

See also events:

•	OnLoadCustomFormat.


Using viewer-style methods in DBRichViewEdit
 TRichView Reference | TDBRichViewEdit

Example: Using viewer-style methods in DBRichViewEdit

This example shows how to use [image] viewer-style methods in DBRichViewEdit (i.e. methods, introduced in TCustomRichView).

DBRichViewEdit1 edits a field of table Table1.We want to load RTF file.

procedure TForm1.Button1Click(Sender: TObject);

begin

  if OpenDialog1.Execute and DBRichViewEdit1.CanChange then begin

    DBRichViewEdit1.Clear;

    DBRichViewEdit1.LoadRTF(OpenDialog1.FileName);

    DBRichViewEdit1.Change;

    DBRichViewEdit1.Format;

  end;

end;

Calling CanChange has the same effect as calling Table1.Edit.

If you want to save changes in the database immediately, call Table1.Post instead of DBRichViewEdit1.Format.

This sequence of actions (CanChange - modifications - Change - Format) is required only for [image] viewer-style methods.

 Editing-style methods do this work automatically:

procedure TForm1.Button2Click(Sender: TObject);

begin

  if OpenDialog1.Execute then

    DBRichViewEdit1.InsertRTFFromFileEd(OpenDialog1.FileName);

end;


Inserting controls what can modify themselves in DBRichViewEdit
 TRichView Reference | TDBRichViewEdit

Example: Inserting controls what can modify themselves in DBRichViewEdit

This example shows how to work with TEdit inserted in TDBRichViewEdit, if you want to store its text in RVF field.

The problem: when user changes text in TEdit, the dataset is not informed that the document is changed, and these changes are not saved.

In this example, we use DBRichViewEdit1:TDBRichViewEdit placed on Form1.

1) Add in the private section of Form1:

procedure EditChange(Sender: TObject);

Implementation:

procedure TForm1.EditChange(Sender: TObject);

begin

  if DBRichViewEdit1.CanChange then

    DBRichViewEdit1.Change

  else

    Beep;

end;

2) When creating a new TEdit, assign its OnChange event:

var Edit: TEdit;

begin

  Edit := TEdit.Create(nil);

  Edit.OnChange := EditChange;

  DBRichViewEdit1.InsertControl('', Edit, rvvaBaseline);

end;

3) You'll need to assign this event to all edits loaded from the database field with RichView documents. Use OnControlAction of DBRichViewEdit:

procedure TForm1.DBRichViewEdit1ControlAction(Sender: TCustomRichView;

  ControlAction: TRVControlAction; ItemNo: Integer; var ctrl: TControl);

begin

  if (ControlAction=rvcaAfterRVFLoad) and (ctrl is TEdit) then

    TEdit(ctrl).OnChange := EditChange;

end;

And of course, do not forget to register TEdit in the initialization section of unit:

initialization

  RegisterClasses([TEdit]);


TRVPrintPreview
 TRichView Reference | TRVPrintPreview

 TRVPrintPreview

Properties   Methods   Events

This component displays a print preview for TRichView, TRichViewEdit, TDBRichView, or TDBRichViewEdit.

TRVPrintPreview control can display preview only if it is linked to RVPrint, and RVPrint is ready (it has a document assigned and pages formatted)

Unit RVPP;

Syntax

TRVPrintPreview = class(TCustomRVPrintPreview)

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

TRVScroller

TCustomRVPrintPreview

Information

See more info in the topic about the ancestor of TRVPrintPreview, TCustomRVPrintPreview.

The main property of this component is RVPrint, allowing to link it with TRVPrint object.


TRVPrintPreview.RVPrint
 TRichView Reference | TRVPrintPreview

TRVPrintPreview.RVPrint

This property links this preview control to [image] TRVPrint component.

property RVPrint: TRVPrint;

TRVPrintPreview control can display preview only if it is linked to RVPrint, and RVPrint is ready (it has a document assigned and pages formatted).


TRVStyle
 TRichView Reference | TRVStyle

 TRVStyle

Properties   Methods   Events

This invisible at run-time component is used for defining visual appearance of RichView and its descendant components.

Unit RVStyle

Syntax

TRVStyle = class(TComponent)

Hierarchy

TObject

TPersistent

TComponent

Using

If you want to display some document in RichView, associate this RichView with some RVStyle component: create TRVStyle component and assign it to the Style property of RichView. You can do it at design-time using the the Object Inspector.

The same RVStyle object can be used by several RichView, RichViewEdit, DBRichView, DBRichViewEdit controls.

But if you use the following:

•	TCustomRichView.DeleteUnusedStyles;

•	TDBRichViewEdit.AutoDeleteUnusedStyles=True;

•	TCustomRichView.LoadRVF, LoadRVFFromStream, and RVFTextStylesReadMode or RVFParaStylesReadMode <> rvf_sIgnore;

•	TDBRichView or TDBRichViewEdit, and RVFTextStylesReadMode or RVFParaStylesReadMode <> rvf_sIgnore

you must use one RVStyle for one RichView.

Design-Time Component Editor

TRVStyle has a design-time component editor (unit RVSEdit). This editor:

•	adds 3 items into the context menu for component:"Edit Text Styles...", "Edit Paragraph Styles...", "Edit List Styles" which invoke property editors for TextStyles, ParaStyles, or ListStyles;

•	invokes property editor for TextStyles on double-click.

Properties

Three main properties of RVStyle are:

•	TextStyles – collection of text styles (collection of TFontInfo);

•	ParaStyles – collection of paragraph styles (collection of TParaInfo);

•	ListStyles – collection of paragraph list styles (bullets and numbering) (collection of TRVListInfo).

RVStyle allows to set some colors for associated controls:

•	Color – background color;

•	SelColor, InactiveSelColor – background color of selected text (with and without focus);

•	SelTextColor, InactiveSelTextColor – color of selected text (with and without focus);

•	HoverColor – default color of hypertext links under the mouse pointer;

•	CheckpointColor – color of checkpoints (if visible);

•	CheckpointEvColor – color of "RaiseEvent" checkpoints (if visible);

•	PageBreakColor – color of explicit page breaks (if visible);

•	FloatingLineColor – color of placeholders for left- and right-aligned items (if visible).

RVStyle allows to set cursors:

JumpCursor – hypertext cursor for hotspots and hot-pictures (and default cursor for text hypertext items);

LineSelectCursor – cursor for the left margin.

Tabs:

•	SpacesInTab – If positive, Add*** methods of RichView, methods for loading text and RTF, keyboard input will replace tab characters with the specified number of spaces. If 0 (default), a special tabulator item type is used;

•	DefTabWidth – default distance between tab stops.

Properties related to label items and item types inherited from them:

•	FieldHighlightColor – color for highlighting label items.

•	FieldHighlightType specifies when to highlight label items.

•	FootnoteNumbering – numbering type for footnotes.

•	FootnotePageReset – numbering mode for footnotes.

•	EndnoteNumbering – numbering type for endnotes.

Other properties:

•	SelectionStyle – visual appearance of selection;

•	SelectionMode – modes of selection;

•	DefUnicodeStyle – default Unicode text style;

•	DefCodePage – default code page for internal ANSI <->Unicode conversion;

•	UseSound.

Methods

You can save and load all information in RVStyle in ini-file:

•	SaveINI saves RVStyle properties in ini-file;

•	LoadINI loads RVStyle properties from ini-file;

or registry:

•	SaveReg saves RVStyle properties in ini-file;

•	LoadReg loads RVStyle properties from ini-file.

You can export styles in style sheet (for saving HTML files):

•	SaveCSS;

•	SaveCSSToStream.

Events

Custom drawing:

•	OnDrawCheckpoint – drawing checkpoint;

•	OnDrawPageBreak – drawing page break;

•	OnDrawParaBack – drawing background of paragraph;

•	OnDrawTextBack – drawing background of text;

•	OnApplyStyle – applying text style to Canvas;

•	OnApplyStyleColor – applying text style color to Canvas;

•	OnDrawStyleText – drawing text of the given style;

•	OnStyleHoverSensitive – "should the component be repainted when user moves the mouse pointer over hyperlink of the given style?".


TRVStyle.CheckpointColor
 TRichView Reference | TRVStyle

TRVStyle.CheckpointColor

Color of dotted lines showing positions of checkpoints in document.

property CheckpointColor: TColor;

If TRichView shows its checkpoints (rvoShowCheckpoints in TRichView.Options), they are displayed as dotted horizontal lines with a small circle at the top left corner of the associated item.

Normal checkpoints are shown with this color (TRichView.Style.CheckpointColor). Checkpoints with "RaiseEvent" flag are shown with the color TRichView.Style.CheckpointEvColor.

You can draw checkpoints yourself in OnDrawCheckpoint event.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clGreen

See also properties:

•	CheckpointEvColor.

See also events:

•	OnDrawCheckpoint.

See also properties of TCustomRichView:

•	Options.

See also:

•	Checkpoints overview.


TRVStyle.CheckpointEvColor
 TRichView Reference | TRVStyle

TRVStyle.CheckpointEvColor

Color of dotted lines showing positions of checkpoints with "RaiseEvent" flags in document.

property CheckpointEvColor: TColor;

If TRichView shows its checkpoints (rvoShowCheckpoints in TRichView.Options), they are displayed as dotted horizontal lines with a small circle at the top left corner of the associated item.

Normal checkpoints are shown with the color TRichView.Style.CheckpointColor. Checkpoints with "RaiseEvent" flag are shown with this color (TRichView.Style.CheckpointEvColor).

You can draw checkpoints yourself in OnDrawCheckpoint event.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clLime

See also properties:

•	CheckpointColor.

See also events:

•	OnDrawCheckpoint.

See also properties of TCustomRichView:

•	Options.

See also:

•	Checkpoints overview.


TRVStyle.Color
 TRichView Reference | TRVStyle

TRVStyle.Color

Default background color for TRichView component linked to this TRVStyle component.

property Color: TColor;

This property may be overridden with TRichView.Color property.

TRichView must be linked with this TRVStyle (see TRichView.Style).

See also properties of TCustomRichView:

•	Style;

•	Color;

•	BackgroundStyle;

•	BackgroundBitmap.


TRVStyle.CurrentItemColor
 TRichView Reference | TRVStyle

TRVStyle.CurrentItemColor

Color for drawing frame around the current item in TRichViewEdit.

property CurrentItemColor: TColor;

(Introduced in v1.9)

Current item is an item at the position of caret. All RichViewEdit's GetCurrent*** and SetCurrent*** methods work with this item.

Set this property to clNone to disable this effect.

TRichViewEdit must be linked with this TRVStyle (see TRichView.Style).

Default value:

clNone


TRVStyle.DefCodePage
 TRichView Reference | TRVStyle

TRVStyle.DefCodePage

Default code page used inside TRichView for automatic conversions of ANSI strings to Unicode and vice versa

type

  TRVCodePage = type Cardinal;

property DefCodePage: TRVCodePage;

(Introduced in version 1.4)

This property defines the code page (language) which will be used for ANSI<->Unicode conversions.

Usually, if conversion includes only one TRichView text item, the code page for conversion is defined by the character set of the text style. If the conversion is performed on a block of text consisting of several items, TRichView gets a code page for the conversion from this property.

Note: there is a special property editor for this property allowing to select code page from dropdown list.

Default value:

0 (Windows default code page, CP_ACP)

See also:

•	Unicode in RichView.


TRVStyle.DefTabWidth
 TRichView Reference | TRVStyle

TRVStyle.DefTabWidth

Default distance between tab stops, pixels

property DefTabWidth: Integer;

(introduced in v1.9)

Tab stops are started from the LeftMargin (or from the RightMargin for right-to-left paragraphs).

This value is measured in "screen pixels" (when printing, it is recalculated according to the printer resolution).

Note: tabulators can be inserted from text/RTF files or keyboard only if value of SpacesInTab property is 0 (otherwise tabs are inserted as several space characters).

Default value:

48

See also properties:

•	ParaStyles.Tabs.


TRVStyle.DefUnicodeStyle
 TRichView Reference | TRVStyle

TRVStyle.DefUnicodeStyle

Default text style for Unicode operations.

property DefUnicodeStyle: Integer;

(Introduced in version 1.3)

If set to value >=0, RichViewEdit will switch to this style before inserting Unicode text (if the current style is not Unicode).

Examples of such operations: inserting Unicode text (may be from file), pasting Unicode text, inserting data from IME (Input Method Editor).

Warning: be very careful when using this property in applications that store collection of text styles in RVF documents. Value of this property is not stored in RVF! Generally, it not recommended to use this property in the default "allow adding styles dynamically" mode, but it may be useful in "use a predefined set of styles" mode, see TRichView component editor.

Default value:

-1

See also properties:

•	TextStyles.

See also:

•	Unicode in RichView.


TRVStyle.EndnoteNumbering
 TRichView Reference | TRVStyle

TRVStyle.EndnoteNumbering

Numbering type for endnotes.

property EndnoteNumbering: TRVSeqType

(introduced in version 10)

See TRVSeqType for possible values.

Default value:

rvseqLowerRoman


TRVStyle.FieldHighlightColor
 TRichView Reference | TRVStyle

TRVStyle.FieldHighlightColor

Color for highlighting labels, numbered sequences, endnotes, footnotes, references to parent footnotes and endnotes.

property FieldHighlightColor: TColor;

(introduced in version 10)

See FieldHighlightType for details.

Default value:

clBtnFace


TRVStyle.FieldHighlightType
 TRichView Reference | TRVStyle

TRVStyle.FieldHighlightType

Specifies when FieldHighlightColor must be used for highlighting labels, numbered sequences, endnotes, footnotes, references to parent footnotes and endnotes.

type

  TRVFieldHighlightType =

    (rvfhNever, rvfhCurrent, rvfhAlways);

property FieldHighlightType;

(introduced in version 10)

Type	Meaning
rvfhNever	Items are never highlighted.
rvfhCurrent	Item at the position of caret is highlighted.
rvfhAlways	All items are always highlighted.
Default value:

rvfhCurrent


TRVStyle.FloatingLineColor
 TRichView Reference | TRVStyle

TRVStyle.FloatingLineColor

Color for displaying placeholders for left- and right-aligned items.

property FloatingLineColor: TColor;

(introduced in version 12)

Two lines are drawn: a vertical line in place of the placeholder (where this object is inserted), and a line from the top of placeholder to the nearest corner of the floating object.

The lines are displayed in the following cases:

•	in TCustomRichViewEdit, for one item, when this item is current (at the position of the caret)

•	for all side-aligned items, if rvoShowSpecialCharacters is included in Options, and rvcFloatingLines is included in RVVisibleSpecialCharacters

Assign clNone to prevent displaying these lines.

Default value:

$BDA28A


TRVStyle.FootnoteNumbering
 TRichView Reference | TRVStyle

TRVStyle.FootnoteNumbering

Numbering type for footnotes.

property FootnoteNumbering: TRVSeqType;

(introduced in version 10)

See TRVSeqType for possible values.

Default value:

rvseqDecimal


TRVStyle.FootnotePageReset
 TRichView Reference | TRVStyle

TRVStyle.FootnotePageReset

Specifies whether to reset numbering of footnotes on each page.

property FootnotePageReset: Boolean;

(introduced in version 10)

This property affects only printing. Footnotes in TRichView are still numbered sequentially.

This property can be changed when RTF file is loaded, if RichView.RTFReadProperties.IgnoreNotes=False.

Default value:

True


TRVStyle.FullRedraw
 TRichView Reference | TRVStyle

TRVStyle.FullRedraw

For internal use

property FullRedraw: Boolean;

This property is temporal.

If FullRedraw=True, TRichView is redrawn completely when user moves the mouse pointer to the hyperlink area that needs to be highlighted with hovercolor.

If FullRedraw=False, TRichView redraws only the highlighted part (with additional 5 pixels border).

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

False


TRVStyle.HoverColor
 TRichView Reference | TRVStyle

TRVStyle.HoverColor

Default text hover color.

property HoverColor: TColor;

Text hover color is a text color under the mouse pointer.

All hypertext styles have their own hover color (see TFontInfo.HoverColor). If they are equal to clNone, this HoverColor is used.

Set to clNone to disable hover color effect.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clNone


TRVStyle.InactiveSelColor
 TRichView Reference | TRVStyle

TRVStyle.InactiveSelColor

Color of background of selected text in TRichView components (when they do not have focus)

property InactiveSelColor: TColor;

(introduced in version 1.6)

This color is used for:

•	drawing background for the selected text (see also InactiveSelTextColor);

•	shading the selected bullets and hotspots,

•	drawing frame around the selected pictures and controls,

•	drawing background for selected table cells.

Set it to clNone to hide selection when the input focus shifts to another control.

For focused controls, SelColor is used instead.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clHighlight

See also properties:

•	SelColor;

•	InactiveSelTextColor;

•	SelectionStyle.


TRVStyle.InactiveSelTextColor
 TRichView Reference | TRVStyle

TRVStyle.InactiveSelTextColor

Color of selected text in TRichView component (when they do not have focus)

property SelTextColor: TColor;

(introduced in version 1.6)

Set it to clNone to hide selection when the input focus shifts to another control.

For focused controls, SelTextColor is used instead.

Text background color is defined by InactiveSelColor property.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clHighlightText

See also properties:

•	SelTextColor;

•	InactiveSelColor;

•	SelectionStyle.


TRVStyle.InvalidPicture
 TRichView Reference | TRVStyle

TRVStyle.InvalidPicture

Picture that will be inserted when reading RTF or RVF containing invalid or missing pictures.

property InvalidPicture: TPicture;

(Introduced in version 1.7)

Default value:

 (TBitmap)

See also properties of TCustomRichView:

•	RVFWarnings.


TRVStyle.JumpCursor
 TRichView Reference | TRVStyle

TRVStyle.JumpCursor

Mouse cursor for hypertext indication.

property JumpCursor : TCursor

This cursor appears when user moves the mouse pointer to hotspot or hot-picture item. In older versions of TRichView this value was also used for text hypertext items, but now all text styles can have their own hypertext cursors (see TFontInfo.JumpCursor).

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

crJump (101) (system hypertext cursor or [image])

See also:

•	Cursors used by the components of RichView family.


TRVStyle.LineSelectCursor
 TRichView Reference | TRVStyle

TRVStyle.LineSelectCursor

Mouse cursor for line selection

property LineSelectCursor : TCursor

(introduced in v1.8)

This cursor is displayed when the mouse pointer is above the left margin.

This cursor is used in the special text selection mode: line selection. Line selection is started if the user started selecting with the mouse from the left margin.

Line selection does not work for right-to-left documents.

TRichView must be linked with this TRVStyle (see TRichView.Style).

You can disable line selection if you set this property to crNone (-1).

Default value:

 crRVFlipArrow (106)

See also properties of TCustomRichView:

•	LeftMargin.

See also:

•	Cursors used by the components of RichView family.


TRVStyle.ListStyles
 TRichView Reference | TRVStyle

TRVStyle.ListStyles

This is one of the key properties of TRVStyle: collection of paragraph list styles (bullets and numbering).

property ListStyles : TRVListInfos;

Bullets/numbering (lists) are implemented in the following way:

1.	TRVStyle has a collection of list styles (this property). Each list style contains a collection of list levels (Levels property). A list level defines the most of list properties.

2.	List markers is a special type of items. They are inserted with the special functions. They are always inserted at the beginning of paragraphs. They have the following properties:

•	ListNo – index of list style in the collection of list styles (i.e. in this property);

•	LevelNo – list level;

•	StartFrom – starting value for list counter, if UseStartFrom=True;

•	UseStartFrom – if True, list counter value for this marker is defined by StartFrom. If False, numbering is continued.

See also properties:

•	TextStyles;

•	ParaStyles.

See also types:

•	TRVListInfos (collection of list styles);

•	TRVListInfo (item in the collection of list styles).

See also methods of TCustomRichView:

•	SetListMarkerInfo,

•	GetListMarkerInfo.

See also methods of TCustomRichViewEdit:

•	ApplyListStyle,

•	RemoveLists,

•	ChangeListLevels.

See also:

•	List markers item type.


TRVStyle.LiveSpellingColor
 TRichView Reference | TRVStyle

TRVStyle.LiveSpellingColor

Color of live spelling wavy underlines.

property LiveSpellingColor: TColor;

(introduced in v1.9)

Example:

Default value:

clRed

See also:

•	Live spelling check in RichView.


TRVStyle.PageBreakColor
 TRichView Reference | TRVStyle

TRVStyle.PageBreakColor

Color of explicit (user-defined) page breaks in TRichView components.

property PageBreakColor: TColor;

This color is used for drawing horizontal lines (with "folded paper" icon) specifying explicit (user-defined) page breaks. You can change this drawing in OnDrawPageBreak event.

Explicit page breaks are added by assigning True to TRichView.PageBreaksBeforeItems[], or using TRichViewEdit.InsertPageBreak.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clBtnShadow

See also properties:

•	SoftPageBreakColor.

See also events:

•	OnDrawPageBreak.

See also properties of TCustomRichView:

•	Options (rvoShowPageBreaks).


TRVStyle.ParaStyles
 TRichView Reference | TRVStyle

TRVStyle.ParaStyles

This is one of the key properties of TRVStyle: collection of paragraph styles.

property ParaStyles : TParaInfos;

Paragraph styles define paragraph attributes in documents.

See also properties:

•	TextStyles;

•	ListStyles.

See also types:

•	TParaInfos (collection of paragraph styles);

•	TParaInfo (item in collection of paragraph styles).

See also:

•	Paragraphs in RichView.

***


TRVStyle.SelColor
 TRichView Reference | TRVStyle

TRVStyle.SelColor

Color of background of selected text in TRichView components (when they have focus)

property SelColor: TColor;

This color is used for:

•	drawing background for the selected text (see also SelTextColor);

•	shading the selected bullets and hotspots,

•	drawing frame around the selected pictures and controls,

•	drawing background for selected table cells.

For controls without input focus, InactiveSelColor is used instead.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clHighlight

See also properties:

•	SelTextColor;

•	InactiveSelColor;

•	SelectionStyle.


TRVStyle.SelectionMode
 TRichView Reference | TRVStyle

TRVStyle.SelectionMode

Defines how the selection is guided by TRichView components.

property SelectionMode: TRVSelectionMode;

type

  TRVSelectionMode =

   (rvsmChar, rvsmWord, rvsmParagraph);

(introduced in v 1.8)

Selection Mode	Meaning
rvsmChar	No special processing for selection: selection starts where the user pressed the left mouse button, selection ends where the user released it.
rvsmWord	Selecting by words. Selection is smart: you can still select a part of word by moving mouse pointer in backward direction. This mode affects only selecting by moving mouse.
rvsmParagraph	Special selecting mode: if items of multiple paragraphs are selected, the component selects these paragraphs completely. The mode affects selection by moving mouse,  Shift +click, keyboard.
Default value:

rvsmWord


TRVStyle.SelectionStyle
 TRichView Reference | TRVStyle

TRVStyle.SelectionStyle

Defines visual appearance of selection in TRichView components.

property SelectionStyle: TRVSelectionStyle;

type

  TRVSelectionStyle = (rvssItems, rvssLines);

(introduced in v 1.8)

Selection Style	Meaning
rvssItems	Each item draws its selection separately.
rvssLines	The selection looks more like in MS Word (selection has height of the highest item in the line, including spacing); this mode works only if BiDiMode=rvbdUnspecified.
rvssItems:

rvssLines:

Default value:

rvssItems

See also properties:

•	SelTextColor;

•	SelColor;

•	InactiveSelTextColor;

•	InactiveSelColor;

•	SelectionMode.


TRVStyle.SelTextColor
 TRichView Reference | TRVStyle

TRVStyle.SelTextColor

Color of selected text in TRichView components (when they have focus)

property SelTextColor: TColor;

For controls without input focus, InactiveSelTextColor is used instead.

Text background color is defined by SelColor property.

TRichView must be linked with this TRVStyle (see TRichView.Style).

Default value:

clHighlightText

See also properties:

•	SelColor;

•	InactiveSelTextColor;

•	SelectionStyle.


TRVStyle.SpecialCharactersColor
 TRichView Reference | TRVStyle

TRVStyle.SpecialCharactersColor

Color of special characters.

property SpecialCharactersColor: TColor;

(introduced in version 12)

if rvoShowSpecialCharacters is included in TRichView.Options, this color is used for drawing marks denoting space characters and paragraph breaks.

If it equals to clNone, a normal text color is used instead.

Default value:

clNone

See also:

•	RVVisibleSpecialCharacters global typed constant


TRVStyle.SoftPageBreakColor
 TRichView Reference | TRVStyle

TRVStyle.SoftPageBreakColor

Color of soft page breaks in TRichView components.

property PageBreakColor: TColor;

This color is used for drawing horizontal lines (with "folded paper" icon) specifying soft (automatic) page breaks. You can change this drawing in OnDrawPageBreak event.

TRichView must be linked with this TRVStyle (see TRichView.Style). Soft page breaks displaying is turned on by TRichView.AssignPageBreaks.

Default value:

clBtnFace

See also properties:

•	PageBreakColor.

See also events:

•	OnDrawPageBreak.

See also properties of TCustomRichView:

•	Options (rvoShowPageBreaks).


TRVStyle.SpacesInTab
 TRichView Reference | TRVStyle

TRVStyle.SpacesInTab

If set to positive value, TRichView components will replace TAB characters with the specified number of space characters.

property SpacesInTab: SmallInt;

This property is used in all methods of TRichView and TRichViewEdit for adding/inserting multiline text and RTF, or on typing.

TRichView must be linked with this TRVStyle (see TRichView.Style).

If this property is 0, TABs are inserted as a special tabulator item type.

Note: default value is changed to 0 since v1.9

Default value:

0

See also properties:

•	DefTabWidth.


TRVStyle.TextStyles
 TRichView Reference | TRVStyle

TRVStyle.TextStyles

This is one of key properties of TRVStyle: a collection of text styles

property TextStyles : TFontInfos;

Text styles define font and other text attributes in documents.

The first text style in the collection (TextStyles[0]) has some additional meaning:

•	breaks with color = clNone (default value) have the color of this style;

•	Charset of this style is used for saving language information in HTML files (D3+);

•	in some cases this style is used as default, so it's recommended to use it as a style of normal text; please do not set rvprDoNotAutoSwitch in Protection for this style;

•	this style can be hypertext, but it is not recommended.

See also properties:

•	ParaStyles;

•	ListStyles.

See also types:

•	TFontInfos (collection of text styles);

•	TFontInfo (item in collection of text styles).


TRVStyle.UseSound
 TRichView Reference | TRVStyle

TRVStyle.UseSound

Defines whether RichViewEdit will use sound.

property UseSound: Boolean

(introduced in version 1.3)

If True, RichViewEdit plays a system default sound when user tries to modify read-only or protected text.

Default value:

True


TRVStyle.AddTextStyle
 TRichView Reference | TRVStyle

TRVStyle.AddTextStyle (deprecated)

function AddTextStyle: Integer;

Obsolete. In order to add item in collection of text styles, use RVStyle.TextStyles.Add


TRVStyle.Create
 TRichView Reference | TRVStyle

TRVStyle.Create

A constructor, creates a new TRVStyle component.

constructor Create(AOwner: TComponent);override;

Use Create to instantiate TRVStyle component at runtime. TRVStyle components placed on forms at design time are created automatically. Specify the owner of the new RVStyle using the AOwner parameter.


TRVStyle.DeleteTextStyle
 TRichView Reference | TRVStyle

TRVStyle.DeleteTextStyle (deprecated)

procedure DeleteTextStyle(Index: Integer);

Obsolete. In order to delete the i-th item from text styles, use TRVStyle.TextStyles[i].Free


TRVStyle.Destroy
 TRichView Reference | TRVStyle

TRVStyle.Destroy

A destructor, frees an instance of a TRVStyle component,

destructor Destroy;override;

Destroy seldom needs to be called. When TRVStyle is constructed without an owner by the Create method, Free should be called to release memory and dispose the object. Free checks to see if the pointer is nil before calling Destroy.


TRVStyle.GetListStyleClass
 TRichView Reference | TRVStyle

TRVStyle.GetListStyleClass

Returns the class type representing a style of paragraph lists (bullets and numbering).

type

  TRVListInfoClass = class of TRVListInfo;

function GetListStyleClass: TRVListInfoClass; virtual;

(introduced in version 1.7)

This method can be used to create components inherited from TRVStyle. You can create a new class (inherited from TRVListInfo) and use it in this descendant component.

See also:

•	GetParaStyleClass;

•	GetTextStyleClass.


TRVStyle.GetParaStyleClass
 TRichView Reference | TRVStyle

TRVStyle.GetParaStyleClass

Returns the class type representing a style of paragraphs.

type

  TRVParaInfoClass = class of TParaInfo;

function GetParaStyleClass: TRVParaInfoClass; virtual;

(introduced in version 1.7)

This method can be used to create components inherited from TRVStyle. You can create a new class (inherited from TParaInfo) and use it in this descendant component.

See also:

•	GetListStyleClass;

•	GetTextStyleClass.


TRVStyle.GetTextStyleClass
 TRichView Reference | TRVStyle

TRVStyle.GetTextStyleClass

Returns the class type representing a style of text.

type

  TRVFontInfoClass = class of TFontInfo;

function GetTextStyleClass: TRVFontInfoClass; virtual;

(introduced in version 1.7)

This method can be used to create components inherited from TRVStyle. You can create a new class (inherited from TFontInfo) and use it in this descendant component.

See also:

•	GetListStyleClass;

•	GetParaStyleClass.


TRVStyle.LoadINI
 TRichView Reference | TRVStyle

TRVStyle.LoadINI

Loads all properties of TRVStyle component from ini-file

procedure LoadINI(const FileName, Section: String);

Parameters:

FileName – name of the ini-file;

Section – section of the ini-file.

See also:

•	SaveINI;

•	LoadReg.


TRVStyle.LoadReg
 TRichView Reference | TRVStyle

TRVStyle.LoadReg

Loads all properties of TRVStyle component from the Registry (for Delphi4+).

procedure LoadReg(const BaseKey: String);

(Introduced in version 1.2)

Parameter:

BaseKey – the name of the HKEY_CURRENT_USER subkey to loads data from. LoadReg appends 'RVStyle' to this subkey. For example, if BaseKey is 'Software\My Company\My Program', it loads data from the 'Software\My Company\My Program\RVStyle' key.

Warning: these data in this section (BaseKey+'\RVStyle') must exists, otherwise all properties will be reset to default values.

See also:

•	SaveReg;

•	LoadINI.


TRVStyle.SaveCSS
 TRichView Reference | TRVStyle

TRVStyle.SaveCSS

Saves text and paragraph styles as CSS (Cascading Style Sheets) file.

type

  TRVSaveCSSOption = (

    rvcssOnlyDifference, rvcssIgnoreLeftAlignment,

    rvcssNoDefCSSStyle, rvcssUTF8, rvcssDefault0Style);

  TRVSaveCSSOptions = set of TRVSaveCSSOption;

function SaveCSS(const FileName: String;

  Options: TRVSaveCSSOptions): Boolean;

Use this method if you want to save content of TRichView as HTML file (RichView.SaveHTMLEx) with external CSS.

You can save CSS only once and use it for several HTML files (if they are linked to the same or compatible RVStyle components) .

This method allows to reduce size of HTML files.

The following options may be included in the Options parameter.

Option	Meaning
rvcssNoDefCSSStyle	Corresponds to rvsoNoDefCSSStyle in the Options parameters of SaveHTMLEx. It's not recommended to use this option.
rvcssDefault0Style	Properties of TextStyles[0] are not saved. Corresponds to rvsoDefault0Style in the Options parameter of SaveHTMLEx.
rvcssUTF8	CSS is saved in UTF-8 encoding.
Please do not use other options.

There are no methods for loading CSS files.

See also:

•	RichView work with HTML files.


TRVStyle.SaveCSSToStream
 TRichView Reference | TRVStyle

TRVStyle.SaveCSSToStream

The same as SaveCSS, but accepts Stream parameter

procedure SaveCSSToStream(Stream: TStream; Options: TRVSaveCSSOptions);

(introduced in v1.1.4)


TRVStyle.SaveINI
 TRichView Reference | TRVStyle

TRVStyle.SaveINI

Saves all properties of TRVStyle component in the ini-file

procedure SaveINI(const FileName, Section: String);

Parameters:

FileName – name of the ini-file;

Section – section of the ini-file

Warning: the section is cleared before saving.

Alternative way to store/load TRVStyle: using TStream.WriteComponent and ReadComponent.

See also:

•	LoadINI;

•	SaveReg;

•	SaveCSS.


TRVStyle.SaveReg
 TRichView Reference | TRVStyle

TRVStyle.SaveReg

Saves all properties of component to the Registry (for Delphi4+)

procedure SaveReg(const BaseKey: String);

(Introduced in version 1.2)

Parameter:

BaseKey – the name of the HKEY_CURRENT_USER subkey to saves data to. SaveReg appends 'RVStyle' to this subkey. For example, if BaseKey is 'Software\My Company\My Program', the method saves data to the 'Software\My Company\My Program\RVStyle' key.

Warning: all data in this key (BaseKey+'\RVStyle') will be removed before saving!

The saving format is the same as in SaveINI.

See also:

•	LoadReg;

•	SaveINI.


TRVStyle.OnAfterApplyStyle
 TRichView Reference | TRVStyle

TRVStyle.OnAfterApplyStyle

Occurs after RichView applies attributes of the StyleNo-th style to Canvas.

property OnAfterApplyStyle: TRVAfterApplyStyleEvent;

type

  TRVApplyStyleEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      StyleNo: Integer) of object;

(introduced in version 12)

In this event you can apply font (excluding colors) for the text style StyleNo to Canvas. Nothing should be drawn inside this event.

This event is similar to OnApplyStyle, but occurs after the default procedure. This event does not occur if OnApplyStyle returned False in DoDefault parameter.

Input parameters:

Sender – TRVStyle generating this event;

Canvas – canvas for applying font attributes to.

See also:

•	OnApplyStyleColor;

•	OnDrawStyleText.

See also properties:

•	TextStyles.


TRVStyle.OnApplyStyle
 TRichView Reference | TRVStyle

TRVStyle.OnApplyStyle

Occurs when RichView applies attributes of the StyleNo-th style to Canvas.

property OnApplyStyle: TRVApplyStyleEvent;

type

  TRVApplyStyleEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      StyleNo: Integer; var DoDefault: Boolean) of object;

(introduced in version 1.3)

In this event you can apply font (excluding colors) for the text style StyleNo to Canvas.

Nothing should be drawn inside this event.

Input parameters:

Sender – TRVStyle generating this event;

Canvas – canvas for applying font attributes to.

DoDefault is equal to True.

Output parameters:

DoDefault – set to False to prevent the default style applying procedure and OnAfterApplyStyle event.

See also:

•	OnApplyStyleColor;

•	OnDrawStyleText.

See also properties:

•	TextStyles.


TRVStyle.OnApplyStyleColor
 TRichView Reference | TRVStyle

TRVStyle.OnApplyStyleColor

Occurs when RichView applies the color of the StyleNo-th style to Canvas.

property OnApplyStyleColor: TRVApplyStyleColorEvent;

type

  TRVApplyStyleColorEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      StyleNo: Integer; DrawState: TRVTextDrawStates;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

In this event you can apply font color for the StyleNo-th text style to Canvas.

Nothing should be drawn inside this event.

Input parameters:

Sender – TRVStyle generating this event.

Canvas – canvas for applying background and text colors to.

DrawState – states of this text item, see TRVTextDrawStates.

DoDefault is equal to True.

Output parameters:

DoDefault – set to False to prevent the default colors applying procedure.

See also:

•	OnApplyStyle;

•	OnDrawStyleText.

See also properties:

•	TextStyles.


TRVStyle.OnDrawCheckpoint
 TRichView Reference | TRVStyle

TRVStyle.OnDrawCheckpoint

Occurs when drawing checkpoint.

property OnDrawCheckpoint: TRVDrawCheckpointEvent;

type

  TRVDrawCheckpointEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      X,Y, ItemNo, XShift: Integer;

      RaiseEvent: Boolean; Control: TControl;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

You can use this event to draw your own visual representation of checkpoints.

This event occurs only if rvoShowCheckpoints is included in TCustomRichView(Control).Options.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

X,Y – coordinates of the top left corner of the item marked with this checkpoint. If this is the last checkpoint in document (that is not associated with any item), X = -1.

ItemNo – index of this item in Sender.RVData. (ItemNo = -1 for checkpoint without item).

XShift – how much TRichView is scrolled horizontally (>=0);

RaiseEvent – "raise event" flag of the checkpoint.

Control – TRichView control.

DoDefault is equal to True.

"Hidden" input parameter:

Sender.RVData: TPersistent, document containing the item with this checkpoint. It should be typecasted to TCustomRVFormattedData before using.

Output parameters:

DoDefault – set to False to prevent default drawing. The default procedure draws horizontal dotted line with small circle in (X,Y). The line color is either CheckpointColor or CheckpointEvColor, depending on RaiseEvent.

Using ItemNo and Sender.RVData you can get additional information about the item and the checkpoint.

For example:

uses ..., CRVFData;

...

var

  CheckpointData: TCheckpointData;

  CheckpointTag: Integer;

  CheckpointName: String;

begin

  if ItemNo>=0 then

  begin

    CheckpointData :=

      TCustomRVFormattedData(Sender.RVData).GetItemCheckpoint(ItemNo));

    TCustomRVFormattedData(Sender.RVData).GetCheckpointInfo(

      CheckpointTag, CheckpointName, RaiseEvent);

    ...

  end;

end;

See also properties:

•	CheckpointColor;

•	CheckpointEvColor.

See also:

•	Checkpoints overview.

Demo project:

•	Demos\Delphi\Assorted\Custom Draw\CustomDraw\

•	Demos\CBuilder\Assorted\Custom Draw\CustomDraw\


TRVStyle.OnDrawPageBreak
 TRichView Reference | TRVStyle

TRVStyle.OnDrawPageBreak

Occurs when drawing page breaks.

property OnDrawPageBreak: TRVDrawPageBreakEvent;

type

  TRVPageBreakType = (rvpbSoftPageBreak, rvpbPageBreak);

  TRVDrawPageBreakEvent =

    procedure (Sender: TRVStyle;

      Canvas: TCanvas;

      Y, XShift: Integer;

      PageBreakType: TRVPageBreakType;

      Control: TControl;

      var DoDefault: Boolean) of object;

(introduced in version 1.3; modified in 1.7)

You can use this event to draw your own visual representation of page breaks.

This event occurs only if rvoShowPageBreaks is included in TCustomRichView(Control).Options.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

PageBreakType – type of page break (either soft (automatic) page break or explicit (user-defined) page break).

Y – y coordinate of page break in TRichView window.

XShift – how much TRichView is scrolled horizontally (>=0).

Control – TRichView control.

DoDefault is equal to True.

"Hidden" input parameters:

Sender.RVData: TPersistent, document where page break occurs. It should be typecasted to TCustomRVFormattedData before using.

Sender.ItemNo: Integer, index of the item in Sender.RVData.

These parameters define one of the following:

•	item starting a new page;

•	table with page breaks between rows.

Output parameter:

DoDefault – set to False to prevent default drawing. The default procedure draws horizontal line horizontal line with "dog-ear" effect. The line color is either PageBreakColor or SoftPageBreakColor, depending on PageBreakType.

Using Sender.RVData you can get additional information about the item:

For example:

uses ..., CRVFData;

...

var ParaNo: Integer;

begin

  ParaNo := TCustomRVFormattedData(Sender.RVData).GetItemPara(Sender.ItemNo));

  ...

end;

See also properties:

•	PageBreakColor;

•	SoftPageBreakColor.

See also properties of TCustomRichView:

•	PageBreaksBeforeItem.

See also methods of TCustomRichView:

•	AssignSoftPageBreaks.

See also methods of TCustomRichViewEdit:

•	InsertPageBreak;

•	RemoveCurrentPageBreak.

See also properties of table:

•	PrintOptions.

See also properties of table row:

•	PageBreakBefore.

Demo project:

•	Demos\Delphi\Assorted\Custom Draw\CustomDraw\

•	Demos\CBuilder\Assorted\Custom Draw\CustomDraw\


TRVStyle.OnDrawParaBack
 TRichView Reference | TRVStyle

TRVStyle.OnDrawParaBack

Occurs when painting a background of paragraph of the ParaNo-th style.

property OnDrawParaBack: TRVDrawParaRectEvent;

type

  TRVDrawParaRectEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      ParaNo: Integer; ARect: TRect;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

You can use this event to draw your own background and/or border for some or all paragraphs.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

ARect – rectangle where to paint.

ParaNo – index in the collection of paragraph styles (ParaStyles).

DoDefault is equal to True.

"Hidden" input parameters:

Sender.RVData: TPersistent, document containing this paragraph. It should be typecasted to TCustomRVFormattedData before using.

Sender.ItemNo: Integer, index of the last item in the paragraph, in Sender.RVData.

Output parameters:

DoDefault – set to False to prevent default drawing.

See also properties:

•	ParaStyles;

•	TParaInfo.Background.

See also:

•	RichView Paragraphs.

Demo project:

•	Demos\Delphi\Assorted\Custom Draw\CustomDraw\

•	Demos\CBuilder\Assorted\Custom Draw\CustomDraw\


TRVStyle.OnDrawStyleText
 TRichView Reference | TRVStyle

TRVStyle.OnDrawStyleText

Allows to perform custom drawing of text item of the StyleNo-th text style.

property OnDrawStyleText: TRVDrawStyleTextEvent

type

  TRVDrawStyleTextEvent =

    procedure (Sender: TRVStyle; const s: TRVRawByteString;

      Canvas: TCanvas; StyleNo: Integer;

      SpaceBefore, Left, Top, Width, Height: Integer;

      DrawState: TRVTextDrawStates;

      var DoDefault: Boolean) of object;

(introduced in version 1.3; new states in TRVTextDrawStates since 1.4)

You can use this event to modify drawing of text of some or all text styles.

Input parameters:

Sender – TRVStyle generating the event.

s – text to draw. For Unicode text styles, this is "raw Unicode".

Canvas – canvas to paint.

StyleNo – index of text style in TextStyles collection.

Background (if exists) should fill the rectangle Left, Top, Width, Height. Text should be drawn at the position (Left+SpaceBefore, Top). SpaceBefore is positive for justify-aligned paragraphs.

DrawState – states of this text item, see TRVTextDrawStates.

DoDefault is equal to True.

"Hidden" input parameters:

Sender.RVData: TPersistent, document containing this paragraph. It should be typecasted to TCustomRVFormattedData before using.

Sender.ItemNo: Integer, index of the item in Sender.RVData.

Self.OffsetInItem: Integer, index of the first character in the item to draw.

These parameters allow to get additional information about the item being painted.

For example:

uses ..., CRVFData;

...

var ItemTag: Integer;

...

ItemTag := TCustomRVFormattedData(Sender.RVData).GetItemTag(Sender.ItemNo));

Output parameters:

DoDefault – set to False to prevent default drawing.

See also events:

•	OnApplyStyle;

•	OnApplyStyleColor;

•	OnDrawTextBack.

See also properties:

•	TextStyles.

Demo projects:

•	Demos\Delphi\Assorted\Custom Draw\

•	Demos\CBuilder\Assorted\Custom Draw\


TRVStyle.OnDrawTextBack
 TRichView Reference | TRVStyle

TRVStyle.OnDrawTextBack

Occurs when drawing background of text of the StyleNo-th text style.

property OnDrawTextBack: TRVDrawTextBackEvent;

type

  TRVDrawTextBackEvent =

    procedure (Sender: TRVStyle; Canvas: TCanvas;

      StyleNo: Integer; Left, Top, Width, Height: Integer;

      DrawState: TRVTextDrawStates;

      var DoDefault: Boolean) of object;

(introduced in version 1.3)

You can use this event to modify drawing of text background for some or all text styles.

Unlike OnDrawStyleText, this event is called only once for each drawing item. OnDrawStyleText can be called several times if part of text item is selected. But in paragraphs having Alignment=rvaJustify, this event is called for background of each word separately.

Input parameters:

Sender – TRVStyle generating the event.

Canvas – canvas to paint.

StyleNo – index of text style in TextStyles collection.

Left, Top, Width, Height – rectangle where to paint.

DrawState may include rvtsControlFocused and rvtsHover, see , see TRVTextDrawStates.

DoDefault is equal to True.

"Hidden" input parameters:

Sender.RVData: TPersistent, document containing this paragraph. It should be typecasted to TCustomRVFormattedData before using.

Sender.ItemNo: Integer, index of the item in Sender.RVData.

These parameters allow to get additional information about the item being painted.

For example:

uses ..., CRVFData;

...

var ItemTag: Integer;

...

ItemTag := TCustomRVFormattedData(Sender.RVData).GetItemTag(Sender.ItemNo));

Output parameters:

DoDefault – set to False to prevent default drawing. Currently the default drawing procedure does nothing.

See also events:

•	OnDrawStyleText

•	OnApplyStyle;

•	OnApplyStyleColor;

See also properties:

•	TextStyles.

Demo projects:

•	Demos\Delphi\Assorted\Custom Draw\

•	Demos\CBuilder\Assorted\Custom Draw\


TRVStyle.OnStyleHoverSensitive
 TRichView Reference | TRVStyle

TRVStyle.OnStyleHoverSensitive

In this event you can define whether TRichView should redraw itself when the mouse pointer moves in or out of the area of text of the StyleNo-th style.

property OnStyleHoverSensitive: TRVStyleHoverSensitiveEvent;

type

  TRVStyleHoverSensitiveEvent =

    procedure (Sender: TRVStyle;

      StyleNo: Integer;

      var Sensitive: Boolean) of object;

(introduced in version 1.3)

This event occurs only for hypertext styles.

Input parameters:

Sender – TRVStyle generating the event.

StyleNo – index of text style in TextStyles collection.

Sensitive – True if for the given text style (HoverEffects=[]) or (HoverBackColor<>BackColor) or (HoverColor<>clNone) or (HoverUnderlineColor<>clNone), or if HoverColor<>clNone. False otherwise.

Output parameters:

Set Sensitive to True is you want to draw a special effect for "hot" (under the mouse pointer) text for this text style.

See also events:

•	OnDrawStyleText;

•	OnDrawTextBack.

See also properties:

•	TextStyles.


TFontInfos
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos

Properties   Methods

Collection of text styles. Class of TRVStyle.TextStyles property.

Unit RVStyle;

Syntax

TCustomRVInfos = class(TCollection)

TFontInfos = class(TCustomRVInfos)

Hierarchy

TObject

TPersistent

TCollection

TCustomRVInfos

Main Properties

Items – array of TFontInfo.

InvalidItem is returned when accessing item which is out of index range.

Methods for Text Style Search

•	FindStyleWithFontStyle

•	FindStyleWithFontSize

•	FindStyleWithColor

•	FindStyleWithFontName

•	FindSuchStyle

•	FindStyleWithFont

•	FindStyleWithCharset

See Also

•	TParaInfos – class of collection of paragraph styles;

•	TRVListInfos – class of collection of list styles (i.e. styles of bullets and numbering).


TFontInfos.InvalidItem
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.InvalidItem

This item is returned when accessing Items[ItemNo], if (ItemNo<0) or (ItemNo>=TFontInfos.Count)

property InvalidItem: TFontInfo;

(introduced in version 1.7)

This feature is for debugging, this situation should not occur.

Default value:

Default value has all properties Items[0], but red background and white text color.

See also:

•	TParaInfos.InvalidItem.


TFontInfos.Items
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.Items

Provides indexed access to the items in the collection of text styles

property Items[Index:Integer]: TFontInfo;

This is the default property of TFontInfos, so you can write

MyRVStyle.TextStyles[i]

instead of

MyRVStyle.TextStyles.Items[i]

Many methods of components inherited from TCustomRichView have StyleNo parameter, which is an index in TFontInfos.Items collection (more specifically, in TCustomRichView.Style.TextStyles.Items).

Example:

  MyRichView.AddNL('Hello', 0, 0);

Unlike normal collections, when accessing item with invalid Index (for example, Index<0 or Index>=Count), no exception occurs. InvalidItem is returned instead.


TFontInfos.PixelsPerInch
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.PixelsPerInch

Indicates the number of pixels that make up a logical inch in the vertical direction.

PixelsPerInch: Integer;

This property affects how text is displayed in components inherited from TCustomRichView and TRVReportHelper (this property is ignored by TRVPrint).

If this property is equal to 0, Screen.PixelsPerInch is used to display text.

You can assign positive value to this property to make your application independent of screen font mode. For example, if you assign 96, text will always look like in "Small Fonts" mode; if you assign 120, text will always look like in "Large Fonts" mode.

This property does not affect non-text elements, such as line widths or picture sizes (see RichViewPixelsPerInch typed constant).

Default value:

0


TFontInfos.Add
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.Add

Adds a new style in the collection of text styles

function Add: TFontInfo;

This method overrides TCollection.Add method to return TFontInfo instance.

Call Add to create a text style in the collection. The new item is placed at the end of the Items array.

Return value:

Created collection item.

See also:

•	TFontInfo.Create.


TFontInfos.AddFont
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.AddFont (deprecated)

Adds a new item in the collection of text styles, initializes it.

function AddFont(Name: TFontName; Size: Integer;

  Color, BackColor: TColor; Style:TFontStyles): TFontInfo;

Please use Add instead of this method.


TFontInfos.AddFontEx
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.AddFontEx (deprecated)

Adds a new item in the collection of text styles, initializes it.

function AddFontEx(Name: TFontName; Size: Integer;

  Color, BackColor: TColor; Style:TFontStyles;

  Charset: TFontCharset): TFontInfo;

Please use Add instead of this method.


TFontInfos.AssignTo
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.AssignTo

Copies properties of this collection to the destination object Dest.

procedure AssignTo(Dest: TPersistent); override;

TCollection AssignTo method is overridden to make it possible to assign names of styles (TFontInfo.StyleName) to TStrings.

Do not call AssignTo directly, this method is called from Dest.Assign method.

Example:

MyListBox: TListBox;

...

MyListBox.Items.Assign(MyRVStyle.TextStyles);


TFontInfos.Create
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.Create

A constructor, creates and initializes a collection of text styles.

constructor Create(Owner: TPersistent);

Do not create collection of styles yourself. It is created and destroyed by TRVStyle component as TextStyles property.


TFontInfos.FindStyleWithCharset
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithCharset

Searches for style with the specified Charset.

function FindStyleWithCharset(BaseStyle: Integer; Charset: TFontCharset): Integer;

(Introduced in version 1.4)

Searches for style having all properties of the BaseStyle-th style, but Unicode=False and Charset=Charset.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindStyleWithColor
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithColor

Searches for style with the specified colors.

function FindStyleWithColor(BaseStyle: Integer; Color, BackColor: TColor): Integer;

(Introduced in version 1.3)

Searches for style having all properties of the BaseStyle-th style, but Color=Color and BackColor=BackColor.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindStyleWithFont
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithFont

Searches for style having the specified font attributes.

function FindStyleWithFont(BaseStyle: Integer; Font: TFont): Integer;

(Introduced in version 1.3)

Searches for style having all properties of the BaseStyle-th style, except for all font attributes defined in Font.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindStyleWithFontName
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithFontName

Searches for style having specified font name.

function FindStyleWithFontName(BaseStyle: Integer; const FontName: TFontName): Integer;

(Introduced in version 1.3)

Searches for style having all properties of the BaseStyle-th style, but FontName=FontName.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindStyleWithFontSize
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithFontSize

Searches for style having the specified font size.

function FindStyleWithFontSize(BaseStyle: Integer; Size: Integer): Integer;

(Introduced in version 1.3)

Searches for style having all properties of the BaseStyle-th style, but font Size=Size.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindStyleWithFontStyle
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindStyleWithFontStyle

Searches for style having the specified font style.

function FindStyleWithFontStyle(BaseStyle: Integer; Value, Mask: TFontStyles): Integer;

(Introduced in version 1.3)

Searches for style having all properties of the BaseStyle-th style, but the font styles defined by Value and Mask.

Mask is a set of styles for check.

Value is a set of styles what must exist.

BaseStyle is an index in Items.

For example:

•	Mask = [fsBold], Value = [fsBold] searches for bold style (all other font styles are not checked).

•	Mask = [fsBold], Value = [] searches for not bold style (all other font styles are not checked).

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods; the most universal method is FindSuchStyle;

•	TFontInfo.IsEqual.


TFontInfos.FindSuchStyle
 TRichView Reference | TRVStyle | TFontInfos

TFontInfos.FindSuchStyle

Searches for style.

function FindSuchStyle(BaseStyle: Integer; Style: TFontInfo;

  Mask: TRVFontInfoProperties): Integer;

(Introduced in version 1.3)

Searches for style having properties like Style.

The BaseStyle-th style is checked first. BaseStyle is an index in Items.

Mask is a set of properties to compare (other properties are ignored).

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found.

See also:

•	other TFontInfos.Find*** methods;

•	TFontInfo.IsEqual;

•	TParaInfos.FindSuchStyle;

•	TRVListInfos.FindSuchStyle.

Demos:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

(see procedure TForm1.rveStyleConversion, rve.OnStyleConversion event)


TParaInfos
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos

Properties   Methods

Collection of paragraph styles. Class of TRVStyle.ParaStyles property.

Unit RVStyle;

Syntax

TCustomRVInfos = class(TCollection)

TParaInfos = class(TCustomRVInfos)

Hierarchy

TObject

TPersistent

TCollection

TCustomRVInfos

Main Properties

Items – array of TParaInfo.

InvalidItem is returned when accessing item which is out of index range.

Methods for Paragraph Style Search

•	FindStyleWithAlignment;

•	FindSuchStyle.

See Also

•	TFontInfos – class of collection of text styles;

•	TRVListInfos – class of collection of list styles (i.e. styles of bullets and numbering).


TParaInfos.InvalidItem
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.InvalidItem

This item is returned when accessing Items[ItemNo], if (ItemNo<0) or (ItemNo>=TParaInfos.Count)

property InvalidItem: TParaInfo;

(introduced in version 1.7)

This feature is for debugging, this situation should not occur.

Default value

Default value has all properties Items[0], but (LeftIndent,SpaceBefore,RightIndent,SpaceAfter)=(1,1,1,1) and red border.

See also

•	TFontInfos.InvalidItem.


TParaInfos.Items
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.Items

Provides indexed access to the items in the collection of paragraph styles

property Items[Index: Integer]: TParaInfo;

This is default property of TParaInfos, so you can write

MyRVStyle.ParaStyles[i]

instead of

MyRVStyle.ParaStyles.Items[i]

Many methods of components inherited from TCustomRichView have ParaNo parameter, which is an index in TParaInfos.Items collection (more specifically, in TCustomRichView.Style.ParaStyles.Items).

Example:

  MyRichView.AddNL('Hello', 0, 0);

Unlike normal collections, when accessing item with invalid Index (for example, Index<0 or Index>=Count), no exception occurs. InvalidItem is returned instead.


TParaInfos.Add
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.Add

Adds a new style to the collection of paragraph styles.

function Add: TParaInfo;

This method overrides TCollection.Add method to return TParaInfo instance.

Call Add to create a paragraph style in the collection. The new item is placed at the end of the Items array.

Return value:

Created collection item.

See also:

•	TParaInfo.Create.


TParaInfos.AssignTo
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.AssignTo

Copies properties of this collection to the destination object Dest.

procedure AssignTo(Dest: TPersistent); override;

TCollection AssignTo method is overridden to make it possible to assign names of styles (TParaInfo.StyleName) to TStrings.

Do not call AssignTo directly, this method is called from Dest.Assign method.

Example:

MyListBox: TListBox;

...

MyListBox.Items.Assign(MyRVStyle.ParaStyles);


TParaInfos.Create
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.Create

A constructor, creates and initializes a collection of paragraph styles.

constructor Create(Owner: TPersistent);

Do not create collection of styles yourself. It is created and destroyed by TRVStyle component as ParaStyles property.


TParaInfos.FindStyleWithAlignment
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.FindStyleWithAlignment

Searches for style having the specified alignment

function FindStyleWithAlignment(BaseStyle: Integer;

  Alignment: TRVAlignment): Integer;

(Introduced in version 1.5)

Searches for style having all properties of the BaseStyle-th style, but Alignment=Alignment.

BaseStyle is an index in Items.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style or -1, if not found.

See also methods:

•	FindSuchStyle.


TParaInfos.FindSuchStyle
 TRichView Reference | TRVStyle | TParaInfos

TParaInfos.FindSuchStyle

Searches for style.

function FindSuchStyle(BaseStyle: Integer; Style: TParaInfo;

  Mask: TRVParaInfoProperties): Integer;

(Introduced in version 1.5)

Searches for style having properties like Style.

The BaseStyle-th style is checked first. BaseStyle is an index in Items.

Mask is a set of properties to compare (other properties are ignored).

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style or -1, if not found.

See also methods:

•	FindStyleWithAlignment;

•	TParaInfo.IsEqual;

•	TFontInfos.FindSuchStyle;

•	TRVListInfos.FindSuchStyle.

Demos:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

(see procedure TForm1.rveParaStyleConversion, rve.OnParaStyleConversion event)


TRVListInfos
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos

Properties   Methods

Collection of paragraph list styles (bullets and numbering). Class of TRVStyle.ListStyles property.

Unit RVStyle.

Syntax

TCustomRVInfos = class(TCollection)

TRVListInfos = class(TCustomRVInfos)

Hierarchy

TObject

TPersistent

TCollection

TCustomRVInfos

Main Properties

Items – array of TRVListInfo.

Main Methods

•	FindSuchStyle

•	FindStyleWithLevels

See Also

•	TFontInfos – class of collection of text styles;

•	TParaInfos – class of collection of paragraph styles;

•	List markers item type.


TRVListInfos.Items
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos.Items

Provides indexed access to items in the collection of paragraph list styles (bullets and numbering)

property Items[Index:Integer] : TRVListInfo;

This is default property of TRVListInfos, so you can write

MyRVStyle.ListStyles[i]

instead of

MyRVStyle.ListStyles.Items[i]


TRVListInfos.Add
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos.Add

Adds a new style to the collection of paragraph list styles (bullets and numbering)

function Add: TRVListInfo;

This method overrides TCollection.Add method to return TRVListInfo instance.

Call Add to create a new list style in the collection. The new item is placed at the end of the Items array.

Add returns the new collection item.


TRVListInfos.AssignTo
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos.AssignTo

Copies properties of this collection to the destination object Dest.

procedure AssignTo(Dest: TPersistent); override;

TCollection AssignTo method is overridden to make it possible to assign names of styles (TParaInfo.StyleName) to TStrings.

Do not call AssignTo directly, this method is called from Dest.Assign method.

Example:

MyListBox: TListBox;

...

MyListBox.Items.Assign(MyRVStyle.ListStyles);


TRVListInfos.FindStyleWithLevels
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos.FindStyleWithLevels

Searches for the style having the specified levels. Adds if not found (optionally)

function FindStyleWithLevels(Levels: TRVListLevelCollection;

  const StyleNameForAdding: String; AddIfNotFound: Boolean): Integer;

This method searches for the style having levels with properties like in Levels.

If AddIfNotFound=True and style is not found, it adds a new style to the end of collection, assigns Levels to its Levels and StyleNameForAdding to its StyleName. The created style has Standard property = False.

Return value:

Index of style, or -1 if not found (and not added).

See also:

•	FindSuchStyle.


TRVListInfos.FindSuchStyle
 TRichView Reference | TRVStyle | TRVListInfos

TRVListInfos.FindSuchStyle

Searches for the style. Adds if not found (optionally)

function FindSuchStyle(Style: TRVListInfo; AddIfNotFound: Boolean): Integer;

This method searches for the style having all properties of Style.

If AddIfNotFound=True and style is not found, it adds a new style to the end of collection and assigns all properties of Style to it. The created style has Standard property = False.

The following properties are ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

Return value:

Index of style, or -1 if not found (and not added).

See also:

•	FindStyleWithLevels;

•	TFontInfos.FindSuchStyle;

•	TParaInfos.FindSuchStyle.


TCustomRVInfo
 TRichView Reference | TRVStyle | TCustomRVInfo

TCustomRVInfo

Properties

This is an ancestor class for all TRichView styles: text styles, paragraph styles, list styles.

Unit RVStyle.

Syntax

TCustomRVInfo = class(TCollectionItem)

Hierarchy

TObject

TPersistent

TCollectionItem

Using

This class is not used directly. The classes inherited from it are used instead.

The following classes are inherited from TCustomRVInfo (all defined in RVStyle unit).

Class	Meaning
TCustomRVFontInfo	This class introduces the most of properties related to text attributes. Ancestor of TFontInfo.
TCustomRVParaInfo	This class introduces the most of properties related to paragraph attributes. Ancestor of TParaInfo.
TFontInfo	Text style, defines text attributes. Class of items in the collection TRVStyle.TextStyles.
TParaInfo	Paragraph style, defines paragraph attributes. Class of items in the collection TRVStyle.ParaStyles.
TRVListInfo	List style (i.e. style of paragraphs' bullets & numbering). It has Levels collection defining attributes of paragraph list markers. Class of items in the collection TRVStyle.ListStyles.
The class hierarchy is explained on the diagram below.

Properties

TCustomRVInfo introduces two properties:

•	Standard;

•	StyleName.


TCustomRVInfo.Standard
 TRichView Reference | TRVStyle | TCustomRVInfo

TCustomRVInfo.Standard

Identifies standard (essential) styles

property Standard: Boolean;

(introduced in version 1.6)

Standard styles are not deleted by DeleteUnusedStyles.

This property is ignored when comparing and searching styles.

All styles which are added automatically while loading from RTF or inserting from RVF are not standard.

Styles which are added automatically while loading from RVF preserve value of this property.

Default value:

True

See also:

•	TFontInfo – class of text style;

•	TParaInfo – class of paragraph style;

•	TRVListInfo – class of paragraph list style;

•	RichViewResetStandardFlag typed constant.


TCustomRVInfo.StyleName
 TRichView Reference | TRVStyle | TCustomRVInfo

TFontInfo.StyleName

Name of this style.

property StyleName: String;

This name is used:

•	when displaying designtime editor for collections of styles;

•	when assigning text styles to TStrings.

This property is ignored when comparing and searching styles (see also RichViewCompareStyleNames typed constant).


TCustomRVFontInfo
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo

Properties    Methods

This is an ancestor class for TFontInfo (class of item in collection of text styles).

TCustomRVFontInfo introduces the most of properties of text style.

Unit RVStyle.

Syntax

  TCustomRVFontInfo = class(TCustomRVInfo)

Hierarchy

TObject

TPersistent

TCollectionItem

TCustomRVInfo

Properties

Font attributes (similar to properties of TFont):

•	FontName – font name;

•	Size – font size;

•	Color – text color;

•	Style – text styles (bold, italic, underline, strikeout);

•	Charset – font character set (for non-Unicode text styles).

Additional properties affecting text appearance and layout:

•	BackColor – text background color;

•	UnderlineColor – underline color;

•	UnderlineType – underline style (normal, double, dotted, etc.);

•	StyleEx – additional text styles (overline, all-caps);

•	SubSuperScriptType – normal text/subscript/superscript;

•	VShift moves text up or down from its base line;

•	CharScale – horizontal character scaling;

•	CharSpacing – spacing between characters;

•	BiDiMode – default text direction.

Hypertext properties:

•	Jump – "is this a hypertext style?"

•	HoverColor – text highlight color;

•	HoverBackColor – text background highlight color;

•	HoverUnderlineColor – underline highlight color;

•	HoverEffects – additional highlight effects (underline);

•	JumpCursor – mouse cursor for this text.

Properties related to editing in TCustomRichViewEdit:

•	Protection – text protection options.

Properties related to text export:

•	Options allows to create RTF and HTML codes.

Methods

IsEqual compares this text style with another one.

You can use Assign method to assign:

•	TCustomRVFontInfo to TCustomRVFontInfo;

•	TFont to TCustomRVFontInfo;

•	TCustomRVFontInfo to TFont.

See Also

Classes:

•	TFontInfo – class inherited from this class, a text style;

•	TFontInfos – collection of text styles (TFontInfo).


TCustomRVFontInfo.BackColor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.BackColor

Background color for text of this style

property BackColor: TColor;

Set BackColor=clNone for transparent text background.

Default value:

clNone

See also:

•	HoverBackColor;

•	Color;

•	HoverColor.


TCustomRVFontInfo.BiDiMode
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.BiDiMode

Specifies default direction for the text of this style.

property BiDiMode: TRVBiDiMode;

(introduced in version 1.6)

Value	Meaning
rvbdUnspecified	Text direction is inherited from higher level, i.e. from paragraph (see BiDiMode of paragraph style)
rvbdLeftToRight	Default text reading order is left-to-right
rvbdRightToLeft	Default text reading order is right-to-left
Default value:

rvbdUnspecified

See also:

•	Bidirectional text in RichView.


TCustomRVFontInfo.CharScale
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.CharScale

Horizontal character scaling value for text of this style, %

property CharScale: Integer;

(Introduced in version 1.5)

By default, value of this property is equal to 100%, and text of this style is displayed with normal proportions. Set it to larger value to make characters wider, and to lesser value to make them narrower.

This value does not affect the height of text.

Example:

This example shows text formatted with CharScale = 100, 150, and 80.

Warning: the standard Delphi TFont class does not support character scaling. So be careful if you want to use this value in combination with custom drawing. Any changes of RichView's Canvas.TFont will reset font scaling to default.

Default value:

100


TCustomRVFontInfo.Charset
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Charset

Specifies character set for text of this style.

property Charset : TFontCharset;

Set Charset to identify the character set of the font. Each typeface (specified by the FontName property) supports one or more character sets.

Similar to TFont.Charset.

If Unicode=True, this Charset is not used when drawing text (but still used inside some methods performing conversion ANSI<->Unicode, for determining the code page (language) of text of this style).

Value of RVStyle.TextStyles[0].Charset is used to determine document charset when saving HTML files (written in <meta> tag).

Default value:

DEFAULT_CHARSET


TCustomRVFontInfo.CharSpacing
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.CharSpacing

Specifies intercharacter spacing for text of this style.

property CharSpacing : Integer;

(introduced in version 1.6)

This property defines expansion (if positive) or compression (if negative) of space between characters, in "screen" pixels (when printing, it will be recalculated according to the printer resolution).

This property is ignored, if text bi-di mode is not equal to rvbdUnspecified.

Example:

This example shows text formatted with CharSpacing = 0, 5, and -3.

Default value:

0


TCustomRVFontInfo.Color
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Color

Specifies color for text of this style.

property Color: TColor;

Similar to TFont.Color.

Default value:

clWindowText

See also:

•	BackColor;

•	HoverColor;

•	HoverBackColor.


TCustomRVFontInfo.FontName
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.FontName

Specifies font typeface for text of this style.

type TFontName = type string;

property FontName: TFontName

If the font family described by FontName includes multiple character sets, be sure to set the Charset property as well (if Unicode=False).

Similar to TFont.Name.

Default value:

'Arial'


TCustomRVFontInfo.HoverBackColor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.HoverBackColor

Specifies background highlight color for hypertext links of this style.

property HoverColor: TColor;

(introduced in version 1.2)

If this style is a hypertext style (Jump=True), background of text of this style can be highlighted with this color when user moves the mouse pointer above it. Set HoverBackColor=BackColor to disable effect.

By default, RichViewEdit also highlights hyperlinks when the caret is moved inside them. This effect can be disabled by including rvoNoCaretHighlightJumps in RichViewEdit.EditorOptions property.

This property has no effect for non-hypertext styles.

Default value:

clNone

See also properties:

•	BackColor;

•	HoverColor;

•	Jump;

•	JumpCursor;

•	HoverEffects;

•	HoverUnderlineColor.

See also properties of TRVStyle:

•	HoverColor;

•	FullRedraw.


TCustomRVFontInfo.HoverColor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.HoverColor

Specifies highlight color for hypertext links of this style.

property HoverColor: TColor;

If this style is a hypertext style (Jump=True), text of this style can be highlighted with this color when user moves the mouse pointer above it.

If this property is equal to clNone, TRVStyle.HoverColor is used. If it is, in its order, equal to clNone, no hover color effect is used.

By default, RichViewEdit also highlights hyperlinks when the caret is moved inside them. This effect can be disabled by including rvoNoCaretHighlightJumps in RichViewEdit.EditorOptions property.

This property has no effect for non-hypertext styles.

Default value:

clNone

See also properties:

•	Color;

•	HoverBackColor;

•	Jump;

•	JumpCursor;

•	HoverEffects;

•	HoverUnderlineColor.

See also properties of TRVStyle:

•	HoverColor;

•	FullRedraw.


TCustomRVFontInfo.HoverEffects
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.HoverEffects

Specifies additional effects for hyperlinks.

type

  TRVHoverEffect = (rvheUnderline);

  TRVHoverEffects = set of TRVHoverEffect;

property HoverEffects: TRVHoverEffects;

(introduced in version 10)

If this style is a hypertext style (Jump=True), these effects are applied to text of this style when user moves the mouse pointer above it.

By default, RichViewEdit also applies these effects to hyperlinks when the caret is moved inside them. This effect can be disabled by including rvoNoCaretHighlightJumps in RichViewEdit.EditorOptions property.

This property has no effect for non-hypertext styles.

Effect	Meaning
rvheUnderline	Text is underlined.
This underline may have a custom color, see HoverUnderlineColor property.

Default value:

[]

See also properties:

•	Jump;

•	HoverColor;

•	HoverBackColor;

•	JumpCursor.

See also properties of TRVStyle:

•	FullRedraw.


TCustomRVFontInfo.HoverUnderlineColor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.HoverUnderlineColor

Specifies underline highlight color for hypertext links of this style.

property UnderlineColor: TColor;

(introduced in version 10)

Underline is displayed only if fsUnderline is included in Style, or rvheUnderline is included HoverEffects.

If this style is a hypertext style (Jump=True), underline of text of this style can be highlighted with this color when user moves the mouse pointer above it.

If this property is equal to clNone, UnderlineColor is used. If it is, in its order, equal to clNone, HoverColor is used. If it is, in its order, equal to clNone, Color is used.

RTF Note:

This attribute cannot be stored in RTF files.

HTML Note:

Colored underlines are not supported in HTML and CSS.

SaveHTML ignores this attribute. SaveHTMLEx saves colored underline as a bottom border side of the text's <span> element.

Default value:

clNone

See also:

•	UnderlineType.


TCustomRVFontInfo.Jump
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Jump

Specifies whether this style is a hypertext style.

property Jump: Boolean

If Jump=True, text items of this style are hyperlinks.

The following properties are applied only to hypertext styles:

•	HoverColor;

•	HoverBackColor;

•	HoverUnderlineColor;

•	HoverEffects;

•	JumpCursor.

See also:

•	RichView hypertext overview.

Demo projects:

•	Demos\Delphi\Assorted\Hypertext\

•	Demos\CBuilder\Assorted\Hypertext\


TCustomRVFontInfo.JumpCursor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.JumpCursor

Specifies mouse cursor for hypertext of this style.

property JumpCursor: TCursor;

This cursor appears when user moves the mouse pointer to text item of this style in RichView. This property has effect only for hypertext items (Jump=True).

Default value:

crJump (101) (system hypertext cursor or [image])

See also properties of TRVStyle:

•	JumpCursor.

See also:

•	Cursors used by components of RichView family.


TCustomRVFontInfo.Options
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Options

Options for exporting text of this style to RTF and HTML.

type

  TRVTextOption = (rvteoHTMLCode, rvteoRTFCode);

  TRVTextOptions = set of TRVTextOption;

property NextStyleNo: Integer;

(introduced in version 1.6)

Option	Meaning
rvteoRTFCode	If set, '{', '}', '\' are saved in RTF as they are. Example: set this option, write text of this style: '\animtext1 Viva Las Vegas', copy to RTF and paste in MS Word.
rvteoHTMLCode	If set, '&', '<', '>', and multiple spaces are saved in HTML as they are. Example: set this option, write text of this style: '<marquee width=200>Attention. Spaceship is arriving at the Second Terminal.</marquee>', save as HTML and open in web browser.
Text with rvteoHTMLCode is not saved in RTF.

Text with rvteoRTFCode is not saved in HTML.

Text with both these options is saved both in HTML and RTF.

Default value:

[]

See also:

•	TCustomRichView.SaveRTF;

•	About HTML export.


TCustomRVFontInfo.Protection
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Protection

Protects text of this style from specific operations in editor.

property Protection: TRVProtectOptions;

type

  TRVProtectOption =

    (rvprStyleProtect, rvprStyleSplitProtect,

     rvprModifyProtect,

     rvprDeleteProtect, rvprConcateProtect,

     rvprRVFInsertProtect, rvprDoNotAutoSwitch,

     rvprParaStartProtect,

     rvprSticking, rvprSticking2, rvprSticking3,

     rvprStickToTop, rvprStickToBottom);

  TRVProtectOptions = set of TRVProtectOption;

Used in RichViewEdit. Text of this style has special behavior when editing.

General Protection Options

Option	Meaning
rvprStyleProtect	Protects text from changing style with ApplyTextStyle. This protection is ignored by ApplyStyleConversion, but you can take it into account manually in OnStyleConversion event.
rvprStyleSplitProtect	Protects from applying text style to the part of text item. ApplyTextStyle and ApplyStyleConversion methods apply new style to the whole item having this protection, even if it is selected only partially.
rvprModifyProtect	Protects text items of this style from modification, but does not protect from deleting as a whole.
rvprDeleteProtect	Protects text items of this style from deletion as a whole, but does not protect from modification. See also: rvepDeleteProtect item property.
rvprConcateProtect	Protects texts items from concatenation with adjacent item of the same style.
rvprRVFInsertProtect	If set, items of this style will not be inserted when inserting RVF. Affects methods introduced in editor only (InsertRV***Ed, pasting).
rvprDoNotAutoSwitch	If set, editor never switches the current text style to this one automatically. If this style was made current by the user (by assigning CurTextStyleNo property), the editor switches back to another (previously used) style after the first performed operation.
rvprParaStartProtect	Disallows moving text item of this style to/from new line; blocks  Enter  key when the caret is in text of this style.
Sticking

Option	Meaning
rvprSticking	Disallows insertion between two text items having this protection (allows to stick together several text items of different text styles).
rvprSticking2	The same.
rvprSticking3	The same.
rvprStickToTop	Disallows insertion before the text of this style, if this text is a first document item.
rvprStickToBottom	Disallows insertion after the text of this style, if this text is a last document item.
rvprSticking, rvprSticking2, and rvprSticking3 allow to create several groups of stuck items. It's not possible to insert something between items having the same protection option, but it's possible to insert between items having different options, for example rvprSticking and rvprSticking2.

Note:

TFontInfo.SingleSymbols property is removed in version 1.3. When loading forms saved with an older version, or when loading styles from ini-files or registry, SingleSymbols=True is converted to Protection=[rvprStyleProtect, rvprDoNotAutoSwitch].

Default value:

[]

See also:

•	Options of paragraph style.

Demo projects:

•	Demos\Delphi\Assorted\Fields\

•	Demos\CBuilder\Assorted\Fields\


TCustomRVFontInfo.Size
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Size

Specifies the font height in points.

property Size: Integer;

Similar to TFont.Size.

Default value:

10


TCustomRVFontInfo.Style
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Style

Specifies whether the text of this style is normal, italic, underlined, bold, and so on.

type  TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut);

type  TFontStyles = set of TFontStyle;

property Style: TFontStyles;

Similar to TFont.Style.

Default value:

[]

See also properties:

•	StyleEx;

•	HoverEffects.


TCustomRVFontInfo.StyleEx
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.StyleEx

Additional attributes for font of text of given style in RichView or its descendants.

type TRVFontStyle = (rvfsOverline, rvfsAllCaps);

type TRVFontStyles = set of TRVFontStyle

property StyleEx: TRVFontStyles;

Option	Meaning
rvfsOverline	Vertical line above the text
rvfsAllCaps	All capitals
Note:

All-Caps is introduced in version 1.5. It has the following limitations:

•	for Unicode text, capitalization works only under WinNT/2000/XP/Vista;

•	for ANSI text capitalization, TRichView always uses the system default language/code page (i.e. the result of AnsiUpperCase).

Default value:

[]


TCustomRVFontInfo.SubSuperScriptType
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.SubSuperScriptType

Specifies whether this style is a normal text, a subscript, or a superscript.

type

  TRVSubSuperScriptType = (rvsssNormal,  rvsssSubscript,  rvsssSuperScript);

property SubSuperScriptType: TRVSubSuperScriptType;

(introduced in version 10)

Subscripts and superscripts are displayed with smaller font than specified in Size.

Default value:

rvsssNormal

See also properties:

•	VShift.


TCustomRVFontInfo.UnderlineColor
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.UnderlineColor

Specifies underline color.

property UnderlineColor: TColor;

(introduced in version 10)

Underline is displayed only if fsUnderline is included in Style (or rvheUnderline is included HoverEffects, under the mouse pointer).

If UnderlineColor=clNone, text color is used for underline (Color in normal state, HoverColor for hyperlinks under the mouse pointer).

Values other than clNone define underline color. HoverUnderlineColor property may change hyperlink color under the mouse pointer.

RTF Note:

This attribute can be saved and loaded in RTF files.

HTML Note:

Colored underlines are not supported in HTML and CSS.

SaveHTML ignores this attribute. SaveHTMLEx saves colored underline as a bottom border side of the text's <span> element.

Default value:

clNone

See also:

•	UnderlineType.


TCustomRVFontInfo.UnderlineType
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.UnderlineType

Specifies the style of underline.

type

  TRVUnderlineType = (rvutNormal, rvutThick, rvutDouble,

    rvutDotted, rvutThickDotted,

    rvutDashed, rvutThickDashed,

    rvutLongDashed, rvutThickLongDashed,

    rvutDashDotted, rvutThickDashDotted,

    rvutDashDotDotted, rvutThickDashDotDotted);

property UnderlineType: TRVUnderlineType;

(introduced in version 10)

Underline is displayed only if fsUnderline is included in Style (or rvheUnderline is included HoverEffects, under the mouse pointer).

By default, underline color is defined in Color property, but it can be altered by UnderlineColor property (see also HoverColor/HoverUnderlineColor for hyperlink colors under the mouse pointer).

Sample:

RTF Note:

This attribute can be saved and loaded in RTF files.

HTML Note:

Custom underlines are not supported in HTML and CSS.

SaveHTML ignores this attribute. SaveHTMLEx saves custom underline as a bottom border side of the text's <span> element (single, double, dotted and dashed lines are supported).

Default value:

rvutNormal


TCustomRVFontInfo.VShift
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.VShift

Vertical offset of text item of this style, in percents of text height.

property VShift: Integer;

Vertical offset is counted relative to the base line of text. Normal text items have VShift=0.

Use positive values to move text up, negative values to move text down.

This property can be applied not only to normal text, but to subscripts and superscripts (the effect is cumulative).

Default value:

0

See also:

•	TRVExtraItemProperty type (rvepVShift)


TCustomRVFontInfo.Assign
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Assign

Copies the contents of Source to this text style.

procedure Assign(Source: TPersistent); override;

Call Assign to copy properties of TFont, TCustomRVInfo, or TCustomRVFontInfo to this text style.

See also:

•	TFontInfo.Assign (TFontInfo is inherited from TCustomRVFontInfo).


TCustomRVFontInfo.AssignTo
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.AssignTo

Copies the properties of this text style to the destination object Dest.

procedure AssignTo(Dest: TPersistent);override;

Do not call AssignTo directly, this method is called from Assign method of a destination object.

AssignTo allows to assign text style to TFont.

Example:

MyEdit.Font.Assign(MyRVStyle.TextStyles[0]);


TCustomRVFontInfo.Create
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.Create

A constructor, creates and initializes a new instance of TCustomRVFontInfo.

constructor Create(Collection: TCollection);override;

The constructor initializes:

// Properties inherited from TCustomRVInfo:

Standard    := True;

StyleName   := 'Font Style';

// Properties defined in TCustomRVFontInfo:

Size        := 10;

FontName    := 'Arial';

Color       := clWindowText;

UnderlineColor := clNone;

BackColor   := clNone;

HoverColor  := clNone;

HoverUnderlineColor := clNone;

Charset     := DEFAULT_CHARSET;

JumpCursor  := crDefault;

CharScale   := 100;

Other properties are initialized with zeros/False/empty values.

Note: usually, when you create a text style in code, you should assign Standard := False.


TCustomRVFontInfo.IsEqual
 TRichView Reference | TRVStyle | TCustomRVFontInfo

TCustomRVFontInfo.IsEqual

Compares this text style with Value.

function IsEqual(Value: TCustomRVFontInfo; IgnoreList: TRVFontInfoProperties): Boolean; dynamic;

(introduced in version 1.3)

Parameters:

Value – object to compare with this text style. The class of this object is TCustomRVFontInfo or inherited from it.

IgnoreList – set of values identifying properties to ignore when comparing, see TRVFontInfoProperties.

The following properties are always ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

See also:

•	TFontInfo.IsEqual (TFontInfo is inherited from this class);

•	TCustomRVParaInfo.IsEqual.


TFontInfo
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo

Properties   Methods

This is a text style. It defines attributes of text items in TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit controls.

This is an item in the collection of TRVStyle.TextStyles. The class of the collection itself is TFontInfos.

Unit RVStyle.

Syntax

TFontInfo = class(TCustomRVFontInfo)

Hierarchy

TObject

TPersistent

TCollectionItem

TCustomRVInfo

TCustomRVFontInfo

Properties

The most of properties are inherited from TCustomRVFontInfo.

The new properties are:

•	Unicode – defines encoding for text of this style (either Unicode (UTF-16) or ANSI (with character set Charset);

•	NextStyleNo – index of text style to apply after pressing  Enter  in editor.

Methods

IsEqual compares this text style with another one.

You can use Assign method to assign:

•	TFontInfo to TFontInfo;

•	TCustomRVFontInfo to TFontInfo and vice versa;

•	TFont to TFontInfo and vice versa.

See Also

•	TFontInfos – class of collection of text styles;

•	TParaInfo – class of paragraph style;

•	TRVListInfo – class of list style.


TFontInfo.Unicode
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo.Unicode

Specifies encoding for text of this style: Unicode or ANSI.

property Unicode: Boolean;

(Introduced in version 1.3)

If False, text has ANSI encoding, the character set is specified in Charset property. DBCS is not supported.

If True, text has Unicode encoding (UTF-16, WideString).

Default value:

For Delphi/C++Builder 2009 or newer: True

For older versions: False

See also:

•	Unicode in RichView.


TFontInfo.NextStyleNo
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo.NextStyleNo

The default next text style, index in TRVStyle.TextStyles.

property NextStyleNo: Integer;

This property is used in RichViewEdit. When user presses  Enter  key at the end of paragraph, and the current text has this style, a new empty paragraph will be created using this NextStyleNo. If NextStyleNo=-1, a new paragraph will have the same text style as in the current paragraph.

Default value:

-1

See also

•	TParaInfo.NextParaNo.


TFontInfo.Assign
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo.Assign

Copies the contents of Source to this text style.

procedure Assign(Source: TPersistent); override;

Call Assign to copy properties of TFont, TCustomRVInfo, TCustomRVFontInfo, or TFontInfo to this text style.

Example:

// Copying TFont to text style:

MyRVStyle.TextStyles[0].Assign(MyEdit.Font);

// Copying text style to text style:

MyRVStyle.TextStyles[0].Assign(MyRVStyle.TextStyles[1]);

// or, the same:

MyRVStyle.TextStyles[0] := MyRVStyle.TextStyles[1];


TFontInfo.Create
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo.Create

A constructor, creates and initializes a new instance of TFontInfo.

constructor Create(Collection: TCollection);override;

In addition to initializations performed by the inherited constructor, this methods initializes:

NextStyleNo    := -1;

In Delphi/C++Builder 2009 or newer, Unicode is initialized with True.

Other properties introduced in TFontInfo are initialized with zeros/False/empty values.

Note: usually, when you create a text style in code, you should assign Standard := False.


TFontInfo.IsEqual
 TRichView Reference | TRVStyle | TFontInfo

TFontInfo.IsEqual

Compares this text style with Value.

function IsEqual(Value: TCustomRVFontInfo; IgnoreList: TRVFontInfoProperties): Boolean; override;

(introduced in version 1.3)

Parameter:

Value – object to compare with this text style. The class of this object is TCustomRVFontInfo or inherited from it. If Value is TFontInfo, values of NextStyleNo and Unicode properties can be compared as well.

IgnoreList – set of values identifying properties to ignore when comparing.

The following properties are always ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

See also:

•	TCustomRVFontInfo.IsEqual (method of the ancestor class);

•	TFontInfos.FindSuchStyle;

•	TParaInfo.IsEqual.


TCustomRVParaInfo
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo

Properties   Methods

This is an ancestor class for TParaInfo (class of item in collection of paragraph styles).

TCustomRVParaInfo introduces the most of properties of paragraph style.

Unit RVStyle.

Syntax

  TCustomRVParaInfo = class(TCustomRVInfo)

Hierarchy

TObject

TPersistent

TCollectionItem

TCustomRVInfo

Properties

•	Alignment – alignment of paragraph (left, right, center or justify);

•	FirstIndent – indent of the first line of paragraph, summarized with LeftIndent;

•	LeftIndent – indent from left margin;

•	RightIndent – indent from right margin;

•	SpaceBefore – spacing above the paragraph;

•	SpaceAfter – spacing below the paragraph;

•	Border – border around the paragraph;

•	Background – background of paragraph;

•	Tabs – collection of tab stops;

•	LineSpacing, LineSpacingType – line spacing;

•	BiDiMode – default text direction;

•	Options – protection, wrapping.

•	OutlineLevel allows defining headings.

Methods

IsEqual compares this paragraph style with another one.

You can use Assign method to assign TCustomRVParaInfo to TCustomRVParaInfo.

See Also

Classes:

•	TParaInfo – class inherited from this class, a paragraph style;

•	TParaInfos – collection of text styles (TParaInfo).

Overview:

•	RichView Paragraphs


TCustomRVParaInfo.Alignment
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Alignment

Alignment of paragraph of this style (Left, Top, Center or Justify)

type

  TRVAlignment = (rvaLeft, rvaRight, rvaCenter, rvaJustify);

property Alignment : TRVAlignment;

Note: rvaJustify is supported only if BiDiMode=rvbdUnspecified, otherwise it works like rvaLeft.

Default value:

rvaLeft


TCustomRVParaInfo.Background
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Background

Defines background for paragraphs of this style (transparent by default)

property Background:TRVBackgroundRect;

(Introduced in version 1.2)

See TRVBackgroundRect for additional information.

Note: RTF and HTML support only equal Background.BorderOffsets and Border.BorderOffsets.

See also:

•	Paragraph Background.


TCustomRVParaInfo.BiDiMode
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.BiDiMode

Specifies default text direction for paragraphs of this style.

property BiDiMode: TRVBiDiMode;

(introduced in version 1.6)

Value	Meaning
rvbdUnspecified	Text direction is inherited from higher level, i.e. from TCustomRichView (see BiDiMode)
rvbdLeftToRight	Default text reading order is left-to-right
rvbdRightToLeft	Default text reading order is right-to-left
If two adjacent text items have adjacent LTR (RTL) characters, these items will be arranged LTR (RTL), regardless of the paragraph's BiDiMode.

Default value:

rvbdUnspecified

See also:

•	Bidirectional text in RichView.


TCustomRVParaInfo.Border
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Border

Defines a border around paragraphs of this style (none by default)

property Border:TRVBorder;

(Introduced in version 1.2)

See TRVBorder for additional information.

Note: RTF and HTML support only equal Background.BorderOffsets and Border.BorderOffsets.

See also:

•	Paragraph Background.


TCustomRVParaInfo.FirstIndent
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.FirstIndent

Indent of the first line for paragraphs of this style, in pixels

property FirstIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, so indents on page look like indents on screen.

This value can be negative.

Indent of first paragraph line from the left border = TCustomRichView.LeftMargin+LeftIndent+FirstIndent.

In paragraphs with bullets or numbering, this property is overridden by FirstIndent of list level.

Default value:

0

See also properties:

•	LeftIndent, RightIndent;

•	SpaceBefore, SpaceAfter.

See also properties of TRVListLevel:

•	FirstIndent.


TCustomRVParaInfo.LeftIndent
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.LeftIndent

Left indent for paragraphs of this style, in pixels

property LeftIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to printer resolution, so indents on page look like indents on screen.

Indent for paragraph from left border = TCustomRichView.LeftMargin+LeftIndent [ + FirstIndent for the first line ]

In paragraphs with bullets or numbering, this property is overridden with LeftIndent of list level (if BiDiMode<>rvbdRightToLeft).

Default value:

0

See also properties:

•	RightIndent;

•	SpaceBefore, SpaceAfter.

See also properties of TRVListLevel:

•	LeftIndent.


TCustomRVParaInfo.LineSpacing
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.LineSpacing

Defines spacing between lines in paragraphs of this style

property LineSpacing: Integer;

(Introduced in version 1.5)

The meaning of the property depends on the value of LineSpacingType property.

If LineSpacingType is rvlsPercent, this property defines line height in percent of normal line height (a height of the highest character in a line, heights of pictures and controls are not taken into account). Additional space will be added below the line (including the last paragraph line). For example, LineSpacing=100 means single spacing (no additional space will be added), LineSpacing=200 means double spacing. Values lesser than 50 are ignored.

If LineSpacingType is rvlsSpaceBetween, this value (in pixels) will be added below each line (including the last line in a paragraph). Negative values are ignored.

If LineSpacingType is rvlsLineHeightAtLeast, this property defines minimal line height, in pixels. If the actual line height (including all pictures and controls) is less than this value, additional spacing is added (below and above the line).

If LineSpacingType is rvlsLineHeightExact, this property defines line height, in pixels. If the actual line height (including all pictures and controls) is not equal to this value, additional spacing is added/subtracted (below and above the line).

Default value:

100


TCustomRVParaInfo.LineSpacingType
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.LineSpacingType

Defines type of line spacing in paragraphs of this style.

type

  TRVLineSpacingType = (rvlsPercent, rvlsSpaceBetween);

property LineSpacingType: Integer;

(Introduced in version 1.5, 11)

Value	Meaning
rvlsPercent	LineSpacing defines spacing in % of text height. Extra spacing is added/subtracted below lines.
rvlsSpaceBetween	LineSpacing is a value which will be added between lines, in "screen pixels" (when printing, it will be recalculated according to the printer resolution). This type of line spacing cannot be exported in RTF and HTML. Extra spacing is added below lines.
rvlsLineHeightAtLeast	LineSpacing defines minimal line height, in pixels. Extra spacing is added above and below lines.
rvlsLineHeightExact	LineSpacing defines line height, in pixels. Extra spacing is added/subtracted above and below lines.
Default value:

rvlsPercent


TCustomRVParaInfo.Options
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Options

Several options for paragraph

type

  TRVParaOption =

    (rvpaoNoWrap, rvpaoReadOnly,

      rvpaoStyleProtect, rvpaoDoNotWantReturns,

      rvpaoKeepLinesTogether, rvpaoKeepWithNext,

      rvpaoWidowOrphanControl);

  TRVParaOptions = set of TRVParaOption;

property Options: TRVParaOptions;

(Introduced in version 1.5 - 10)

Layout Options

Option	Meaning
rvpaoNoWrap	Disallows automatic word wrapping in paragraphs of this style. If you use no-wrap paragraphs, it's recommended to add rvoClientTextWidth in RichView.Options
Editing and Protection Options:

Option	Meaning
rvpaoReadOnly	Disallows editing paragraphs of this style in TRichViewEdit. This option does not protect from adding new paragraph when the user presses  Enter  at the beginning or at the end of  the paragraph. This option does not protect this paragraph from deletion together with the larger selection.
rvpaoStyleProtect	If set, ApplyParaStyle cannot change style of paragraphs of this style. This option does not protect from ApplyParaStyleConversion, but you can take it into account in OnParaStyleConversion event.
rvpaoDoNotWantReturns	If set,  Enter  key will be blocked if the caret is inside paragraph of this style.
Printing Options

Option	Meaning
rvpaoKeepLinesTogether	Paragraph of this style is printed on one page, if possible.
rvpaoKeepWithNext	Paragraph of this style is printed on the same page as the next paragraph, if possible.
rvpaoWidowOrphanControl	Reserved for future use.
Default value:

[]

See also:

•	TFontInfo.Protection;

•	TCustomRichView.WordWrap.


TCustomRVParaInfo.OutlineLevel
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.OutlineLevel

Defines outline level of paragraph.

property OutlineLevel: Integer;

(introduced in v12)

0 – no outline level (body text).

Positive values define levels of heading (1 – heading level 1; 2 – heading level 2, and so on).

Default value:

0


TCustomRVParaInfo.RightIndent
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.RightIndent

Right indent for paragraphs of this style, in pixels

property RightIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to printer resolution, so indents on page look like indents on screen.

Indent for paragraph from the right border = TCustomRichView.RightMargin+RightIndent.

In paragraphs with bullets or numbering, this property is overridden with LeftIndent of list level, if BiDiMode=rvbdRightToLeft.

Default value:

0

See also properties:

•	LeftIndent;

•	SpaceBefore, SpaceAfter.

See also properties of TRVListLevel:

•	LeftIndent.


TCustomRVParaInfo.SpaceAfter
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.SpaceAfter

Specifies the size of the spacing below the paragraph. Must be greater than or equal to zero.

property SpaceAfter: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to printer resolution, so spacing on page look like spacing on screen.

Default value:

0

See also properties:

•	SpaceBefore;

•	LeftIndent, RightIndent.


TCustomRVParaInfo.SpaceBefore
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.SpaceBefore

Specifies the size of the spacing above the paragraph. Must be greater than or equal to zero.

property SpaceBefore: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to printer resolution, so spacing on page look like spacing on screen.

Default value:

0

See also properties:

•	SpaceAfter;

•	LeftIndent, RightIndent.


TCustomRVParaInfo.Tabs
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Tabs

Defines tab stops and their properties for paragraphs of this style.

property Tabs: TRVTabInfos;

(introduced in v1.9)

This is a sorted collection of TRVTabInfo (sorted by Position in ascending order).

Default value:

Empty collection.

See also properties of TRVStyle:

•	DefTabWidth.


TCustomRVParaInfo.Assign
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Assign

Copies the contents of Source to this paragraph style.

procedure Assign(Source: TPersistent); override;

Call Assign to copy properties of TCustomRVInfo or TCustomRVParaInfo to this paragraph style.

See also:

•	TParaInfo.Assign (TParaInfo is inherited from TCustomRVParaInfo).


TCustomRVParaInfo.Create
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.Create

A constructor, creates and initializes a new instance of TCustomRVParaInfo.

constructor Create(Collection: TCollection);override;

The constructor initializes:

// Properties, inherited from TCustomRVInfo:

Standard        := True;

StyleName       := 'Paragraph Style';

// Properties defined in TCustomRVParaInfo:

Alignment       := rvaLeft;

LineSpacingType := 100;

LineSpacing     := rvlsPercent;

Other properties are initialized with zeros/False/empty values.

Note: usually, when you create a paragraph style in code, you should assign Standard := False.


TCustomRVParaInfo.IsEqual
 TRichView Reference | TRVStyle | TCustomRVParaInfo

TCustomRVParaInfo.IsEqual

Compares this paragraph style with Value.

function IsEqual(Value: TCustomRVParaInfo;

  IgnoreList: TRVParaInfoProperties): Boolean; dynamic;

(introduced in version 1.5)

Parameters:

Value – object to compare with this paragraph style. The class of this object is TCustomRVParaInfo or inherited from it.

IgnoreList – set of values identifying properties to ignore when comparing, see TRVParaInfoProperties.

The following properties are always ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

See also:

•	TParaInfo.IsEqual (TParaInfo is inherited from this class);

•	TCustomRVFontInfo.IsEqual.


TParaInfo
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo

Properties   Methods

This is a paragraph style. It defines attributes of paragraphs in TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit controls.

This is an item in the collection of TRVStyle.ParaStyles. The class of the collection itself is TParaInfos.

Unit RVStyle.

Syntax

TParaInfo = class(TCustomRVParaInfo)

Hierarchy

TObject

TPersistent

TCollectionItem

TCustomRVInfo

TCustomRVParaInfo

Properties

The most of properties are inherited from TCustomRVParaInfo.

The new properties are:

•	DefStyleNo – default text style for paragraph;

•	NextParaNo – index of paragraph style to apply after pressing  Enter  in editor.

Methods

IsEqual compares this paragraph style with another one.

You can use Assign method to assign:

•	TParaInfo to TParaInfo;

•	TCustomRVParaInfo to TParaInfo and vice versa.

See Also

•	TParaInfos – class of collection of paragraph styles;

•	TFontInfo – class of text style;

•	TRVListInfo – class of list style;

•	RichView Paragraphs.


TParaInfo.DefStyleNo
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo.DefStyleNo

Specifies the default text style for paragraphs of this style.

property DefStyleNo: Integer;

(introduced in version 1.8)

You can use the rvsDefStyle constant (= MaxInt, a large positive integer value) as a StyleNo parameter of AddNL and other methods for adding text.

It means using the paragraph's default text style, i.e. DefStyleNo property (or the 0-th style, if DefStyleNo=-1).

GetItemStyle method and CurTextStyleNo return a translated text style (they never return rvsDefStyle).

Use GetItem(i).StyleNo and ActualCurTextStyleNo to get the text style as is.

This is a "pilot" feature. Very probably, in future, links between text and paragraph styles will be implemented differently.

Default value:

-1


TParaInfo.NextParaNo
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo.NextParaNo

Index of default next paragraph style

property NextParaNo: Integer;

(Introduced in version 1.4)

Used in RichViewEdit. When user presses  Enter  key at the end of paragraph of this style, a new empty paragraph will be created using this new paragraph style. If NextParaNo=-1 then this new line will have the same paragraph style as the current paragraph.

Default value:

-1

See also:

•	TFontInfo.NextStyleNo.


TParaInfo.Assign
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo.Assign

Copies the contents of Source to this paragraph style.

procedure Assign(Source: TPersistent); override;

Call Assign to copy properties of TCustomRVInfo, TCustomRVParaInfo, or TParaInfo to this paragraph style.

Example:

// Copying paragraph style to paragraph style:

MyRVStyle.ParaStyles[0].Assign(MyRVStyle.ParaStyles[1]);

// or, the same:

MyRVStyle.ParaStyles[0] := MyRVStyle.ParaStyles[1];


TParaInfo.Create
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo.Create

A constructor, creates and initializes a new instance of TParaInfo.

constructor Create(Collection: TCollection);override;

In addition to initializations performed by the inherited constructor, this methods initializes:

DefStyleNo := -1;

NextParaNo := -1;

Note: usually, when you create a paragraph style in code, you should assign Standard := False.


TParaInfo.IsEqual
 TRichView Reference | TRVStyle | TParaInfo

TParaInfo.IsEqual

Compares this paragraph style with Value.

function IsEqual(Value: TCustomRVParaInfo;

  IgnoreList: TRVParaInfoProperties): Boolean; override;

(introduced in version 1.5)

Parameters:

Value – object to compare with this paragraph style. The class of this object is TCustomRVParaInfo or inherited from it.

IgnoreList – set of values identifying properties to ignore when comparing, see TRVParaInfoProperties.

The following properties are always ignored when comparing styles:

•	Standard;

•	StyleName (if RichViewCompareStyleNames=False (default)).

See also:

•	TCustomRVParaInfo.IsEqual (method of the ancestor class);

•	TParaInfos.FindSuchStyle;

•	TFontInfo.IsEqual.


TRVListInfo
 TRichView Reference | TRVStyle | TRVListInfo

TRVListInfo

Properties   Methods

This is a paragraph list style. It defines attributes of list markers in TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit controls.

This is an item in the collection of TRVStyle.ListStyles. The class of the collection itself is TRVListInfos.

Unit RVStyle.

Syntax

TRVListInfo = class(TCustomRVInfo)

Hierarchy

TObject

TPersistent

TCollectionItem

TCustomRVInfo

Properties

•	Levels – collection of list levels (TRVListLevel)

•	OneLevelPreview suggests appearance of thumbnail.

Other properties are inherited from TCustomRVInfo.

Methods

•	AllNumbered returns True if all levels represent numbered lists;

•	HasNumbering returns True if at least one of list levels represents a numbered list.

See Also

•	TRVListInfos – class of collection of paragraph list styles;

•	TFontInfo – class of text style;

•	TParaInfo – class of paragraph style;

•	List markers item type.


TRVListInfo.Levels
 TRichView Reference | TRVStyle | TRVListInfo

TRVListInfo.Levels

Levels of paragraph list style, collection of TRVListLevel objects.

property Levels: TRVListLevelCollection;

Each level defines properties for bullet or numbering of paragraphs.


TRVListInfo.OneLevelPreview
 TRichView Reference | TRVStyle | TRVListInfo

TRVListInfo.OneLevelPreview

Can be used by application to define appearance of preview thumbnail for this list style.

property OneLevelPreview: Boolean

This property is not used by the components themselves.

If application creates thumbnails in dialog for selecting list style, this property can be used to define thumbnail image.

If it is True, only one level of this list should be shown on the thumbnail.

See also:

•	Levels.


TRVListInfo.AllNumbered
 TRichView Reference | TRVStyle | TRVListInfo

TRVListInfo.AllNumbered

Returns True if all levels represent numbered lists

function AllNumbered: Boolean;

See also:

•	HasNumbering.


TRVListInfo.HasNumbering
 TRichView Reference | TRVStyle | TRVListInfo

TRVListInfo.HasNumbering

Returns True if at least one of list levels represents a numbered list.

function HasNumbering: Boolean;

See also:

•	AllNumbered.


TRVBackgroundRect
 TRichView Reference | TRVStyle | TRVBackgroundRect

TRVBackgroundRect

Properties

This class defines background of paragraph (colored rectangle). This is a class of Background property of paragraph style.

Unit RVStyle.

Syntax

TRVBackgroundRect = class (TPersistent)

(Introduced in version 1.2)

Properties:

•	BorderOffsets;

•	Color.

See also:

•	TCustomRVParaInfo.Background;

•	Paragraph Borders and Background.


TRVBackgroundRect.BorderOffsets
 TRichView Reference | TRVStyle | TRVBackgroundRect

TRVBackgroundRect.BorderOffsets

Distance between paragraph content and border.

property BorderOffsets: TRVRect;

Offsets are measured in "screen" pixels, so when printing they are recalculated according to printer resolution, so offsets on page look like offsets on screen.

Lager positive values increase hanging. Negative values force border to be inside the paragraph content.

Warning:

•	Background.BorderOffsets.Top must not exceed SpaceBefore property of the same paragraph.

•	Background.BorderOffsets.Bottom must not exceed SpaceAfter property of the same paragraph.

•	Background.BorderOffsets.Left should not exceed LeftIndent property of the same paragraph.

•	Background.BorderOffsets.Right should not exceed RightIndent property of the same paragraph.

Default value:

0,0,0,0 (border is drawn around the paragraph without gaps)

See also:

•	Paragraph Background


TRVBackgroundRect.Color
 TRichView Reference | TRVStyle | TRVBackgroundRect

TRVBackgroundRect.Color

Color of paragraph background.

property Color: TColor

Default value:

clNone (transparent background)


TRVBorder
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder

Properties

This class defines border around paragraph. This is a class of Border property of paragraph style.

Unit RVStyle.

Syntax

TRVBorder = class (TPersistent)

(Introduced in version 1.2)

Properties:

•	BorderOffsets – distance between paragraph content and border;

•	Color – border color;

•	InternalWidth – distance between border lines (for double and triple borders);

•	Style – border style;

•	VisibleBorders hides/shows border sides;

•	Width – line width.

See also:

•	TCustomRVParaInfo.Border;

•	Paragraph Borders and Background.


TRVBorder.BorderOffsets
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.BorderOffsets

Spacing between paragraph content and border.

property BorderOffsets: TRVRect;

Offsets are measured in "screen" pixels, when printing they are recalculated according to the printer resolution, so offsets on page look like offsets on screen.

Lager positive values increase spacing. Negative values force the border to be inside the paragraph content.

Warning:

•	Border.BorderOffsets.Top must not exceed SpaceBefore property of the same paragraph.

•	Border.BorderOffsets.Bottom must not exceed SpaceAfter property of the same paragraph.

•	Border.BorderOffsets.Left should not exceed LeftIndent property of the same paragraph.

•	Border.BorderOffsets.Right should not exceed RightIndent property of the same paragraph.

Default value:

0,0,0,0

See also:

•	Paragraph Borders.


TRVBorder.Color
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.Color

Color of border

property Color: TColor

This property cannot be used to hide the border. To hide border, set Style=rvbsNone.

Default value:

clWindowText


TRVBorder.InternalWidth
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.InternalWidth

Spacing between lines (centers of lines) in double and triple borders.

property InternalWidth: Integer

For example, if Style=rvbDouble, InternalWidth=1, and Width=1, you'll see two lines having 1-pixel width, with 1-pixel spacing between them.

Default value:

1


TRVBorder.Style
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.Style

Style of border

property Style: TRVBorderStyle;

See TRVBorderStyle for possible values.

Default value:

rvbNone (no border)


TRVBorder.VisibleBorders
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.VisibleBorders

Defines which sides of border are visible.

property VisibleBorders: TRVBooleanRect;

Default value:

True, True, True, True (all sides are visible, but border is still invisible because its Style=rvbNone by default)


TRVBorder.Width
 TRichView Reference | TRVStyle | TRVBorder

TRVBorder.Width

Width of border lines.

property Width:Integer;

It's not necessary a width of border (it is a width of border only if Style=rvbSingle).

It's a width of lines in the border.

Thick lines (Style=rvbThickInside or rvbThickOutside) have double width.

Default value:

1


TRVTabInfos
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos

Properties   Methods

Collection of tab stops (TRVTabInfo) and their properties.

This is a type of TRVStyle.ParaStyles[i].Tabs property.

Unit RVStyle.

Syntax

TRVTabInfos = class(TCollection)

(introduced in version 1.9)

Hierarchy

TObject

TPersistent

TCollection

Using

This collection is sorted in ascending order by Position properties of its items.

When you add a new tab stop (using Add method), it is added to the end of the collection. When you assign its Position, it is moved to the proper place.

Main properties:

•	Items;

•	Count.


TRVTabInfos.Items
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos.Items

Provides indexed access to the items in the collection of tab stops for the paragraph.

property Items[Index:Integer]: TRVTabInfo;

This is the default property of TRVTabInfos, so you can write

MyRVStyle.ParaStyles[i].Tabs[j]

instead of

MyRVStyle.ParaStyles[i].Tabs.Items[j].


TRVTabInfos.AddFrom
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos.AddFrom

Adds tab stops from Source.

procedure AddFrom(Source: TRVTabInfos);

New tab stops are inserted, existing tab stops are updated.

(tab stops are compared by their Position property)

The collection remains sorted.


TRVTabInfos.DeleteList
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos.DeleteList

Deletes tab stops at the specified Positions

procedure DeleteList(Positions: TRVIntegerList);

All tab stops having Position property equal to one of values in Positions are deleted.


TRVTabInfos.Find
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos.Find

Returns the index of tab stop with the given Position (or -1 if not found).

function Find(Position: Integer): Integer;

This function compares value of Position parameter with value of Position property of tab stops.


TRVTabInfos.Intersect
 TRichView Reference | TRVStyle | TRVTabInfos

TRVTabInfos.Intersect

Deletes all tab stops that do not present in Value. Only tab stops with all common properties are not deleted.

procedure Intersect(Value: TRVTabInfos);


TRVTabInfo
 TRichView Reference | TRVStyle | TRVTabInfo

TRVTabInfo

Properties

Defines properties for tab stop. This is a type of item in TRVStyle.ParaStyles[i].Tabs collection.

Unit RVStyle.

Syntax

TRVTabInfo = class(TCollectionItem)

(introduced in version 1.9)

Hierarchy

TObject

TPersistent

TCollectionItem

Properties

Position – distance of this tab stop from LeftMargin;

Align – alignment of tab relating to the followed text;

Leader – text to fill this tabulator.


TRVTabInfo.Align
 TRichView Reference | TRVStyle | TRVTabInfo

TRVTabInfo.Align

Defines tab stop alignment (relative to the text after this tab stop)

type

  TRVTabAlign = ( rvtaLeft, rvtaRight, rvtaCenter );

property Align: TRVTabAlign;

Image:

Alignments are inverted for right-to-left paragraphs.

Default value:

rvtaLeft

See also:

•	Position.


TRVTabInfo.Leader
 TRichView Reference | TRVStyle | TRVTabInfo

TRVTabInfo.Leader

Repeated text to fill the tabulator space.

property Leader: String;

Only the following values of this property can be saved in RTF

Character	Description
.	dot
-	hyphen
_	underscore character
·	#$B7, middle dot
=	equals sign
Default value:

'' (empty string)


TRVTabInfo.Position
 TRichView Reference | TRVStyle | TRVTabInfo

TRVTabInfo.Position

Defines distance of this tab stop from LeftMargin, pixels

property Position: Integer;

For right-to-left paragraphs, the distance is measured from RightMargin.

This value is measured in "screen pixels" (when printing, it is recalculated according to the printer resolution).

Collections of tab stops (TRVStyle.ParaStyles[i].Tabs) are sorted by this property in ascending order. They are resorted automatically when you assign value to this property.

Do not rely on index of item in this collection after assigning this property:

Wrong:

ParaStyle.Tabs[i].Position := 10;

ParaStyle.Tabs[i].Align := rvtaRight; // index of this tab stop may be changed!

Correct:

ParaStyle.Tabs[i].Align := rvtaRight;

ParaStyle.Tabs[i].Position := 10;

or

with ParaStyles.Tabs[i] do

begin

  Position := 10;

  Align := rvtaRight;

end;

Default value:

0


TRVListLevelCollection
 TRichView Reference | TRVStyle | TRVListLevelCollection

TRVListLevelCollection

Properties   Methods

Collection of list levels. Each level (TRVListLevel) defines properties for bullet or numbering of paragraphs.

This is a class of Levels property of list styles.

Unit RVStyle.

Syntax

TRVListLevelCollection = class(TCollection)

Hierarchy

TObject

TPersistent

TCollection

Main Properties

Items – array of TRVListLevel.


TRVListLevelCollection.Items
 TRichView Reference | TRVStyle | TRVListLevelCollection

TRVListLevelCollection.Items

Provides indexed access to the items in the collection of paragraph list levels (bullets and numbering)

property Items[Index:Integer] : TRVListLevel;

Each level defines properties for bullet or numbering of paragraphs.


TRVListLevelCollection.Add
 TRichView Reference | TRVStyle | TRVListLevelCollection

TRVListLevelCollection.Add

Adds a new style to the collection of list levels.

function Add: TRVListLevel;

This method overrides TCollection.Add method to return TRVListLevel instance.

Call Add to create a new level in the collection. The new item is placed at the end of the Items array.

Add returns the new collection item.


TRVListLevel
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel

Properties   Methods

One level of paragraph list, defines properties for bullet or numbering. This is a class of item in the Levels collection of list style.

Unit RVStyle.

Syntax

TRVListLevel = class(TCollectionItem)

Hierarchy

TObject

TPersistent

TCollectionItem

Properties

Layout:

•	FirstIndent, LeftIndent override the corresponding properties of paragraph style;

•	MarkerIndent – indent of marker;

•	MarkerAlignment – position of marker relative to MarkerIndent.

List marker:

•	ListType – type of marker (bullet, number, image, etc.);

•	Font – font for text markers;

•	Picture – picture, used if ListType =rvlstPicture;

•	ImageList, ImageIndex – used if ListType in [rvlstImageList, rvlstImageListCounter];

•	FormatString – format string for displaying text markers (except for ListType=rvlstUnicodeBullet);

•	FormatStringW – text for Unicode bullets (ListType=rvlstUnicodeBullet).

Numbering:

•	StartFrom – initial counter value for numbered lists;

•	Options – numbering options for this list level.


TRVListLevel.FirstIndent
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.FirstIndent

Indent for the first line of paragraph text, relative to LeftIndent.

property FirstIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, so indents on the page look like indents on the screen.

This value can be negative.

This property overrides FirstIndent of paragraph style for bulleted/numbered paragraphs.

If this value is less than width of marker, text is shifted to the right beyond the FirstIndent to avoid overlapping.

Default value:

10

See also properties:

•	LeftIndent,

•	MarkerIndent.

See also properties of TCustomRichView:

•	LeftMargin.


TRVListLevel.Font
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.Font

Font for text markers.

type

 TRVMarkerFont = class (TFont);

 property Font: TRVMarkerFont;

This font is used for the following list types:

•	rvlstBullet,

•	rvlstDecimal,

•	rvlstLowerAlpha,

•	rvlstUpperAlpha,

•	rvlstLowerRoman,

•	rvlstUpperRoman,

•	rvlstUnicodeBullet.

Default value:

'Arial', 8


TRVListLevel.FormatString
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.FormatString

Defines format for text list markers.

property FormatString: String;

This property is used for the following list types:

•	rvlstBullet,

•	rvlstDecimal,

•	rvlstLowerAlpha,

•	rvlstUpperAlpha,

•	rvlstLowerRoman,

•	rvlstUpperRoman.

For rvlstBullet list type, it completely defines a text to display.

For rvlstDecimal..rvlstUpperRoman, it defines how to display numbers. The actual string  = Format(FormatString, [CL0, CL1, ..., CLN])

where

•	CL0 - string containing value of counter of the 0-th level marker;

•	CL1 - ---------------------"" ------------------------------- 1st level marker;

•	...

•	CLN - string containing value of counter of this level marker.

Example1:

FormatString = '*' // no numbering

  * aaaaa

  * aaaaa

  * aaaaa

Example2:

For 0-th level: FormatString = '%s.', ListType=rvlstDecimal

For 1-th level: FormatString = '%s.%s.', ListType=rvlstDecimal

  1. aaaaa

  2. aaaaa

    2.1. aaaaa

    2.2. aaaaa

  3. aaaaa

The same result will be with '%0:s.' and '%0:s.%1:s.'

Example3:

For 0-th level: FormatString = 'Chapter %s.', ListType=rvlstDecimal

For 1-th level: FormatString = '%1:s)', ListType=rvlstLowerAlpha

  Chapter 1. aaaaa

  Chapter 2. aaaaa

    a) aaaaa

    b) aaaaa

  Chapter 3. aaaaa

The same result will be with 'Chapter %0:s.' and '%1:s)'

Default value:

· (#$B7)

See also properties:

•	FormatStringW.


TRVListLevel.FormatStringW
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.FormatStringW

Text for Unicode text markers

property FormatStringW: WideString;

If ListType=rvlstUnicodeBullet, this text is displayed.

For Delphi/C++Builder 2009 or newer, this property makes no sense, because FormatString is Unicode too.

Default value:

'' (empty string)

See also properties:

•	FormatString.


TRVListLevel.ImageIndex
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.ImageIndex

Image index for bullets that show image from the image list

property ImageIndex: Integer;

If ListType=rvlstImageList, the marker of this list level is the ImageIndex-th image from ImageList.

If ListType=rvlstImageListCounter, the marker of this list level is the (Counter+ImageIndex-1)-th image from ImageList, there Counter is a value of counter for the given list marker.

List counter is numbered from StartFrom.

For example:

Value of Counter	ImageList Index
1	ImageIndex
2	ImageIndex+1
3	ImageIndex+2
4	ImageIndex+3
Default value:

0

See also properties:

•	StartFrom.


TRVListLevel.ImageList
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.ImageList

Image list for image of list marker

property ImageList: TCustomImageList;

ImageList is used If ListType is rvlstImageList or rvlstImageListCounter.

When saving lists of this type in RVF, RichView stores value of ImageList.Tag. When loading, OnRVFImageListNeeded occurs.

List level does not own this imagelist: it does not create and does not destroy it. It just has a link to it.

See also properties:

•	ImageIndex;

•	Picture.


TRVListLevel.LeftIndent
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.LeftIndent

Left indent of paragraph text.

property LeftIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, so indents on the page look like indents on the screen.

This value can be negative, but it's not recommended.

This property overrides LeftIndent of paragraph style for bulleted/numbered paragraphs. For right-to-left paragraphs, list marker is positioned to the right side of paragraph, and this property overrides RightIndent of paragraph style instead.

Default value:

0

See also properties:

•	FirstIndent,

•	MarkerIndent.

See also properties of TCustomRichView:

•	LeftMargin.


TRVListLevel.ListType
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.ListType

Type of list marker for this list level

type

  TRVListType = (rvlstBullet, rvlstPicture,

    rvlstImageList, rvlstDecimal,

    rvlstLowerAlpha, rvlstUpperAlpha,

    rvlstLowerRoman, rvlstUpperRoman,

    rvlstImageListCounter,rvlstUnicodeBullet);

property ListType: TRVListType;

Unnumbered List Types

List Type	Meaning
rvlstBullet	Unnumbered text (from FormatString property). See also Font.
rvlstUnicodeBullet	Unnumbered Unicode text (from FormatStringW property). See also Font.
rvlstPicture	Picture (from Picture property)
rvlstImageList	Image from imagelist (ImageList and ImageIndex properties)
Numbered List Types

List Type	Meaning
rvlstDecimal	1, 2, 3,... (see FormatString, Font)
rvlstLowerAlpha	a, b, c, ..., z, aa, ab, ... (see FormatString, Font)
rvlstUpperAlpha	A, B, C, ..., Z, AA, AB, ... (see FormatString, Font)
rvlstLowerRoman	i, ii, iii, iv, ... (see FormatString, Font)
rvlstUpperRoman	I, II, III, IV, ... (see FormatString, Font)
rvlstImageListCounter	Image from image list, depending on counter (ImageList and ImageIndex properties)

Default value:

rvlstBullet


TRVListLevel.MarkerAlignment
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.MarkerAlignment

Defines marker alignment relative to the MarkerIndent

type

  TRVMarkerAlignment = (rvmaLeft, rvmaRight, rvmaCenter);

property MarkerAlignment: TRVMarkerAlignment;

Default value:

rvmaLeft


TRVListLevel.MarkerIndent
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.MarkerIndent

Indent of list marker

property MarkerIndent: Integer;

This value is measured in "screen" pixels, so when printing it's recalculated according to the printer resolution, so indents on the page look like indents on the screen.

This value can be negative, but it's not recommended.

The image above shows the position of left-aligned marker. See MarkerAlignment property.

Default value:

0

See also properties:

•	FirstIndent;

•	LeftIndent.

See also properties of TCustomRichView:

•	LeftMargin.


TRVListLevel.Options
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.Options

List level options

type

  TRVListLevelOption =

    (rvloContinuous, rvloLevelReset, rvloLegalStyleNumbering);

  TRVListLevelOptions = set of TRVListLevelOption;

If rvloLevelReset is in Options, numbering will be like this:

  1. aaaa

    a) aaaa

    b) aaaa

  2. aaaa

    a) aaaa

    b) aaaa

 If it is excluded, numbering will be like this:

  1. aaaa

    a) aaaa

    b) aaaa

  2. aaaa

    c) aaaa

    d) aaaa

If rvloLegalStyleNumbering is in Options, all roman and alpha numbering of higher levels will be changed to decimals, like this:

  I. aaaa

    1.1 aaaa

    1.2 aaaa

  II. aaa

Otherwise:

  I. aaaa

    I.1 aaaa

    I.2 aaaa

  II. aaa

rvloContinuous is reserved for future use.

Default value:

[rvloContinuous, rvloLevelReset]


TRVListLevel.Picture
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.Picture

Picture for list marker

property Picture: TPicture;

This property is used if ListType=rvlstPicture.


TRVListLevel.StartFrom
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.StartFrom

Starting value for marker counter

property StartFrom: Integer;

For example, if StartFrom for Levels[1]=0:

  1. aaaaa

    0) aaaaa

    1) aaaaa

  2. aaaaa

Default value:

1

See also:

•	ListType.


TRVListLevel.HasNumbering
 TRichView Reference | TRVStyle | TRVListLevel

TRVListLevel.HasNumbering

Returns True if this list level is numbered

function HasNumbering: Boolean;

This method returns

Result := ListType in [rvlstDecimal, rvlstLowerAlpha, rvlstUpperAlpha,

  rvlstLowerRoman, rvlstUpperRoman, rvlstImageListCounter].


TRVPrint
 TRichView Reference | TRVPrint

 TRVPrint

Properties   Methods   Events

This component allows printing TRichView, TRichViewEdit, TDBRichView, or TDBRichViewEdit. It is Invisible at run-time.

Unit PtblRV;

Syntax

TRVPrint = class(TCustomRVPrint)

Hierarchy

TObject

TPersistent

TComponent

TCustomRVPrint

How to Use

1.	Assign the source component for printing (AssignSource method).

2.	(optionally) Assign header and/or footer (SetHeader, SetFooter).

3.	Format pages (FormatPages method).

4.	Now you can:

•	get a number of pages (PagesCount property);

•	display a print preview (using TRVPrintPreview component; see also DrawPreview, MakePreview MakeScaledPreview methods);

•	print the whole document (Print method) or range of pages (PrintPages method).

5.	When finished, you can release some temporally allocated memory (Clear).

Events

You can display some information about the process of repaginating and printing:

•	OnFormatting occurs during repaginating (FormatPages method);

•	OnSendingToPrinter occurs during printing (Print and PrintPages methods).

You can draw additional content using the following events:

•	OnPagePrepaint and OnPagePostpaint allow to draw on each page below/over TRichView document;

•	OnPrintComponent requests image of inserted control for printing.

Margins

There are four properties: LeftMarginMM RightMarginMM, TopMarginMM,BottomMarginMM.

This picture illustrates the meaning of margin properties. Paragraph indents are not shown for simplification.

LeftMarginMM, RighMarginMM, TopMarginMM, BottomMarginMM are measured in millimeters (shown in red).

TRichView.LeftMargin, TRichView.RightMargin, TRichView.TopMargin and TRichView.BottomMargin are measured in "screen pixels" (they are recalculated according to the printer resolution, and margins on the page look like margins on the screen; shown in blue).

Left and right margins can be swapped for even pages, if MirrorMargins is set to True.

See also ClipMargins property.

Headers and Footers

The current implementation of headers and footers is preliminary. It allows to print the same header and footer on all pages. Any RichView document can be assigned as a header or footer. Positions of header and footer are defined by HeaderYMM and FooterYMM.

If header and/or footer is too long, size of the main document is adjusted to avoid overlapping:

If you want different header / footer for different pages, consider:

•	printing document in several parts, each of them with its own header/footer;

•	using OnPagePrepaint event;

•	using TRVReportHelper.

See also: GetHeaderRect, GetFooterRect.

Document inside RVPrint

RVPrint contains an instance of TPrintableRV (descendant of TRichView) inside. This variable (named rv) is public and you can change some properties of it:

•	Color,

•	BackgroundStyle,

•	BackgroundBitmap.

Changing other its properties is not recommended.

Example:

MyRVPrint.rv.Color := clWhite;

Note: this richview does not contain the full information about the printed document, just a formatting information; so you must provide that source RichView is not destroyed while you are printing.

Tips and Tricks

See http://www.trichview.com/forums/viewtopic.php?p=250.

See Also

See also:

•	UpdatePaletteInfo method;

•	TRichView.PageBreaksBeforeItems;

•	TRichView.AssignSoftPageBreaks;

•	TRVReportHelper components;

•	RichViewAlternativePicPrint typed constant;

•	RichViewPixelsPerInch typed constant.

Demo projects:

•	Demos\Delphi\Assorted\Printing\

•	Demos\CBuilder\Assorted\Printing\


TRVPrint.BottomMarginMM
 TRichView Reference | TRVPrint

TRVPrint.BottomMarginMM

Bottom margin of page, mm.

property BottomMarginMM: Integer;

You need to reformat pages after changing value of this property, see FormatPages.

See also the picture in the TRVPrint main topic.

Default value:

20

See also:

•	LeftMarginMM, RightMarginMM, TopMarginMM;

•	FooterYMM.


TRVPrint.ClipMargins
 TRichView Reference | TRVPrint

TRVPrint.ClipMargins

Disallows printing on margins.

property ClipMargins: Boolean

(introduced in version 1.7)

If True, all drawing that does not fit the printable area (for example, large pictures) is cropped.

Default value:

False


TRVPrint.FixMarginsMode
 TRichView Reference | TRVPrint

TRVPrint.FixMarginsMode

Specifies how to work with too small margins (less than the printer supports).

type

  TRVFixMarginsMode = (rvfmmAutoCorrect, rvfmmIgnore);

property FixMarginsMode: TRVFixMarginsMode;

(introduced in version 10)

Mode	Meaning
rvfmmAutoCorrect	Minimal supported margins are used (if the left and/or the top margin were too small, the output is moved to the right and/or down)
rvfmmIgnore	The specified values of margins are used (document may be cropped)
Default value:

rvfmmAutoCorrect

See also properties of TRVPrint:

•	LeftMarginMM

•	RightMarginMM;

•	TopMarginMM;

•	BottomMarginMM.


TRVPrint.FooterYMM
 TRichView Reference | TRVPrint

TRVPrint.FooterYMM

Vertical position of page footer, mm.

property FooterYMM: Integer;

(introduced in version 1.7)

This is a distance from the bottom of page to the bottom of footer. If footer is not assigned, this property is ignored.

Default value:

10

See also:

•	HeaderYMM.

See also methods:

•	SetFooter.


TRVPrint.HeaderYMM
 TRichView Reference | TRVPrint

TRVPrint.HeaderYMM

Vertical position of page header, mm.

property HeaderYMM: Integer;

(introduced in version 1.7)

This is a distance from the top of page to the top of header.

If header is not assigned, this property is ignored.

Default value:

10

See also:

•	FooterYMM.

See also methods:

•	SetHeader.


TRVPrint.LeftMarginMM
 TRichView Reference | TRVPrint

TRVPrint.LeftMarginMM

Left margin of page, mm

property LeftMarginMM: Integer;

You need to reformat pages after changing value of this property, see FormatPages.

See also the picture in the TRVPrint main topic.

Default value:

20

See also:

•	RightMarginMM, TopMarginMM, BottomMarginMM;

•	MirrorMargins.


TRVPrint.MirrorMargins
 TRichView Reference | TRVPrint

TRVPrint.MirrorMargins

If set to true, LeftMarginMM and RightMarginMM will be swapped for even pages.

property MirrorMargins: Integer;

(introduced in version 1.6)

Default value:

False


TRVPrint.Preview100PercentHeight
 TRichView Reference | TRVPrint

TRVPrint.Preview100PercentHeight (read-only)

Height of page when drawing preview on screen at 100% scale, pixels.

property Preview100PercentHeight: Integer;

Mainly for internal use.


TRVPrint.Preview100PercentWidth
 TRichView Reference | TRVPrint

TRVPrint.Preview100PercentWidth (read-only)

Width of page when drawing preview on screen at 100% scale, pixels.

property Preview100PercentWidth: Integer;

Mainly for internal use.


TRVPrint.RightMarginMM
 TRichView Reference | TRVPrint

TRVPrint.RightMarginMM

Right margin of page, mm

property RightMarginMM: Integer;

You need to reformat page after changing value of this property, see FormatPages.

See also the picture in the TRVPrint main topic.

Default value:

20

See also:

•	LeftMarginMM, TopMarginMM, BottomMarginMM;

•	MirrorMargins.


TRVPrint.TopMarginMM
 TRichView Reference | TRVPrint

TRVPrint.TopMarginMM

Top margin of page, mm

property TopMarginMM: Integer;

You need to reformat pages after changing value of this property, see FormatPages.

See also picture in TRVPrint main topic.

Default value:

20

See also:

•	LeftMarginMM, RightMarginMM, BottomMarginMM;

•	HeaderYMM.


TRVPrint.AssignDocParameters
 TRichView Reference | TRVPrint

TRVPrint.AssignDocParameters

Assigns properties from DocParameters.

procedure AssignDocParameters(DocParameters: TRVDocParameters);

(introduced in version 10)

This procedure assigns the following properties:

•	LeftMarginMM, RightMarginMM, TopMarginMM, BottomMarginMM;

•	HeaderYMM, FooterYMM;

•	MirrorMargins.

Sizes are converted from Units to millimeters.

This method does not assign printer properties (page size and orientation).


TRVPrint.AssignSource
 TRichView Reference | TRVPrint

TRVPrint.AssignSource

Assigns document for printing.

procedure AssignSource(PrintMe: TCustomRichView);

You can print document in the following components:

•	TRichView,

•	TRichViewEdit,

•	TDBRichView,

•	TDBRichViewEdit.

Document is not copied to RVPrint, so do not modify and do not destroy it until printing is complete.

See also:

•	SetHeader;

•	SetFooter.


TRVPrint.Create
 TRichView Reference | TRVPrint

TRVPrint.Create

A constructor, creates and initializes a TRVPrint instance.

constructor Create(AOwner: TComponent);override;

Use Create to instantiate TRVPrint object at runtime. TRVPrint objects placed on forms at design time are created automatically. Specify the owner of the new TRVPrint object using the AOwner parameter.


TRVPrint.DrawPreview
 TRichView Reference | TRVPrint

TRVPrint.DrawPreview

Draws print preview of the pgNo-th page to PageRect rectangle of Canvas.

procedure DrawPreview(pgNo: Integer; Canvas:  TCanvas; const PageRect: TRect);

There is more convenient way to display print preview: TRVPrintPreview component.

The page image is scaled to fit PageRect. To maintain correct proportions, you can use Preview100PercentWidth and Preview100PercentHeight properties.

pgNo must be in range from 1 to PagesCount.

You need to assign source document for printing (AssignSource method) and format pages (FormatPages method) before calling this method.

See also methods:

•	MakePreview;

•	MakeScaledPreview.

See also properties:

•	PreviewCorrection;

•	PagesCount.

See also events:

•	OnPrintComponent;

•	OnPagePrepaint;

•	OnPagePostpaint.


TRVPrint.FormatPages
 TRichView Reference | TRVPrint

TRVPrint.FormatPages

Prepare document to formatting

function FormatPages(PrintOptions:TRVDisplayOptions): Integer;

Please use rvdoAll constant for PrintOptions parameter:

FormatPages(rvdoAll);

Document must be assigned to this TRVPrint object using AssignSource method before calling this method.

This method allocates some temporal memory what is used when drawing preview and printing. When you finish, call Clear to release this memory.

Note for C++Builder users:

C++Builder (at least version 5) incorrectly translates rvdoAll constant.

The recommended call is

RVPrint->FormatPages(TRVDisplayOptions())

(i.e. initialization with the empty set; this parameter is for compatibility, and it is not used any more)

See also methods:

•	Clear.

See also events:

•	OnFormatting.


TRVPrint.GetFooterRect
 TRichView Reference | TRVPrint

TRVPrint.GetFooterRect

Returns coordinates of the page footer, pixels

function GetFooterRect: TRect;

(introduced in version 1.7)

If the footer is empty, the function returns an empty rectangle (Rect(0,0,0,0)).

This function may be called only when the document is prepared for printing (see FormatPages).

This function can be used in OnPagePrepaint and OnPagePostpaint events.

See also:

•	SetFooter;

•	GetHeaderRect.


TRVPrint.GetHeaderRect
 TRichView Reference | TRVPrint

TRVPrint.GetHeaderRect

Returns coordinates of the page header, pixels

function GetHeaderRect: TRect;

(introduced in version 1.7)

If the header is empty, the function returns an empty rectangle (Rect(0,0,0,0)).

This function may be called only when the document is prepared for printing (see FormatPages)

This function can be used in OnPagePrepaint and OnPagePostpaint events.

See also:

•	SetHeader;

•	GetFooterRect.


TRVPrint.MakePreview
 TRichView Reference | TRVPrint

TRVPrint.MakePreview

Draws print preview of the pgNo-th page to bitmap bmp.

procedure MakePreview(pgNo: Integer; bmp: TBitmap);

There is more convenient way to display print preview: TRVPrintPreview component.

pgNo must be in range from 1 to PagesCount.

This method changes size of bitmap to (Preview100PercentWidth x Preview100PercentHeight) and draws print preview of the pgNo-th page into it.

You need to assign source document for printing (AssignSource method) and format pages (FormatPages method) before calling this method.

See also methods:

•	MakeScaledPreview;

•	DrawPreview.

See also properties:

•	PreviewCorrection;

•	PagesCount.

See also events:

•	OnPrintComponent;

•	OnPagePrepaint;

•	OnPagePostpaint.


TRVPrint.MakeScaledPreview
 TRichView Reference | TRVPrint

TRVPrint.MakeScaledPreview

Draws print preview of the phNo-th page to bitmap bmp.

procedure MakeScaledPreview(pgNo: Integer; bmp: TBitmap);

There is more convenient way to display print preview: TRVPrintPreview component.

pgNo must be in range from 1 to PagesCount.

This method does not change size of bitmap, and draws the page in full bitmap size. To maintain correct proportions, you can use Preview100PercentWidth and Preview100PercentHeight properties.

You need to assign source document for printing (AssignSource method) and format pages (FormatPages method) before calling this method.

See also methods:

•	MakePreview;

•	DrawPreview.

See also properties:

•	PreviewCorrection;

•	PagesCount.

See also events:

•	OnPrintComponent;

•	OnPagePrepaint;

•	OnPagePostpaint.


TRVPrint.Print
 TRichView Reference | TRVPrint

TRVPrint.Print

Prints the whole document

procedure Print(Title: String; Copies: Integer; Collate: Boolean);

Parameters

Title – the text that is listed in the Print Manager when printing.

Copies  –  specifies the number of copies to print.

Collate  –  if more than one copy is selected, specifies whether you want the copies to be collated.

You need to assign source document for printing (AssignSource method) and format pages (FormatPages method) before calling this method.

Print(Title, Copies, Collate)

is equivalent to

PrintPages(1, PagesCount, Title, Copies, Collate)

See also methods:

•	PrintPages;

See also events:

•	OnSendingToPrinter;

•	OnPrintComponent;

•	OnPagePrepaint;

•	OnPagePostpaint.


TRVPrint.ContinuousPrint
 TRichView Reference | TRVPrint

TRVPrint.ContinuousPrint

Prints the whole document in the current printing job.

procedure ContinuousPrint;

This method is useful if you need to print several documents in one printing job. Otherwise, use Print or PrintPages methods.

Example 1: How to print several documents in one printing job

In this example, the same RVPrint is used to print RichView1 and RichView2. This code starts printing RichView2 on the page where RichView1 ends.

Printer.BeginDoc;

// printing RichView1

RVPrint.StartAt := 0;

RVPrint.TransparentBackground := True;

RVPrint.AssignSource(RichView1);

RVPrint.FormatPages(rvdoALL);

RVPrint.ContinuousPrint;

// printing RichView2

RVPrint.StartAt := RVPrint.EndAt;

RVPrint.AssignSource(RichView2);

RVPrint.FormatPages(rvdoALL);

RVPrint.ContinuousPrint;

Printer.EndDoc;

Example 2: How to mix portrait and landscape orientations in one printing job

In this example, the same RVPrint is used to print RichView1 and RichView2 in different orientations.

Printer.BeginDoc;

// printing RichView1 in portrait orientation

Printer.Orientation := poPortrait;

RVPrint.AssignSource(RichView1);

RVPrint.FormatPages(rvdoALL);

RVPrint.ContinuousPrint;

// printing RichView2 in landscape orientation

Printer.NewPage;

Printer.Orientation := poLandscape;

RVPrint.AssignSource(RichView2);

RVPrint.FormatPages(rvdoALL);

RVPrint.ContinuousPrint;

Printer.EndDoc;


TRVPrint.PrintPages
 TRichView Reference | TRVPrint

TRVPrint.PrintPages

Prints the range of pages, from FirstPgNo to LastPgNo

procedure PrintPages(FirstPgNo, LastPgNo: Integer; Title: String;

  Copies: Integer; Collate: Boolean);

Parameters

FirstPgNo – the first page to print, must be in range 1..PagesCount.

LastPgNo – the last page to print, must be in range 1..PagesCount.

Title – the text that is listed in the Print Manager when printing.

Copies  –  specifies the number of copies to print.

Collate  –  if more than one copy is selected, specifies whether you want the copies to be collated.

You need to assign source document for printing (AssignSource method) and format pages (FormatPages method) before calling this method.

See also methods:

•	Print.

See also events:

•	OnSendingToPrinter;

•	OnPrintComponent;

•	OnPagePrepaint;

•	OnPagePostpaint.


TRVPrint.SetFooter
 TRichView Reference | TRVPrint

TRVPrint.SetFooter

Assigns the page footer.

procedure SetFooter(RVData: TCustomRVData);

(introduced in version 1.7)

Document is not copied to RVPrint, so do not modify and do not destroy it until printing is complete.

If RVData is nil, footer is cleared.

This method must be called before FormatPages.

Example:

var

  RichView1: TRichView;

  RVPrint1: TRVPrint;

...

RVPrint1.SetFooter(RichView1.RVData);

See also:

•	SetHeader;

•	AssignSource.

See also properties:

•	FooterYMM;

•	LeftMarginMM;

•	RightMarginMM.


TRVPrint.SetHeader
 TRichView Reference | TRVPrint

TRVPrint.SetHeader

Assigns the page header.

procedure SetHeader(RVData: TCustomRVData);

(introduced in version 1.7)

Document is not copied to RVPrint, so do not modify and do not destroy it until printing is complete.

If RVData is nil, header is cleared.

This method must be called before FormatPages.

Example:

var

  RichView1: TRichView;

  RVPrint1: TRVPrint;

...

RVPrint1.SetHeader(RichView1.RVData);

See also

•	SetFooter;

•	AssignSource.

See also properties

•	HeaderYMM;

•	LeftMarginMM;

•	RightMarginMM.


TRVPrint.OnFormatting
 TRichView Reference | TRVPrint

TRVPrint.OnFormatting

Occurs while FormatPages method is executed.

type

  TRVPrintingEvent = procedure(Sender: TCustomRichView;

    PageCompleted: Integer;

    Step:TRVPrintingStep) of object;

property OnFormatting: TRVPrintingEvent;

In the first time, this event is generated with

PageCompleted=0, Step=rvpsStarting.

Next, this event occurs several times with

PageCompleted=<number of page which was formatted>, Step=rvpsProceeding.

In the last time, it occurs with

PageCompleted=0, Step=rvpsFinished.

Note1: Sender is a special RichView, internally contained in TRVPrint object.

Note2: The first step (preliminary formatting) takes 90% of time; subsequent repagination is quick.

See also methods:

•	FormatPages.

See also events:

•	OnSendingToPrinter.


TRVPrint.OnPagePostpaint
 TRichView Reference | TRVPrint

TRVPrint.OnPagePostpaint

Allows to draw on a page (paper and print preview)

type

  TRVPagePrepaintEvent = procedure (Sender: TRVPrint;

    PageNo: Integer; Canvas: TCanvas; Preview: Boolean;

    PageRect, PrintAreaRect: TRect) of object;

property OnPagePostpaint: TRVPagePrepaintEvent;

(introduced in version 1.7)

Sequence of actions:

1.	drawing background (if not transparent);

2.	OnPagePrepaint;

3.	drawing document;

4.	OnPagePostpaint.

Parameters

PageNo – page number (starting from 1);

Canvas – canvas where to draw;

Preview – "is this a preview drawing?"

PageRect – rectangle around the full page, pixels.

PrintAreaRect – rectangle around the document on the page (PageRect minus marginsMM), pixels.

See also:

•	GetHeaderRect;

•	GetFooterRect;

•	the picture in the TRVPrint main topic.


TRVPrint.OnPagePrepaint
 TRichView Reference | TRVPrint

TRVPrint.OnPagePrepaint

Allows to draw on a page (paper and print preview)

type

  TRVPagePrepaintEvent = procedure (Sender: TRVPrint;

    PageNo: Integer; Canvas: TCanvas; Preview: Boolean;

    PageRect, PrintAreaRect: TRect) of object;

property OnPagePrepaint: TRVPagePrepaintEvent;

(introduced in version 1.3)

Sequence of actions:

1.	drawing background (if not transparent);

2.	OnPagePrepaint;

3.	drawing document;

4.	OnPagePostpaint.

Parameters

PageNo – page number (starting from 1);

Canvas – canvas where to draw;

Preview – "is this a preview drawing?"

PageRect – rectangle around the full page, pixels.

PrintAreaRect – rectangle around the document on the page (PageRect minus marginsMM), pixels.

See also:

•	GetHeaderRect;

•	GetFooterRect;

•	the picture in the TRVPrint main topic;

•	example how to print pictures in this event: http://www.trichview.com/forums/viewtopic.php?t=58.


TRVPrint.OnSendingToPrinter
 TRichView Reference | TRVPrint

TRVPrint.OnSendingToPrinter

Occurs while methods Print or PrintPages are executed.

type

  TRVPrintingEvent = procedure(Sender: TCustomRichView;

    PageCompleted: Integer; Step:TRVPrintingStep) of object;

property OnSendingToPrinter: TRVPrintingEvent;

In the first time, this event is generated with

PageCompleted=0, Step=rvpsStarting.

Next, this event occurs several times with

PageCompleted=<number of page that was just printed>, Step=rvpsProceeding.

In the last time, it occurs with

PageCompleted=0, Step=rvpsFinished.

Note1: Sender is a special RichView, internally contained in TRVPrint object.

Note2: PageCompleted is an index of page (from 1), not a number of printed pages. The same value will be repeated several times in one call of Print or PrintPages when printing more than one copy.

See also methods:

•	Print;

•	PrintPages.

See also events:

•	OnFormatting.


TRVOfficeConverter
 TRichView Reference | TRVOfficeConverter

 TRVOfficeConverter

Properties   Methods   Events

TRVOfficeConverter allows using text converters from Microsoft Office with RichViews, for importing and exporting files in different formats.

Unit RVOfficeCnv;

Syntax

TRVOfficeConverter = class (TComponent)

(introduced in version 1.6)

Hierarchy

TObject

TPersistent

TComponent

How to Use

There are two types of converters: for importing and for exporting files.

Export converters convert RTF (Rich Text Format) to other formats, import converters convert different formats to RTF.

Lists of available converters are in ImportConverters and ExportConverters properties.

If there are no converters installed, converters lists are empty.

Note: some converters are shipped with Windows.

GetImportFilter and GetExportFilter return strings for assigning to Filter property of file-selection dialogs.

There are two modes for using this components.

1.	You can convert RTF from Stream to file in another format (ExportRTF), or you can convert file to RTF Stream (ImportRTF).

2.	You can export content of TRichView component in a file (ExportRV) or import from file (ImportRV). Such conversion still uses Stream internally.

While converting, the component generates OnConverting event.

If PreviewMode property is set to True, converters do their work silently, without displaying any dialogs. They can also produce lower quality results in this mode (that depends on a converter).

Demo projects

•	Demos\Delphi\OfficeConverters\

•	Demos\CBuilder\OfficeConverters\


TRVOfficeConverter.ErrorCode
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ErrorCode (read-only)

Returns error code of the last performed import or export operation (if it failed)

property ErrorCode: Integer;

(introduced in version 1.7)

Error codes returned by the component:

Constant	Value	Meaning
rvceCnvLoadError	1	error loading converter's DLL
rvceFuncError	2	required function is not found in the converter's DLL
rvceInitError	3	converter initialization failure
Some (not all) error codes returned by converters:

Constant	Value	Meaning
rvceOpenInFileErr	-1	could not open input file
rvceReadErr	-2	error during read
rvceOpenConvErr	-3	error opening conversion file
rvceWriteErr	-4	error during write
rvceInvalidFile	-5	invalid data in conversion file
rvceOpenExceptErr	-6	error opening exception file
rvceWriteExceptErr	-7	error writing exception file
rvceNoMemory	-8	out of memory
rvceInvalidDoc	-9	invalid document
rvceDiskFull	-10	out of space on output
rvceDocTooLarge	-11	conversion document too large for target
rvceOpenOutFileErr	-12	could not open output file
rvceUserCancel	-13	conversion canceled by user
rvceWrongFileType	-14	wrong file type for this converter


TRVOfficeConverter.ExcludeHTML-Converter
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ExcludeHTMLImportConverter, ExcludeHTMLExportConverter

These properties allow to exclude HTML converter from the list.

property ExcludeHTMLImportConverter: Boolean;

property ExcludeHTMLExportConverter: Boolean;

(introduced in version 1.7)

If ExcludeHTMLImportConverter=True, HTML import converter is excluded from the list of ImportConverters.(useful, if you have other function for HTML import).
If ExcludeHTMLExportConverter=True, HTML export converter is excluded from the list of ExportConverters.(RichView has methods (SaveHTML and SaveHTMLEx) allowing to save HTML better than this converter).

Default value

False


TRVOfficeConverter.ExportConverters
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ExportConverters (read only)

Collection of installed export converters. Export converters convert RTF to foreign formats.

property ExportConverters: TRVOfficeCnvList;

This is a list of TRVOfficeConverterInfo.

Order of converters in the list is arbitrary: on another computer, even if the same converters are installed, they may be listed in another order.

See also:

•	ImportConverters property;

•	GetExportFilter method.


TRVOfficeConverter.ExtensionsInFilter
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ExtensionsInFilter

Allows including file extensions in the file filter (GetImportFilter and GetExportFilter)

property ExtensionsInFilter: Boolean;

(introduced in version 1.7)

For example:

•	if ExtensionsInFilter=False, file filter entry would be 'Windows Write';

•	if ExtensionsInFilter=True, file filter entry would be 'Windows Write (*.wri)';

Default value:

False


TRVOfficeConverter.ImportConverters
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ImportConverters (read only)

Collection of installed import converters. Import converters convert foreign formats to RTF.

property ImportConverters: TRVOfficeCnvList;

This is a list of TRVOfficeConverterInfo.

Order of converters in the list is arbitrary: on another computer, even if the same converters are installed, they may be listed in another order.

See also:

•	ExportConverters property;

•	GetImportFilter method.


TRVOfficeConverter.PreviewMode
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.PreviewMode

Instructs converters to do their work without displaying dialogs

property PreviewMode: Boolean;

(introduced in v1.9)

If set to True, converters do their work silently, without displaying any dialogs. They can also produce lower quality results in this mode (that depends on converter).

Default value:

False


TRVOfficeConverter.Stream
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.Stream

A stream to store RTF (Rich Text Format) data.

property Stream: TMemoryStream;

Export converters convert RTF from this stream to file, import-converters convert file to this RTF stream.

The methods ExportRTF and ImportRTF work with this stream directly.

The methods ExportRV and ImportRV use this stream internally.


TRVOfficeConverter.Create
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.Create

A constructor, creates a new TRVOfficeConverter component.

constructor Create(AOwner: TComponent);

Use Create to instantiate TRVOfficeConverter object at runtime. RVOfficeConverters placed on forms at design time are created automatically. Specify the owner of the new RVOfficeConverter using the AOwner parameter.


TRVOfficeConverter.Destroy
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.Destroy

Destroys the RVOfficeConverter

destructor Destroy;


TRVOfficeConverter.ExportRTF
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ExportRTF

Exports RTF from Stream to file in foreign format.

function ExportRTF(const FileName: String; ConverterIndex: Integer): Boolean;

Parameters:

FileName is a name of file to save.

ConverterIndex is an index of export converter (in ExportConverters list).

When calling this method, Stream must contain RTF (Rich Text Format) document. The method start conversion from Stream.Position and stopped when reached the end of stream.

You can provide a visual indication for the conversion progress using OnConverting event.

Return value:

True if the export was successful, False if not.

See also:

•	ImportRTF;

•	ExportRV.

See also properties:

•	ErrorCode.


TRVOfficeConverter.ExportRV
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ExportRV

Exports content of rv to file in foreign format.

function ExportRV(const FileName: String; rv: TCustomRichView;

  ConverterIndex: Integer): Boolean;

Parameters:

FileName is a name of file to save.

ConverterIndex is an index of export converter (in ExportConverters list)

This method:

1.	clears Stream;

2.	saves RTF to Stream using rv.SaveRTFToStream;

3.	performs converting;

4.	clears Stream.

You can provide a visual indication for the conversion progress using OnConverting event.

Return value:

True if the export was successful, False if not.

See also:

•	ImportRTF;

•	ExportRV.

See also properties:

•	ErrorCode.


TRVOfficeConverter.GetExportFilter
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.GetExportFilter

Returns string that can be assigned to the Filter property of TSaveDialog.

function GetExportFilter: String;

If ExtensionsInFilter is True, file extensions are included in the visible part of the returned file filter.

See also:

•	GetImportFilter method;

•	ExportConverters property.


TRVOfficeConverter.GetImportFilter
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.GetImportFilter

Returns string that can be assigned to the Filter property of TOpenDialog

function GetImportFilter: String;

If ExtensionsInFilter is True, file extensions are included in the visible part of the returned file filter.

See also:

•	GetExportFilter method;

•	ImportConverters property.


TRVOfficeConverter.ImportRTF
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ImportRTF

Converts data from the file in foreign format to RTF data in Stream

function ImportRTF(const FileName: String;

  ConverterIndex: Integer): Boolean;

Parameters:

FileName is a name of file to import.

ConverterIndex is an index of import converter (in ImportConverters list)

The method clears Stream and writes RTF (Rich Text Format) document in it.

You can provide a visual indication for the conversion progress using OnConverting event.

Return value:

True if the import was successful, False if not.

See also:

•	ExportRTF;

•	ImportRV.

See also properties:

•	ErrorCode.


TRVOfficeConverter.ImportRV
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.ImportRV

Imports content of file in foreign format to rv.

function ImportRV(const FileName: String; rv: TCustomRichView;

  ConverterIndex: Integer): Boolean;

Parameters:

FileName is a name of file to import.

ConverterIndex is an index of import converter (in ImportConverters list)

This method:

1.	clears Stream;

2.	imports data from the file to  Stream;

3.	reads data from  Stream in rv, using rv.LoadRTFFromStream,

4.	clears Stream.

You can provide a visual indication for the conversion progress using OnConverting event.

Return value:

True if the import was successful, False if not.

See also:

•	ImportRTF;

•	ExportRV.

See also properties:

•	ErrorCode.


TRVOfficeConverter.IsValidImporter
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.IsValidImporter

Checks if the specified file can be imported with the specified converter.

function IsValidImporter(const FileName: String; Index: Integer): Boolean;

(introduced in version 12)

Parameters:

FileName is a name of file to test.

Index is an index of import converter (in ImportConverters list)

Return value:

If this method returns False, this file cannot be imported by this converter. If this method returns True, this file probably can be imported by this converter.

See also properties:

•	ErrorCode.


TRVOfficeConverter.OnConverting
 TRichView Reference | TRVOfficeConverter

TRVOfficeConverter.OnConverting

Occurs while converting (in ImportRTF, ExportRTF, ImportRV, ExportRV methods)

property OnConverting: TConvertingEvent;

type

  TConvertingEvent = procedure (Sender:TObject; Percent: Integer) of object;

Percent is a value of completeness, from 0 to 100.

See also event of TRichView:

•	OnProgress.


TRVOfficeCnvList
 TRichView Reference | TRVOfficeConverter |  TRVOfficeCnvList

TRVOfficeCnvList

This class represents a list of installed import or export converters.

Unit RVOfficeCnv;

Syntax

TRVOfficeCnvList = class (TList)

Hierarchy

TObject

TList

Main Properties

The main properties are Count (count of converters) and Items (array of TRVOfficeConverterInfo).


TRVOfficeConverterInfo
 TRichView Reference | TRVOfficeConverter |  TRVOfficeConverterInfo

TRVOfficeConverterInfo

This class represents an item in list of installed import and export converters.

Unit RVOfficeCnv;

Syntax

TRVOfficeConverterInfo = class;

Hierarchy

TObject

Main Properties

This class has the following main properties:

•	Name: String – name of format (for example, 'HTML Document');

•	Path: String – path to the converter's DLL;

•	Filter: String – filter (file mask, for example '*.htm;*.html;*.htx;*.otm').


TRVReportHelper
 TRichView Reference | TRVReportHelper

 TRVReportHelper

Properties   Methods   Events

This component is similar to TRVPrint, but:

•	it can be used to draw on any Canvas (not only on the printer's canvas) pages of any size (not limited to printer page sizes);

•	it contains a document, not a reference to it.

Unit RVReport;

Syntax

TRVReportHelper = class(TCustomRVPrint)

Hierarchy

TObject

TPersistent

TComponent

TCustomRVPrint

How to Use

1.	Load document in RVReportHelper.RichView.

2.	Initialize formatting (Init). Specify the page width and canvas.

3.	Format the document page by page (FormatNextPage). Pages may have different heights.

4.	Draw pages on canvas (DrawPage or DrawPageAt). If you need to know positions of hyperlinks and checkpoints, use OnDrawHyperlink and OnDrawCheckpoint events.

Example (drawing document in metafile)

procedure TForm1.DrawToMetafile(rvh: TRVReportHelper;

  wmf: TMetafile; Width: Integer);

const VERYLARGEVALUE = $FFFFFFF;

var Canvas: TMetafileCanvas;

begin

  rvh.Init(Self.Canvas, Width);

  // if document does not have page breaks,

  // it will be formatted on one page

  while rvh.FormatNextPage(VERYLARGEVALUE) do;

  wmf.Width := Width;

  wmf.Height := rvh.EndAt;

  Canvas := TMetafileCanvas.Create(wmf, 0);

  rvh.DrawPage(1,Canvas,True,rvh.EndAt);

  Canvas.Free;

end;

Demo projects

•	Demos\Delphi\Assorted\Graphics\ToImage\

•	Demos\Delphi\Assorted\Printing\ReportHelper\

(for C++Builder demos, change "Delphi" to "CBuilder" in the paths above)


TRVReportHelper.RichView
 TRichView Reference | TRVReportHelper

TRVReportHelper.RichView

This is the object containing document of the report helper.

property RichView: TRichView;

This RichView object is invisible. Use it to load document and to set properties for loading. This RichView must be linked with some TRVStyle object.

In D6+, you can set properties and events of this object at designtime using the Object Inspector.

Do not use formatting methods of this RichView. Use Init and FormatNextPage instead.


TRVReportHelper.DrawPage
 TRichView Reference | TRVReportHelper

TRVReportHelper.DrawPage

Draws the specified page

procedure DrawPage(APageNo: Integer; ACanvas: TCanvas;

  APreview: Boolean; AHeight: Integer);

Parameters:

APageNo – index of the page to draw. The first page has index = 1.

ACanvas – Canvas where to render the page. It's not necessary the same canvas as was used in Init, but must have the same resolution (and the same value of Font.PixelsPerInch)

The top left corner of the page is drawn at (0,0) coordinates.

APreview – should be set to True when drawing on the screen canvas, to False when drawing on printer canvas.

AHeight – height of this page; this value is used for drawing background.

This page must be formatted before drawing, see FormatNextPage.

See also:

•	DrawPageAt.


TRVReportHelper.DrawPageAt
 TRichView Reference | TRVReportHelper

TRVReportHelper.DrawPageAt

Draws the specified page at the specified coordinates

procedure DrawPageAt(Left, Top, APageNo: Integer;

  ACanvas: TCanvas; APreview: Boolean; AHeight: Integer);

Parameters:

APageNo – index of the page to draw. The first page has index = 1.

ACanvas – Canvas where to render the page. It's not necessary the same canvas as was used in Init, but must have the same resolution (and the same value of Font.PixelsPerInch)

The top left corner of the page is drawn at (Left,Top) coordinates.

APreview – should be set to True when drawing on the screen canvas, to False when drawing on printer canvas.

AHeight – height of this page; this value is used for drawing background.

This method uses SetWindowOrgEx to move origin to (Left,Top).

This page must be formatted before drawing, see FormatNextPage.

See also:

•	DrawPage.


TRVReportHelper.Finished
 TRichView Reference | TRVReportHelper

TRVReportHelper.Finished

Returns True if all pages were formatted.

function Finished: Boolean;

You can use the value returned by FormatNextPage instead.


TRVReportHelper.FormatNextPage
 TRichView Reference | TRVReportHelper

 TRVReportHelper.FormatNextPage

Formats next page(s) of document

function FormatNextPage(AMaxHeight: Integer): Boolean;

Call this method after Init several times, while it returns True.

Parameter:

AMaxHeight – page height, pixels; page width is specified as a parameter of Init.

When the page is formatted, it can be drawn (DrawPage, DrawPageAt).

Sometimes, this method formats more than one page.

This method is fast. The most time consuming method is Init.

Return value:

•	True if not all pages were formatted;

•	False, if formatting is complete.


TRVReportHelper.GetLastPageHeight
 TRichView Reference | TRVReportHelper

TRVReportHelper.GetLastPageHeight

Returns a real height of the last page, in device pixels

function GetLastPageHeight: Integer;

This function returns height of document on the last page, when the document is completely formatted (all calls to FormatNextPage are made).

The returned value is measured in ACanvas pixels, where ACanvas is the parameter of Init.

This method is useful if you draw/print several documents one after another.


TRVReportHelper.Init
 TRichView Reference | TRVReportHelper

TRVReportHelper.Init

Prepares document for formatting.

procedure Init(ACanvas: TCanvas; APageWidth: Integer);

Parameters:

ACanvas – canvas object used for formatting.

APageWidth – page width, pixels; all pages have the same width.

See also:

•	FormatNextPage.


TRVReportHelper.OnDrawCheckpoint
 TRichView Reference | TRVReportHelper

TRVReportHelper.OnDrawCheckpoint

Occurs when the ReportHelper draws item having checkpoint

type

  TRVDrawCheckpointEvent = procedure (Sender: TRVReportHelper;

    RVData: TCustomRVData; ItemNo: Integer; X, Y: Integer) of object;

property OnDrawCheckpoint: TRVDrawCheckpointEvent;

(introduced in v1.9)

This method informs when some item with checkpoint is drawn. It's similar to OnDrawHyperlink.

Parameters:

RVData – document containing item.

ItemNo – index of checkpoint's item inside this document.

(X,Y) – top left corner of this item on page (coordinate of the top left corner of the document is (0,0)).

This is not a custom drawing event but an informational event.

For example, this method can be used to create links inside document in generated PDF files (note: PDF generation requires other third-party components).


TRVReportHelper.OnDrawHyperlink
 TRichView Reference | TRVReportHelper

TRVReportHelper.OnDrawHyperlink

Occurs when the ReportHelper draws a hyperlink

type

  TRVDrawHyperlinkEvent =

    procedure (Sender: TRVReportHelper;

      RVData: TCustomRVData; ItemNo: Integer;

      R: TRect) of object;

property OnDrawHyperlink: TRVDrawHyperlinkEvent;

(introduced in v1.8)

This method informs when some hypertext item is drawn.

Parameters:

RVData – document containing hyperlink.

ItemNo – index of hypertext item inside this document.

R – hyperlink rectangle (coordinate of the top left corner of the document is (0,0)).

This is not a custom drawing event but an informational event.

See also:

•	OnDrawCheckpoint.


TRVScroller
 TRichView Reference | TRVScroller

TRVScroller

Properties   Methods    Events

This class is an ancestor of all visual components in TRichView family (TRichView, TRichViewEdit, TDBRichView, TDBRichViewEdit, TRVPrintPreview).

Unit RVScroll;

Syntax

TRVScroller = class(TCustomControl)

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

Main Features

This is a control what can scroll its content.

Due to limitation of scrollbar ranges, its vertical scrollbar units are not pixels but special units, "RVSU" (10 pixels by default).

Do not use this class directly in your program. Use its descendants, such as TRichView.

TRVScroller is not registered as a component itself. It introduces some properties and methods used in descendant components.

Main Properties and Methods

The most important properties of TRVScroller are:

•	VScrollPos –- position of vertical scrollbar, measured in "RVSU";

•	VScrollMax (read-only) –-  maximum value of VScrollPos;

•	NoVScroll  –- disallows vertical scrolling;

•	HScrollPos –- position of horizontal scrollbar, measured in pixels;

•	HScrollMax (read-only) –-  maximum value of HScrollPos;

•	WheelStep defines speed of mouse wheel scrolling;

•	InplaceEditor –- returns "inplace" editor of some item in document (used in tables for editing cells).

The most important method is:

•	ScrollTo, scrolls content of the component vertically to the specified position (in pixels).


TRVScroller.BorderStyle
 TRichView Reference | TRVScroller

TRVScroller.BorderStyle

Determines whether the control has border.

type TBorderStyle = bsNone..bsSingle;

property BorderStyle: TBorderStyle;

Set BorderStyle to specify whether the control should be outlined.

Value	Meaning
bsNone	No visible border
bsSingle	Border, 3D or themed


TRVScroller.HScrollMax
 TRichView Reference | TRVScroller

TRVScroller.HScrollMax

Maximal possible value for HScrollPos

property HScrollMax: Integer;

See also properties:

•	HScrollPos;

•	VScrollMax.

See also:

•	Scrolling in RichView


TRVScroller.HScrollPos
 TRichView Reference | TRVScroller

TRVScroller.HScrollPos

Position of horizontal scrollbar. This value is measured in pixels. You can use this property to scroll document to specified horizontal position.

property HScrollPos: Integer;

This value is in range 0..HScrollMax.

See also properties:

•	VScrollPos.

See also:

•	Scrolling in RichView.


TRVScroller.HScrollVisible
 TRichView Reference | TRVScroller

TRVScroller.HScrollVisible

Set to False to hide horizontal scrollbar

property HScrollVisible: Boolean;

(introduced in version 1.4)

Default value:

True

See also properties:

•	VScrollVisible.

See also:

•	Scrolling in RichView.


TRVScroller.InplaceEditor
 TRichView Reference | TRVScroller

TRVScroller.InplaceEditor (read-only)

This property provides access to editor created for editing one of document items.

property InplaceEditor: TWinControl;

(introduced in version 1.4)

Inplace editor can be used to edit some cell in a table (see "Cell Editing"). In future versions, inplace editors can be used for some other types of items.

Inplace editors are derived from TCustomRichViewEdit type.

Inplace editor in its order can have its own inplace editor, and so on. If there is no inplace editor, this property is nil. At any time the control can have no more than one inplace editor.

Example:  (obtaining top level editor)

var

  rve: TCustomRichViewEdit;

...

  rve := MyRichViewEdit;

  while rve.InplaceEditor<>nil do

    rve := rve.InplaceEditor as TCustomRichViewEdit;

  // Now rve points to the top level inplace editor

  // (or MyRichViewEdit itself, if there are no

  // inplace editors).

See also:

•	TCustomRichViewEdit.TopLevelEditor.


TRVScroller.NoVScroll
 TRichView Reference | TRVScroller

TRVScroller.NoVScroll

Disables vertical scrolling

property NoVScroll: Boolean;

(introduced in version 11)

Default value

False


TRVScroller.Tracking
 TRichView Reference | TRVScroller

TRVScroller.Tracking

Determines whether the control is updated when the user drags the thumb tab of scrollbar.

property Tracking: Boolean;

Repainting while the thumb tab is dragged can provide useful feedback to the user about how far the control has scrolled, but slows performance.

Default value:

True


TRVScroller.UseXPThemes
 TRichView Reference | TRVScroller

TRVScroller.UseXPThemes

Allows using Windows XP/Vista themes (visual styles)

property UseXPThemes: Boolean

(introduced in version 1.7)

If this property is set to True, the control will use themes if they are available.

See also:

•	BorderStyle.


TRVScroller.VScrollMax
 TRichView Reference | TRVScroller

TRVScroller.VScrollMax (read-only)

Maximal possible value for VScrollPos

property VScrollMax: Integer;

See also properties:

•	VScrollPos;

•	HScrollMax.

See also methods:

•	ScrollTo.

See also:

•	Scrolling in RichView.


TRVScroller.VScrollPos
 TRichView Reference | TRVScroller

TRVScroller.VScrollPos

Position of vertical scrollbar. This value is measured in "RVSU", not in pixels because of Windows limitation on scrollbar scrolling range. You can use this property to scroll document to specified position.

property VScrollPos: Integer;

This value is in range 0..VScrollMax.

See also properties:

•	HScrollPos.

See also methods:

•	ScrollTo.

See also:

•	Scrolling in RichView.


TRVScroller.VScrollVisible
 TRichView Reference | TRVScroller

TRVScroller.VScrollVisible

Set to False to hide vertical scrollbar

property VScrollVisible: Boolean;

Known problem: scrollbars do not reappear correctly in TRichViewEdit if set VScrollVisible from False to True when document is not empty.

Default value:

True

See also properties:

•	HScrollVisible.

See also:

•	Scrolling in RichView.


TRVScroller.WheelStep
 TRichView Reference | TRVScroller

TRVScroller.WheelStep (for Delphi 4+)

Defines how much the document will be scrolled when the user turns a mouse wheel.

property WheelStep: Integer;

If set to 0, the control ignores mouse wheel messages (they will be sent to the parent control).

Mouse wheel scrolling in TRVScroller depends on the system settings. The system suggests the default scrolling speed. If the suggested value is "one page", this property is ignored (if nonzero). If the suggested value is "no scrolling", no scrolling occurs. Otherwise, the component is scrolled by Round(VSmallStep*WheelStep*suggested/3) pixels.

Default value:

2


TRVScroller.Create
 TRichView Reference | TRVScroller

TRVScroller.Create

A constructor, creates and initializes a TRVScroller instance.

constructor Create(AOwner: TComponent);override;

Do not create TRVScroller objects in your applications directly. Create components inherited from it:

•	TRichView;

•	TRichViewEdit;

•	TDBRichView;

•	TDBRichViewEdit;

•	TRVPrintPreview.


TRVScroller.ScrollTo
 TRichView Reference | TRVScroller

TRVScroller.ScrollTo

Scrolls content of the document vertically to the specified position (in pixels).

procedure ScrollTo(y: Integer);

Vertical scrollbar units are not pixels, so scrolling will be not exactly to specified position (but a little bit higher).

See also properties:

•	VScrollPos;

•	VScrollMax.

See also:

•	Scrolling in RichView.


TRVScroller.OnHScrolled
 TRichView Reference | TRVScroller

TRVScroller.OnHScrolled

Occurs when the document is scrolled horizontally

property OnHScrolled: TNotifyEvent;

See also events:

•	OnVScrolled.

See also:

•	Scrolling in RichView.


TRVScroller.OnVScrolled
 TRichView Reference | TRVScroller

TRVScroller.OnVScrolled

Occurs when document is scrolled vertically

property OnVScrolled: TNotifyEvent;

See also events:

•	OnHScrolled.

See also properties of TRichView:

•	FirstItemVisible;

•	LastItemVisible.

See also:

•	Scrolling in RichView.


TCustomRVPrint
 TRichView Reference | TCustomRVPrint

TCustomRVPrint

Properties   Methods   Events

TCustomRVPrint is an Ancestor of TRVPrint and TRVReportHelper components.

This is an intermediate class. Do not use it directly in your programs.

Unit PtblRV;

Syntax

TCustomRVPrint = class(TComponent)

 Hierarchy

TObject

TPersistent

TComponent


TCustomRVPrint.ColorMode
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.ColorMode

Sets color mode for printing and drawing preview

type // declared in RVStyle unit

  TRVColorMode = (rvcmColor, rvcmPrinterColor,

    rvcmGrayScale, rvcmBlackAndWhite, rvcmBlackOnWhite);

property ColorMode: TRVColorMode

(Introduced in version 1.8)

This property affects printing text, paragraph background, breaks, list markers, tables.

This property does not affect printing pictures.

Mode	Meaning
rvcmColor	Color output.
rvcmPrinterColor	Color output, but the following colors are changed: • clWindow, clBtnHighlight to clWhite, • clWindowText to clBlack, • clBtnShadow to clGray, • clBtnFace, clScrollbar to clSilver.
rvcmGrayScale	Colors are converted to shades of gray.
rvcmBlackAndWhite	Paragraphs backgrounds are not printed; text is printed black on white or white on black depending on what is darker.
rvcmBlackOnWhite	Paragraphs backgrounds are not printed; text is printed black on white.
Default values:

•	rvcmColor for TRVReportHelper;

•	rvcmPrinterColor for TRVPrint.


TCustomRVPrint.EndAt
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.EndAt (read-only)

Height of document on the last page, in device pixels.

property EndAt: Integer;

This property does not include margins.

You can use this property only when document is completely formatted (see FormatPages for TRVPrint, Init and FormatNextPage for TRVReportHelper).

For TRVReportHelper, you can use GetLastPageHeight instead (it's more convenient, because it includes top and bottom margins).

See also properties:

•	StartAt.


TCustomRVPrint.PagesCount
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.PagesCount (read-only)

Total number of pages in the document.

property PagesCount: Integer;

You can use this property only when document is formatted (see FormatPages for TRVPrint, Init and FormatNextPage for TRVReportHelper).


TCustomRVPrint.PreviewCorrection
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.PreviewCorrection

Determines whether the component will make correction when drawing print preview.

property PreviewCorrection: Boolean;

This property does not affect to the printing itself, only to the preview.

Due to different resolutions on the screen and on the printer, print preview may be inaccurate (because text not always can be scaled proportionally).

If this property is True, the component tries to perform some corrections to improve preview quality (for example, it adjusts intercharacter spacing).

Default value:

True


TCustomRVPrint.StartAt
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.StartAt

Offset from the top of the first page (from the top margin) to the beginning of document on it, in device pixels.

StartAt: Integer;

This property is useful (in conjunction with EndAt) in TRVPrint.ContinuousPrint method.

Default value:

0


TCustomRVPrint.TransparentBackground
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.TransparentBackground

Allows to turn off printing of the document background

property TransparentBackground: Boolean;

If set to True, background will not be printed.

Default value:

False

See also:

•	rvtoWhiteBackground option in PrintOptions of tables.


TCustomRVPrint.Clear
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.Clear

Clears memory allocated for printing (in FormatPages)

procedure Clear;

After calling Clear, TRVPrint will not be able to print and display preview until the next call of  AssignSource and FormatPages (or Init and FormatNextPage in TRVReportHelper).


TCustomRVPrint.GetFirstItemOnPage
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.GetFirstItemOnPage

Returns index of the first item on the page

procedure GetFirstItemOnPage(PageNo: Integer; var ItemNo, OffsetInItem: Integer);

Input parameter:

PageNo – number of page (from 1).

Output parameters:

ItemNo – index of the first item on the page (from 0)

OffsetInItem:

•	for non-text items: 0;

•	for text items: index of the first character on the page (from 1)

Note: this information is not enough when using tables. Tables can be printed on several pages, and using this information you cannot determine which part of table starts the page.

See also properties:

•	PagesCount.


TCustomRVPrint.UpdatePaletteInfo
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.UpdatePaletteInfo

Call this method when the screen color resolution changed (on WM_DISPLAYCHANGE), if you are using this RVPrint for displaying print preview.

This method is necessary (only) if you need to support 256 color display mode.

procedure UpdatePaletteInfo;

Example

TRVPrint uses the same method of working in 256 color mode as its source RichView (see RichView.DoInPaletteMode). Information about source RichView.DoInPaletteMode is  updated when executing AssignSource method.

It's not necessary to call this method if RichView.DoInPaletteMode=rvpaDoNothing, or if you are not using this TRVPrint object for displaying print preview in TRVPrintPreview.

Call UpdatePaletteInfo if you created TRVPrint at run-time (instead of placing at design-time on a form) after you have created it.

TRVPrintPreview controls do not have public UpdatePaletteInfo method. They use information from the linked RVPrint. They update their palettes when you assign their PageNo or RVPrint properties.

See also methods of TRichView:

•	UpdatePaletteInfo.


TCustomRVPrint.OnPrintComponent
 TRichView Reference | TCustomRVPrint

TCustomRVPrint.OnPrintComponent

Occurs when printing inserted control

property OnPrintComponent: TRVPrintComponentEvent;

TRVPrintComponentEvent = procedure(Sender: TCustomRVPrint;

  PrintMe: TControl; var ComponentImage: TBitmap) of object;

If you are not satisfied how RichView prints some classes of controls, you can print them yourself.

This event requests image of control, in screen resolution, in bitmap.

Input parameters:

PrintMe – the control for printing.

ComponentImage – nil.

Output parameter:

ComponentImage – image of PrintMe. You should create this bitmap in this event and should not destroy it yourself (RVPrint will do it for you).

Create the bitmap having width and height of PrintMe (you can return larger bitmap and it will be stretched, allowing to create better print output).

There are several methods for creating bitmap for components in CtrlImage unit: DrawControl and others. The component use them for default controls printing.

Example:

procedure MyForm.MyRVPrintPrintComponent(Sender: TCustomRVPrint;

  PrintMe: TControl; var ComponentImage: TBitmap);

var r: TRect;

    State: Cardinal

begin

  if PrintMe is TImage then begin

    // printing TImage

    ComponentImage := TBitmap.Create;

    ComponentImage.Assign(TImage(PrintMe).Picture.Graphic);

    end

  else if PrintMe is TCheckBox then begin

    // printing TCheckBox

    ComponentImage := TBitmap.Create;

    ComponentImage.Width := PrintMe.Width;

    ComponentImage.Height := PrintMe.Height;

    ComponentImage.Canvas.Brush.Color := TCheckBox(PrintMe).Color;

    r := Rect(0,0, PrintMe.Width, PrintMe.Height);

    ComponentImage.Canvas.FillRect(r);

    if TCheckBox(PrintMe).Checked then

      State := DFCS_CHECKED

    else

      State := 0;

    r.Right := r.Bottom;

    DrawFrameControl(ComponentImage.Canvas.Handle, r, DFC_BUTTON,

      DFCS_BUTTONCHECK or State);

    r := Rect(r.Right,0, PrintMe.Width, PrintMe.Height);

    ComponentImage.Canvas.Font := TCheckBox(PrintMe).Font;

    DrawText(ComponentImage.Canvas.Handle, PChar(' '+TCheckBox(PrintMe).Caption), -1, r,

      DT_VCENTER or DT_SINGLELINE);

    end

  else

    // printing other controls

    ComponentImage := DrawControl(PrintMe)

end;

In TRVPrint, this event is generated by:

•	Print;

•	PrintPages;

•	MakePreview;

•	MakeScaledPreview;

•	DrawPreview;

•	when drawing TRVPrintPreview component.


TCustomRVPrintPreview
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview

Properties   Methods   Events

TCustomRVPrintPreview is an ancestor of TRVPrintPreview component. This class draws a blank page, introduces mechanisms of page switching and scaling.

Unit CRVPP;

Syntax

TCustomRVPrintPreview = class(TRVScroller)

Hierarchy

TObject

TPersistent

TComponent

TControl

TWinControl

TCustomControl

TRVScroller

Cursors

Print preview uses two cursors:

•	ZoomInCursor,

•	ZoomOutCursor.

Scaling

Scaling is defined by:

•	ZoomMode property – mode of scaling;

•	ZoomPercent property – scaling percent;

•	SetZoom method changes ZoomPercent;

•	OnZoomChanged event occurs when ZoomPercent changes;

•	ClickMode property allows/disallows zooming.

Page switching

First, Last, Prev, Next methods, PageNo property.

Displaying margins

MarginsPen property

Colors and widths

•	Color – background color;

•	PageBorderColor, PageBorderWidth define border around the page;

•	ShadowColor, ShadowWidth define shadow.

Scheme


TCustomRVPrintPreview.ClickMode
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ClickMode

Defines the action occurring when the user clicks the preview.

property ClickMode: TRVClickMode;

type

  TRVClickMode = (rvcmNone, rvcmSwitchZoom);

(introduced in v1.8)

Click Mode	Meaning
rvcmNone	Clicking does nothing, zoom-in and zoom-out cursors are not used.
rvcmSwitchZoom	Clicking switches between 100% and custom zoom.
Default value:

rvcmSwitchZoom


TCustomRVPrintPreview.Color
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.Color

Background color

property Color: TColor;

(introduced in v1.8)

Default value:

clBtnShadow

See also:

•	Picture at the bottom of TCustomRVPrintPreview topic.


TCustomRVPrintPreview.MarginsPen
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.MarginsPen

This pen is used for drawing rectangle around the document area on the page preview.

property MarginsPen: TRVMarginsPen;

By default, MarginsPen.Style=psClear, so the rectangle is invisible:

type

  TRVMarginsPen = class (TPen)

    property Style default psClear;

    property Color default clSilver;

  end;

See also properties:

•	PrintableAreaPen.

See also properties of TRVPrint:

•	LeftMarginMM;

•	TopMarginMM;

•	RightMarginMM;

•	BottomMarginMM.

See also:

•	Picture in TRVPrint topic.


TCustomRVPrintPreview.PageBorderColor
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.PageBorderColor

Color of frame around the page.

property PageBorderColor: TColor;

(introduced in v1.8)

Default value:

clHighlight

See also:

•	Picture at the bottom of TCustomRVPrintPreview topic.


TCustomRVPrintPreview.PageBorderWidth
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.PageBorderWidth

Width of frame around the page, pixels

property PageBorderWidth: Integer;

(introduced in v1.8)

Default value:

2

See also:

•	Picture at the bottom of TCustomRVPrintPreview topic.


TCustomRVPrintPreview.PageNo
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.PageNo

Index of displayed page (from 1)

property PageNo: Integer;

See also methods:

•	Prev;

•	Next;

•	First;

•	Last.


TCustomRVPrintPreview.PrintableAreaPen
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.PrintableAreaPen

This pen is used for drawing rectangle around the printable area on the page preview.

property PrintableAreaPen: TRVPAPen;

(introduced in version 10)

By default, PrintableAreaPen.Style=psClear, so the rectangle is invisible:

type

  TRVPAPen = class (TPen)

    property Style default psClear;

    property Color default clRed;

  end;

Printer cannot print beyond the area shown on this rectangle, see WinAPI function GetDeviceCaps, PHYSICAL*** constants.

See also properties:

•	MarginsPen.

See also:

•	Picture in TRVPrint topic.


TCustomRVPrintPreview.ShadowColor
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ShadowColor

Color of the page shadow.

property ShadowColor: TColor;

(introduced in v1.8)

Default value:

cl3DDkShadow

See also:

•	Picture at the bottom of TCustomRVPrintPreview topic.


TCustomRVPrintPreview.ShadowWidth
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ShadowWidth

Width of the page shadow, pixels.

property ShadowWidth: TColor;

(introduced in v1.8)

Default value:

20

See also:

•	Picture at the bottom of TCustomRVPrintPreview topic.


TCustomRVPrintPreview.ZoomInCursor
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ZoomInCursor

Cursor appeared when the current scale<100%, or the current scale=100% switched from the scale>100%

property ZoomInCursor: TCursor;

If ZoomPercent<>100%, clicking on component changes ZoomPercent to 100%.

If ZoomPercent=100%, clicking on component changes ZoomPercent to previous scale.

Default value:

 crRVZoomIn (102)

(this cursor is registered automatically)

See also properties:

•	ZoomOutCursor;

•	ZoomPercent.

See also:

•	RichView cursors.


TCustomRVPrintPreview.ZoomMode
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ZoomMode

Scaling mode

type // defined in RVStyle unit

  TRVZoomMode = (rvzmFullPage, rvzmPageWidth, rvzmCustom);

property ZoomMode : TRVZoomMode;

Assigning value to this property has an immediate effect.

Zoom Mode	Meaning
rvzmFullPage	Changing ZoomPercent to display full page, keeping the full-page view during resizing (changing ZoomPercent when needed)
rvzmPageWidth	Changing ZoomPercent to fit width of page, keeping the page-width view during resizing (changing ZoomPercent when needed)
rvzmCustom	Scaling according to the ZoomPercent value
Default value:

rvzmCustom


TCustomRVPrintPreview.ZoomOutCursor
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ZoomOutCursor

Cursor appeared when the current scale>100%, or the current scale=100% switched from the scale<100%

property ZoomOutCursor: TCursor;

If ZoomPercent<>100%, clicking on component changes ZoomPercent to 100%.

If ZoomPercent=100%, clicking on component changes ZoomPercent to previous scale.

Default value:

 crRVZoomOut (103)

(this cursor is registered automatically)

See also properties:

•	ZoomInCursor;

•	ZoomPercent.

See also:

•	RichView cursors.


TCustomRVPrintPreview.ZoomPercent
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.ZoomPercent

Scale of preview, %

property ZoomPercent: Integer;

Although assigning to this property is possible, the preferable way to change preview scale is calling SetZoom method.

This property is changed automatically when resizing the component, if ZoomMode = rvzmFullPage or rvzmPageWidth.

It's recommended to keep this property in 10%–500% range.

See also methods:

•	SetZoom.

See also properties:

•	ZoomMode.

See also events:

•	OnZoomChanged.


TCustomRVPrintPreview.Create
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.Create

A constructor, creates a new TCustomRVPrintPreview object.

constructor Create(AOwner: TComponent);override;

Do not to create TCustomRVPrintPreview objects, create TRVPrintPreview components instead.


TCustomRVPrintPreview.First
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.First

Switches the current page (PageNo property) to the first page.

procedure First;

See also properties:

•	PageNo.

See also methods:

•	Prev;

•	Next;

•	Last.


TCustomRVPrintPreview.Last
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.Last

Switches the current page (PageNo property) to the last page.

procedure Last;

See also properties:

•	PageNo;

•	TRVPrintPreview.RVPrint.PagesCount.

See also methods:

•	Prev;

•	Next;

•	First.


TCustomRVPrintPreview.Next
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.Next

Switches the current page (PageNo property) to the next page, if possible.

procedure Next;

See also properties:

•	PageNo;

•	TRVPrintPreview.RVPrint.PagesCount.

See also methods:

•	Prev;

•	First;

•	Last.


TCustomRVPrintPreview.Prev
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.Prev

Switches the current page (PageNo property) to the previous page, if possible.

procedure Prev;

See also properties:

•	PageNo.

See also methods:

•	Next;

•	First;

•	Last.


TCustomRVPrintPreview.SetZoom
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.SetZoom

Changes ZoomMode to rvzmCustom and ZoomPercent to Percent.

procedure SetZoom(Percent: Integer);

Calling this method has an immediate effect.

It's recommended to keep Percent in 10%–500% range.

See also properties:

•	ZoomMode;

•	ZoomPercent.


TCustomRVPrintPreview.OnZoomChanged
 TRichView Reference | TCustomRVPrintPreview

TCustomRVPrintPreview.OnZoomChanged

Occurs when ZoomPercent changes.

property OnZoomChanged: TNotifyEvent;


Item Types
 TRichView Reference | Item Types

TCustomRVItemInfo and Others (Item Types)

TCustomRVItemInfo is a basic type for all items in TRichView documents.

Detailed description of all classes for item types is beyond the scope of this help file.

You can add, access and modify all items using methods of TRichView and TRichViewEdit instead of working with the item classes directly, so details of implementation are hidden from programmers. The exceptions are:

•	TRVTableItemInfo;

•	TRVLabelItemInfo;

•	TRVSeqItemInfo;

•	TRVEndnoteItemInfo;

•	TRVFootnoteItemInfo;

•	TRVNoteReferenceItemInfo.

Properties of items of these classes must be accessed and modified directly.

Class	Unit	Meaning
TCustomRVItemInfo	RVItem	Basic class for TRichView items.
TRVTextItemInfo	RVItem	Text item.
TRVNonTextItemInfo	RVItem	Basic class for non-text items.
TRVRectItemInfo	RVItem	Basic class for rectangular items.
TRVFullLineItemInfo	RVItem	Basic class for items occupying the full line.
TRVTabItemInfo	RVItem	Tabulator.
TRVControlItemInfo	RVItem	Item containing Delphi control.
TRVGraphiItemInfo	RVItem	Picture.
TRVHotGraphicItemInfo	RVItem	Hot-picture (picture-hyperlink).
TRVBulletItemInfo	RVItem	Bullet (image from TImageList).
TRVHotspotItemInfo	RVItem	Hotspot (bullet-hyperlink).
TRVMarkerItemInfo	RVMarker	Paragraph marker.
TRVTableItemInfo	RVTable	Table.
TRVBreakItemInfo	RVItem	Break (horizontal line).
TRVLabelItemInfo	RVLabelItem	Label (non-text item looking like text).
TRVSeqItemInfo	RVSeqItem	Numbered sequence.
TCustomRVNoteItemInfo	RVNote	Basic class for footnotes and endnotes.
TRVEndnoteItemInfo	RVNote	Endnote.
TRVFootnoteItemInfo	RVNote	Footnote.
TRVNoteReferenceItemInfo	RVNote	Reference to the parent footnote or endnote.
Hierarchy

Other Types

TCustomRVItemInfoClass = class of TCustomRVItemInfoClass;


Table - TRVTableItemInfo
 TRichView Reference | Item Types | Table

TRVTableItemInfo

Properties   Methods   Events

TRVTableItemInfo is a class representing table in TRichView documents. This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsTable (-60)

Unit RVTable.

Syntax

TRVTableItemInfo = class (TRVFullLineItemInfo)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVFullLineItemInfo

Overview

See overview topics about tables.

Properties

The most of properties of this class are published. These properties can be saved/loaded in RVF files or streams.

The main property of TRVTableItemInfo is Cells. The number of rows is RowCount, number of columns is ColCount.

Properties of rows are available via Rows property.

Width of table can be defined using BestWidth property.

Properties defining border around the table:

•	BorderWidth;

•	BorderStyle;

•	BorderColor;

•	BorderLightColor;

•	VisibleBorders;

•	also BorderHSpacing, BorderVSpacing.

Properties defining default border around cells:

•	CellBorderWidth;

•	CellBorderStyle;

•	CellBorderColor;

•	CellBorderLightColor.

Properties defining spacing between cells:

•	CellHSpacing;

•	CellVSpacing;

•	BorderHSpacing;

•	BorderVSpacing;

•	also CellHPadding, CellVPadding.

Background properties:

•	Color;

•	BackgroundImage;

•	BackgroundStyle;

•	BackgroundImageFileName.

Border colors:

•	BorderColor;

•	BorderLightColor;

•	CellBorderColor;

•	CellBorderLightColor.

Rules:

•	HRuleWidth;

•	HRuleColor;

•	HOutermostRule;

•	VRuleWidth;

•	VRuleColor;

•	VOutermostRule.

Export:

•	TextColSeparator;

•	TextRowSeparator;

•	BackgroundImageFileName.

Other properties:

•	Options;

•	PrintOptions;

•	HeadingRowCount.

Methods

See operations on tables.

Events

Tables are not components, so events cannot be assigned at design time in the Object Inspector. They must be assigned from code, when the table is created.

Events cannot be saved with tables in RVF files or streams. Reassign them when tables are loaded, use TRichView.OnItemAction event.

Events:

•	OnCellEditing;

•	OnDrawBorder.

Related Global Typed Constants

•	Drawing table grid;

•	New row auto insertion.


TRVTableItemInfo.BackgroundImage
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BackgroundImage

Background image for the table.

property BackgroundImage: TGraphic;

(introduced in v1.8)

Position of the image is defined by the BackgroundStyle property.Transparent images are supported.

Assignment to this property copies the image, so you still need to free the source image yourself.

Example 1 (assigning image)

bmp := TBitmap.Create;

bmp.LoadFromFile('c:\image.bmp');

table.BackgroundImage := bmp;

bmp.Free;

Example 2 (clearing the image)

table.BackgroundImage := nil;

See also:

•	Undo of assignments to table properties.

See also properties:

•	BackgroundStyle;

•	Color.

See also properties of table cell:

•	BackgroundImage;

•	BackgroundStyle.

See also properties of TRichView:

•	BackgroundBitmap;

•	BackgroundStyle.


TRVTableItemInfo.BackgroundImageFileName
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BackgroundImageFileName

A string storing the file name associated with BackgroundImage.

property BackgroundImageFileName: String;

(introduced in v1.9)

If rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML. This value is also accessible as extra string property rvespImageFileName.

Assignment to this property cannot be undone by the user.

See also properties of table cell:

•	BackgroundImageFileName.


TRVTableItemInfo.BackgroundStyle
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BackgroundStyle

Defines position of BackgroundImage.

property BackgroundStyle: TRVItemBackgroundStyle;

(introduced in v1.8)

See also:

•	Undo of assignments to table properties.

See also properties:

•	BackgroundImage;

•	Color.

See also properties of table cell:

•	BackgroundStyle;

•	BackgroundImage.

See also properties of TRichView:

•	BackgroundStyle;

•	BackgroundBitmap.


TRVTableItemInfo.BestWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BestWidth

Preferred width for the table

property BestWidth: TRVHTMLLength;

This is a preferred width for the table, in pixels or percents.

The table can be wider than this value if it is required to display its content without overlapping.

If BestWidth is undefined (=0), RichView tries to calculate the table width basing on its cells. In this version RichView can do it only if all columns have widths defined in pixels (have at least one cell with BestWidth defined in pixels, and do not have cells with BestWidth defined in percents). Otherwise BestWidth=0 works like BestWidth=-100 (100%).

This property corresponds to HTML <table width> attribute.

See also undo of assignments to table properties.

Default value:

0

See also:

•	Table Resizing;

•	Undo of assignments to table properties.

See also properties of table cell:

•	BestWidth;

•	BestHeight.


TRVTableItemInfo.BorderColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderColor

Defines color of the table border.

property BorderColor: TColor

This property defines either color of flat border or "dark" color of 3d border around the table.

See BorderStyle for details.

This property corresponds to HTML <table bordercolor> or <table bordercolordark> attributes (specific to Microsoft Internet Explorer).

Default value:

clWindowText

See also:

•	Undo of assignments to table properties;

•	Colors and layout of tables (with pictures).

See also properties

•	BorderLightColor;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableItemInfo.BorderHSpacing
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderHSpacing

Horizontal spacing between the table border and the outermost cells, pixels.

property BorderHSpacing: Integer

This table attribute cannot be saved in HTML.

Default value:

2

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	BorderVSpacing;

•	CellHSpacing;

•	CellVSpacing.


TRVTableItemInfo.BorderLightColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderLightColor

This property defines "light" color of 3d border around the table.

property BorderLightColor: TColor;

See BorderStyle for details.

This property corresponds to HTML <table bordercolorlight> attribute (specific to Microsoft Internet Explorer).

Default value:

clBtnHighlight

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	BorderColor;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableItemInfo.BorderStyle
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderStyle

This property defines style of border around the table.

property BorderStyle: TRVTableBorderStyle;

If you want to hide table border, set BorderWidth = 0.

Default value:

rvtbRaised

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellBorderStyle;

•	BorderColor;

•	BorderLightColor;

•	BorderWidth;

•	VisibleBorders.


TRVTableItemInfo.BorderVSpacing
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderVSpacing

Vertical spacing between border and the outermost cells, pixels.

property BorderVSpacing: Integer

This table attribute cannot be saved in HTML.

Default value:

2

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	BorderHSpacing;

•	CellHSpacing;

•	CellVSpacing.


TRVTableItemInfo.BorderWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.BorderWidth

Width of border around the table, pixels

property BorderWidth: Integer;

Set to 0 to hide border.

This property corresponds to HTML <table border>.

Default value:

0

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellBorderWidth;

•	VisibleBorders.


TRVTableItemInfo.CellBorderColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellBorderColor

Defines default border color for all table cells.

property CellBorderColor: TColor

This property defines either default color of flat border or default "dark" color of 3d border around the table cells.

See CellBorderStyle for details.

This value can be overridden with BorderColor of cell.

This table attribute can be saved in HTML only with use of CSS (Cascading Style Sheet).

Default value:

clWindowText

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellBorderLightColor;

•	BorderLightColor;

•	BorderColor.

See also properties of table cell:

•	BorderColor;

•	BorderLightColor.


TRVTableItemInfo.CellBorderLightColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellBorderLightColor

Defines default "light" color of 3d border for all table cells.

property CellBorderLightColor: TColor;

See CellBorderStyle for details. To hide cell borders, set CellBorderWidth = 0.

This table attribute can be saved in HTML only with use of CSS (Cascading Style Sheet).

This value can be overridden with BorderLightColor of cell.

Default value:

clBtnHighlight

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellBorderColor;

•	BorderLightColor;

•	BorderColor.

See also properties of table cell:

•	BorderColor;

•	BorderLightColor.


TRVTableItemInfo.CellBorderStyle
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellBorderStyle

Style of border around the table cells

property BorderStyle: TRVTableBorderStyle;

To hide cell borders, set CellBorderWidth = 0.

Default value:

rvtbLowered

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	BorderStyle;

•	CellBorderWidth;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableItemInfo.CellBorderWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellBorderWidth

Width of border around the cells of table, pixels

property CellBorderWidth: Integer;

Set to 0 to hide border.

If value of this property <> BorderWidth, or if it > 1, it can be saved to HTML only with use of CSS

Default value:

0

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	BorderWidth;

•	CellBorderStyle;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableItemInfo.CellHPadding
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellHPadding

Horizontal distance from the cell content to the cell border, in pixels.

property CellHPadding: Integer;

(introduced in v10)

This value affects all cells in the table.

Different values of CellHPadding and CellVPadding cannot be saved to HTML. When saving to HTML, CellPadding is used for saving <table cellspacing>.

Default value:

1

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellVPadding;

•	CellPadding.


TRVTableItemInfo.CellHSpacing
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellHSpacing

Horizontal spacing between cells, pixels.

property CellHSpacing: Integer;

Different values of CellHSpacing and CellVSpacing cannot be saved to HTML. When saving to HTML, <table cellspacing> is saved as (CellVSpacing+CellHSpacing) div 2

Default value:

2

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellVSpacing;

•	BorderHSpacing;

•	BorderVSpacing.


TRVTableItemInfo.CellPadding
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellPadding

Distance between cell content and cell border, in pixels.

property CellPadding: Integer

This property is maintained for backward compatibility. Assigning to this property assigns values to CellHPadding and CellVPadding. Reading this property returns Round((CellHPadding+CellVPadding)/2).


TRVTableItemInfo.Cells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Cells

Provides indexed access to all cells in the table.

property Cells[Row, Col: Integer]: TRVTableCellData;

This is the key property of table.

Row can be in range from 0 to RowCount-1. Col can be in range from 0 to ColCount-1.

Each row has the same number of cells.

Attention: the Borland's grid uses Cells[Col,Row] instead.

Some cells can be equal to nil due to cell-merging.

See also properties:

•	Rows.

See also:

•	Table Cells Overview.


TRVTableItemInfo.CellVPadding
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellVPadding

Vertical distance from the cell content to the cell border, in pixels.

property CellVPadding: Integer;

(introduced in v10)

This value affects all cells in the table.

Different values of CellHPadding and CellVPadding cannot be saved to HTML. When saving to HTML, CellPadding is used for saving <table cellspacing>.

Default value:

1

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellHPadding;

•	CellPadding.


TRVTableItemInfo.CellVSpacing
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CellVSpacing

Vertical spacing between cells, pixels.

property CellVSpacing: Integer

Different values of CellHSpacing and CellVSpacing cannot be saved to HTML. When saving to HTML, <TABLE cellspacing> is saved as (CellVSpacing+CellHSpacing) div 2.

Default value:

2

See also:

•	Undo of assignments to table propeties;

•	Colors and layout of tables (with pictures).

See also properties:

•	CellHSpacing;

•	BorderHSpacing;

•	BorderVSpacing.


TRVTableItemInfo.ColCount
 TRichView Reference | Item Types | Table

TRVTableItemInfo.ColCount (read-only)

Returns the number of columns in the table.

property ColCount: Integer

(introduced in v10)

If RowCount>0, this property returns Rows[0].Count (all rows have the same number of cells). If RowCount=0, this property returns 0.

See also properties:

•	Cells;

•	Rows.


TRVTableItemInfo.Color
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Color

Background color of the table

property Color: TColor;

Set to clNone for transparent background.

Default value:

clWindow

See also:

•	Undo of assignments to table properties;

•	Colors and layout of tables (with pictures).


TRVTableItemInfo.HeadingRowCount
 TRichView Reference | Item Types | Table

TRVTableItemInfo.HeadingRowCount

Specifies the number of rows that will be repeated on each printer page with this table.

property HeadingRowCount: Integer;

(introduced in version 1.7)

If these rows overlap the next rows (due to cell merging), this property is ignored.

This property affects printing and does not affect drawing in viewer and editor.

Default value:

0

See also:

•	PrintOptions.


TRVTableItemInfo.HOutermostRule
 TRichView Reference | Item Types | Table

TRVTableItemInfo.HOutermostRule

Specifies if the horizontal rules should be drawn between the table border and the outermost cells.

property HOutermostRule: Boolean;

These rules can be visible only of other rules are visible (HRuleWidth>0)

Note about rules.

Default value:

False

See also:

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties:

•	VOutermostRule;

•	HRuleWidth;

•	HRuleColor.


TRVTableItemInfo.HRuleColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.HRuleColor

Specifies the color of horizontal rules (horizontal lines between cells)

property HRuleColor: TColor;

Horizontal rules are visible only if HRuleWidth>0

Note about rules.

Default value:

clWindowText

See also:

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties:

•	VRuleColor;

•	HRuleWidth;

•	HOutermostRule.


TRVTableItemInfo.HRuleWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.HRuleWidth

Specifies the width of horizontal rules (horizontal lines between cells)

property HRuleWidth: Integer;

Set to 0 to hide horizontal rules (hidden by default).

Note about rules.

Default value:

0

See also

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties

•	VRuleWidth;

•	HRuleColor;

•	HOutermostRule.


TRVTableItemInfo.Options
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Options

Specifies options for the table.

type

  TRVTableOption = (rvtoEditing,

    rvtoRowSizing, rvtoColSizing,

    rvtoRowSelect, rvtoColSelect,

    rvtoNoCellSelect,

    rvtoRTFSaveCellPixelBestWidth,

    rvtoHideGridLines,

    rvtoCellBelowBorders,

    rvtoOverlappingCorners,

    rvtoRTFAllowAutofit,

    rvtoIgnoreContentWidth,

    rvtoIgnoreContentHeight);

  TRVTableOptions = set of TRVTableOption;

property Options: TRVTableOptions;

Default value

[rvtoEditing, rvtoRowSizing, rvtoColSizing, rvtoRowSelect, rvtoColSelect]

Options for Editing

Option	Meaning
rvtoEditing	If set (default), users can edit content of cells using inplace editor. (table must be inserted in TRichViewEdit or TDBRichViewEdit)
Options for Resizing and Selection

Option	Meaning
rvtoRowSizing rvtoColSizing	If set (default), users can resize individual rows/columns with the mouse. (table must be inserted in TRichViewEdit or TDBRichViewEdit)
rvtoRowSelect, rvtoColSelect	If set (default), user can select rows/columns by clicking on the left/top border of the table (when cursor has a special vertical/horizontal arrow shape) The options have no effect if the table is inserted in RichView with rvoAllowSelection excluded from Options.
rvtoNoCellSelect	If set, multicell selection by mouse is not allowed (remove also rvtoRowSelect and rvtoColSelect to disallow making multicell selection completely.
Layout Options

Option	Meaning
rvtoIgnoreContentWidth	If set, contents of cells are completely ignored when calculating widths of table columns.Wide pictures, controls, etc. are clipped.
rvtoIgnoreContentHeight	If set, heights of rows are calculated basing only on BestHeight properties of cells.  But (unlike rvtoIgnoreContentWidth), heights of cells having BestHeight=0 are still calculated basing on their content.
Visual Options

Option	Meaning
rvtoHideGridLines	If not set (default), invisible borders are shown as gray lines when table is inserted in editor (see also RichViewTableGridStyle and RichViewTableGridColor variables) This grid is always invisible in viewer and when printing.
rvtoCellBelowBorders	If not set (default), space below invisible side of border has color of tables. If set, color of cell is used.
rvtoOverlappingCorners	If not set (default), colored borders (CellBorderStyle=rvtbColor) have three-dimensional appearance. If not set, they are flat. The effect can be noticed for wide borders with some invisible sides.
RTF Export Options

Option	Meaning
rvtoRTFAllowAutofit	If set, cells with undefined widths (BestWidth=0) are exported to RTF as fit-by-content cells.
rvtoRTFSaveCellPixelBestWidth	Explained in table RTF export. Off by default.


TRVTableItemInfo.PrintOptions
 TRichView Reference | Item Types | Table

TRVTableItemInfo.PrintOptions

Specifies options for table printing.

type

  TRVTablePrintOption =

    (rvtoHalftoneBorders, rvtoRowsSplit,

     rvtoWhiteBackground);

  TRVTablePrintOptions = set of TRVTablePrintOption;

property PrintOptions: TRVTablePrintOptions;

Option	Meaning
rvtoHalftoneBorders	If set (default), table and cells borders will be printed in dithered colors, but corners will be rounded. If cleared, borders will be printed in solid colors (usually black or white),  but corners will be strictly defined, like on screen. Affects to 3d borders (see BorderStyle and CellBorderStyle) and borders with some invisible lines. Forced compromise.
rvtoRowsSplit	Clear this option to forbid printing this table on several pages.
rvtoWhiteBackground	If set, colors of table and cells backgound will be ignored and printed in white. See also TRVPrint.TransparentBackground
Default value:

[rvtoHalftoneBorders,rvtoRowsSplit]

See also:

•	HeadingRowCount.


TRVTableItemInfo.RowCount
 TRichView Reference | Item Types | Table

TRVTableItemInfo.RowCount (read-only)

Returns the number of rows in the table.

property RowCount: Integer

(introduced in v10)

See also properties:

•	ColCount;

•	Cells;

•	Rows.


TRVTableItemInfo.Rows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Rows

Provides indexed access to all rows in the table.

property Rows: TRVTableRows;

Rows is a list of table rows (TRVTableRow), each row is a list of cells (TRVTableCellData). Each row has the same number of cells.

The specific cell can be accessed as Rows[<Row>][<Col>] as well as Cells[<Row>,<Col>].

Use Rows to access properties of rows, for example Rows[<Row>].VAlign.Otherwise, Cells is more convenient.

See also:

•	Table Cells Overview


TRVTableItemInfo.TextColSeparator
 TRichView Reference | Item Types | Table

TRVTableItemInfo.TextColSeparator

Value of this property is used when saving table in text file. This string will be written between cells.

property TextColSeparator: String;

When saving to Unicode text files, RichView writes Unicode representation of this string.

Default value

#13#10 (CR+LF)

You can set TextColSeparator to TAB, if you wish, but do not forget that there can be CR+LFs inside cells.

See also properties:

•	TextRowSeparator.

See also methods of TRichView:

•	SaveText;

•	GetSelText.

See also:

•	Export of Tables.


TRVTableItemInfo.TextRowSeparator
 TRichView Reference | Item Types | Table

TRVTableItemInfo.TextRowSeparator

Value of this property is used when saving table in text file. This string will be written between rows.

property TextCowSeparator: String;

When saving to Unicode text files, RichView writes Unicode representation of this string.

Default value:

#13#10 (CR+LF)

See also properties:

•	TextColSeparator.

See also methods of TRichView:

•	SaveText;

•	GetSelText.

See also:

•	Export of Tables.


TRVTableItemInfo.VisibleBorders
 TRichView Reference | Item Types | Table

 TRVTableItemInfo.VisibleBorders

Allows to hide some sides of table border.

property VisibleBorders: TRVBooleanRect;

(introduced in v10)

Direct assignment to this property cannot be undone/redone by user (use SetTableVisibleBorders)

Default value:

True, True, True, True (all sides are visible)

See also properties:

•	BorderWidth;

•	BorderColor;

•	BorderLightColor;

•	BorderStyle.

See also properties of table cell:

•	VisibleBorders.


TRVTableItemInfo.VOutermostRule
 TRichView Reference | Item Types | Table

TRVTableItemInfo.VOutermostRule

Specifies if the vertical rules should be drawn between the table border and the outermost cells.

property VOutermostRule: Boolean;

These rules can be visible only of other rules are visible (VRuleWidth>0)

Note about rules.

Default value:

False

See also:

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties:

•	HOutermostRule;

•	VRuleWidth;

•	VRuleColor.


TRVTableItemInfo.VRuleColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.VRuleColor

Specifies the color of vertical rules (vertical lines between cells)

property VRuleColor: TColor;

Vertical rules are visible only if VRuleWidth>0

Note about rules.

Default value:

clWindowText

See also:

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties:

•	HRuleColor;

•	VRuleWidth;

•	VOutermostRule.


TRVTableItemInfo.VRuleWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.VRuleWidth

Specifies the width of vertical rules (vertical lines between cells)

property VRuleWidth: Integer;

Set to 0 to hide vertical rules (hidden by default).

Note about rules.

Default value:

0

See also:

•	Undo of assignments to table properties;

•	Table rules (with pictures).

See also properties:

•	HRuleWidth;

•	VRuleColor;

•	VOutermostRule.


TRVTableItemInfo.AssignProperties
 TRichView Reference | Item Types | Table

TRVTableItemInfo.AssignProperties

Assigns all table properties from the Source.

procedure AssignProperties(Source: TRVTableItemInfo);

(introduced in v1.9)

Cells and their contents are not assigned.


TRVTableItemInfo.CanMergeCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CanMergeCells

Returns: is cell-merging of the specified cells possible?

function CanMergeCells(TopRow, LeftCol, ColSpan, RowSpan: Integer;

  AllowMergeRC: Boolean): Boolean;

Potential area for cell-merging is specified in TopRow, TopCol, ColSpan, RowSpan.

TopRow, TopCol – position of the top left cell for cell-merging.

ColSpan – number of columns for merging.

RowSpan – number of rows for merging.

If merging will be performed, the resulting cell will be Cells[TopRow, TopCol] with ColSpan=ColSpan and RowSpan=RowSpan.

Merging can be done, if

1.	Cells[TopRow, TopCol]<>nil.

2.	This area defines a rectangular piece of table (there are no cells overlapping its border due to previous cell-merging). This requirement covers the 1st one.

3.	Either Cells[TopRow, TopCol].ColSpan < ColSpan or Cells[TopRow, TopCol].RowSpan < RowSpan.

4.	If AllowMergeRC=True, this function returns False, if one or more rows or columns will contain only nils after merging. It's not recommended to have such rows/columns, so you can either forbid such operation or (better) delete them with DeleteEmptyRows and DeleteEmptyCols.

See also:

•	CanMergeSelectedCells;

•	MergeCells;

•	MergeSelectedCells.

See also properties:

•	ColCount;

•	RowCount.


TRVTableItemInfo.CanMergeSelectedCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CanMergeSelectedCells

Returns: is cell-merging of the selected cells possible?

function CanMergeSelectedCells(AllowMergeRC: Boolean): Boolean;

The same as CanMergeCells, but potential area for cell-merging is the selection in the table.

If AllowMergeRC=True, this function returns False, if one or more rows or columns will contain only nils after merging. It's not recommended to have such rows/columns, so you can either forbid such operation or (better) delete them with DeleteEmptyRows and DeleteEmptyCols.

This method can be used to determine if the selection in the table has a rectangular shape.

This method must be called when the document is formatted.

See also:

•	CanMergeCells;

•	MergeSelectedCells;

•	MergeCells.


TRVTableItemInfo.Changed
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Changed

"Informs" table about updates in its content.

procedure Changed;

After performing operations on table which was already inserted in document you should reformat this document.

It is usually done by BeginItemModify/EndItemModify (if the table was inserted in TRichViewEdit) or Format (if the table was inserted in TRichView).

But you can realize that in some cases table will not be updated even after formatting. This happens because the table does not "know" about changes in it, so it reuses the previous formatting.

The most of operations on table (including all methods of TRVTableItemInfo, and editing operations in cell inplace-editor) "inform" table about changes in its content and thus allowing subsequent reformatting. But viewer-style operations performed on cells do not "inform" table, and their result cannot be shown after reformatting. You can inform table about changes in its content by this method.

Example

table := TRVTableItemInfo(MyRichView.GetItem(ItemNo));

table.Cells[0,0].Clear;

table.Cells[0,0].AddNL('One more line',0,0);

table.Changed;

MyRichView.Format;

Note: since version 1.7, it's not required to call table.Changed before Format. But it is still useful when using BeginItemModify/EndItemModify.


TRVTableItemInfo.Create
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Create

Creates a new TRVTableItemInfo object

constructor Create(RVData: TPersistent); override;

Parameter:

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this table.

This constructor creates a new table with one row and one column.

There is more convenient constructor, CreateEx.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVTableItemInfo.CreateEx
 TRichView Reference | Item Types | Table

TRVTableItemInfo.CreateEx

Creates a new TRVTableItemInfo object having nRows rows and nCols columns.

constructor CreateEx(nRows, nCols: Integer; AMainRVData: TCustomRVData);

Parameters:

nRows – count of rows.

nCols – count of columns.

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this table.

Example

var table:TRVTableItemInfo;

...

table := TRVTableItemInfo.CreateEx(5, 5, MyRichViewEdit.RVData);

table.Color := clYellow;

table.Cells[0,0].AddNLATag('Hello',0,0,0);

MyRichViewEdit.InsertItem('5x5 table', table);

See also methods:

•	Create.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVTableItemInfo.DeleteCols
 TRichView Reference | Item Types | Table

TRVTableItemInfo.DeleteCols

Deletes Count columns starting from the Index-th column.

procedure DeleteCols(Index, Count: Integer; DecreaseWidth: Boolean);

Parameters:

Index – index of the first column to delete, in range 0..ColCount-1.

Count – number of columns to delete.

if DecreaseWidth = True, BestWidths of cells overlapping the deleted columns (due to cell-merging) will be decreased (recommended).

See also:

•	Undo note.

See also methods:

•	DeleteSelectedCols;

•	DeleteRows;

•	DeleteEmptyCols.


TRVTableItemInfo.DeleteEmptyCols
 TRichView Reference | Item Types | Table

TRVTableItemInfo.DeleteEmptyCols

Deletes all columns containing only nil-cells.

procedure DeleteEmptyCols;

Nil-cells occur due to cell-meging.

All-nil columns occur after cell-merging or deleting rows.

This method calls DeleteCols with DecreaseWidth = False.

See also:

•	Undo note.

See also methods:

•	DeleteEmptyRows;

•	DeleteSelectedCols;

•	DeleteCols.


TRVTableItemInfo.DeleteEmptyRows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.DeleteEmptyRows

Deletes all rows containing only nil-cells.

procedure DeleteEmptyRows;

Nil-cells occur due to cell-meging.

All-nil rows occur after cell-merging or deleting columns.

This method calls DeleteRows with DecreaseHeight = False.

See also:

•	Undo note.

See also:

•	DeleteEmptyCols;

•	DeleteSelectedRows;

•	DeleteRows.


TRVTableItemInfo.DeleteRows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.DeleteRows

Deletes Count rows starting from the Index-th row.

procedure DeleteRows(Index, Count: Integer; DecreaseHeight: Boolean);

Parameters:

Index – index of the first row to delete, in range 0..RowCount-1.

Count – number of rows to delete.

if DecreaseHeight = True, BestHeights of cells overlapping the deleted rows (due to cell-merging) will be decreased (recommended).

See also:

•	Undo note.

See also methods:

•	DeleteSelectedRows;

•	DeleteCols;

•	DeleteEmptyRows.


TRVTableItemInfo.DeleteSelectedCols
 TRichView Reference | Item Types | Table

 TRVTableItemInfo.DeleteSelectedCols

Deletes all columns containing selected cells

procedure DeleteSelectedCols;

This method deletes all columns containing the selected cells, even if not all cells in these columns are selected.

The cell that is being edited is considered selected.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	DeleteSelectedRows;

•	DeleteCols;

•	DeleteEmptyCols.


TRVTableItemInfo.DeleteSelectedRows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.DeleteSelectedRows

Deletes all rows containing selected cells.

procedure DeleteSelectedRows;

This method deletes all rows containing selected cells, even if not all cells in these rows are selected.

The cell that is being edited is considered selected.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	DeleteSelectedCols;

•	DeleteCols;

•	DeleteEmptyCols.


TRVTableItemInfo.Deselect
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Deselect

Removes selection from the table.

procedure Deselect;

All selected cells become not selected.

See also:

•	Overview of selection in tables.

See also methods:

•	Select;

•	SelectRows;

•	SelectCols.


TRVTableItemInfo.Destroy
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Destroy

Destroys an instance of TRVTableItemInfo.

destructor Destroy; override;

Do not call Destroy directly in an application. Tables are freed by the control where they were inserted.


TRVTableItemInfo.EditCell
 TRichView Reference | Item Types | Table

TRVTableItemInfo.EditCell

Activates editing of the specified cell..

procedure EditCell(Row,Col: Integer);

Parameters:

Row and Col defines the position of cell to edit. Row must be in range 0..RowCount-1, Col must be in range 0..ColCount-1.

Cells[Row, Col] must not be nil.

This method creates inplace-editor for this cell.

If this table is nested in another table, this method also initializes inplace-editor in the parent table.

This is an equivalent for Cells[Row, Col].Edit.

This method must be called when the document is formatted.

See also:

•	Overview of cell editing.

See also methods:

•	GetNormalizedSelectionBounds;

•	GetEditedCell.


TRVTableItemInfo.GetCellAt
 TRichView Reference | Item Types | Table

TRVTableItemInfo.GetCellAt

Returns cell at the specified coordinates.

function GetCellAt(X,Y: Integer; var Row,Col: Integer): Boolean;

Input parameters:

X, Y – coordinates, relative to the top left corner of the table.

Output parameters:

Row, Col – receive the position of cell.

This method must be called when the document is formatted.

See also methods of TCustomRichView:

•	GetItemCoords;

•	GetItemClientCoords.


TRVTableItemInfo.GetEditedCell
 TRichView Reference | Item Types | Table

TRVTableItemInfo.GetEditedCell

Returns inplace editor for the currently edited cell, or nil if there is no such cell.

function GetEditedCell(var Row,Col: Integer): TCustomRichViewEdit;

Output parameters:

Row and Col receive position of the cell that is being edited.

This method must be called when the document is formatted.

See also:

•	Overview of selection in tables;

•	Overview of cell editing.

See also methods:

•	GetNormalizedSelectionBounds;

•	EditCell.


TRVTableItemInfo.GetNormalizedSelectionBounds
 TRichView Reference | Item Types | Table

TRVTableItemInfo.GetNormalizedSelectionBounds

Returns selection in table in convenient form.

function GetNormalizedSelectionBounds(IncludeEditedCell: Boolean;

         var TopRow, LeftCol, ColSpan, RowSpan: Integer): Boolean;

Input parameter:

If IncludeEditedCell = True, this function returns position of the currently edited cell (if there is no selection and some cell is currently in editing state).

Output parameters:

TopRow, TopCol – receive the top left corner of the selection (warning: selection is not always rectangular!)

ColSpan, RowSpan – how many columns and rows the selection includes. Both values are >= 1.

Warning: it will be wrong to iterate through selected cells as:

for r := TopRow to  TopRow+RowSpan-1 do

  for c := LeftCol to TopCol+ColSpan-1 do

    if table.Cells[r,c]<>nil then ...

This cycle can miss some selected cells, because there can be some cells to the left of LeftCol and to the top of TopRow, which are also in selection because of spanning.

The correct example is in the topic about IsCellSelected.

Some operations are possible only on rectangular selection (for example, cell merging). It can be checked using CanMergeSelectedCells.

This method must be called when the document is formatted.

Return value:

True, if selection exists, False otherwise.

See also:

•	Overview of selection in tables

See also methods:

•	GetSelectionBounds;

•	GetEditedCell.


TRVTableItemInfo.GetSelectionBounds
 TRichView Reference | Item Types | Table

TRVTableItemInfo.GetSelectionBounds

Returns selection in table.

function GetSelectionBounds(var StartRow, StartCol, RowOffs, ColOffs: Integer): Boolean;

Output parameters:

Cells[StartRow, StartCol] is a cell where selection is started. Selection always includes this cell.

if RowOffs>0, the selection includes RowOffs rows below. If RowOffs<0, the selection includes abs(RowOffs) rows above.

The same is for ColOffs.

Selection includes all cells intersected with imaginary rectangle that fully includes Cells[StartRow, StartCol] and Cells[StartRow+RowOffs, StartCol+ColOffs]. Warning: these cells can be nil because of merging.

For example, the returned value (3,3,0,0) means that only one cell is selected: Cells[3,3].

Selection can have a rectangular shape or not (because of merging). Some operations are possible only on rectangular selection (for example, cell merging). It can be checked using CanMergeSelectedCells.

This method returns selection as it is stored internally. For practical use, GetNormalizedSelectionBounds is more convenient.

This method must be called when the document is formatted.

Return value:

True, if selection exists, False otherwise.

See also:

•	Overview of selection in tables.

See also methods:

•	GetNormalizedSelectionBounds;

•	Select;

•	Deselect.


TRVTableItemInfo.InsertCols
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertCols

Inserts Count columns in the position specified by Index.

procedure InsertCols(Index, Count, CopyIndex: Integer);

Parameters:

Index – index of the column to insert before (or ColCount to insert after the last column).

Count – number of columns to insert.

CopyIndex – if <>-1, this is an index (before the insertion) of column to copy attributes for new columns from. Colors, background, border, size, text and paragraph styles are copied.

See also:

•	Undo note.

See also methods:

•	InsertRows;

•	InsertColsLeft, InsertColsRight;

•	DeleteCols.


TRVTableItemInfo.InsertColsLeft
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertColsLeft

Inserts Count columns to the right of the selected cells (or the cell being edited)

procedure InsertColsLeft(Count: Integer);

Does nothing if the table has no selection or editing cell.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	InsertColsRight;

•	InsertCols;

•	InsertRowsAbove, InsertRowsBelow;

•	DeleteSelectedCols.


TRVTableItemInfo.InsertColsRight
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertColsRight

Inserts Count columns to the right of the selected cells (or the cell being edited)

procedure InsertColsRight(Count: Integer);

Does nothing if the table has no selection or editing cell.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	InsertColsLeft;

•	InsertCols;

•	InsertRowsAbove, InsertRowsBelow;

•	DeleteSelectedCols.


TRVTableItemInfo.InsertRows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertRows

Inserts Count rows in the position specified by Index.

procedure InsertRows(Index, Count, CopyIndex: Integer);

Parameters:

Index – index of the row to insert before (or RowCount to insert after the last row).

Count – number of rows to insert.

CopyIndex – if <>-1, this is an index (before the insertion) of row to copy attributes for new rows from. Colors, background, border, size, text and paragraph styles are copied.

See also:

•	Undo note.

See also methods:

•	InsertCols;

•	InsertRowsAbove, InsertRowsBelow;

•	DeleteRows.


TRVTableItemInfo.InsertRowsAbove
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertRowsAbove

Inserts Count rows above the selected cells (or the cell being edited)

procedure InsertRowsAbove(Count: Integer);

Does nothing if the table has no selection or editing cell.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	InsertRowsBelow;

•	InsertRows;

•	InsertColsLeft, InsertColsRight;

•	DeleteSelectedRows.


TRVTableItemInfo.InsertRowsBelow
 TRichView Reference | Item Types | Table

TRVTableItemInfo.InsertRowsBelow

Inserts Count rows below the selected cells (or the cell being edited)

procedure InsertRowsBelow(Count: Integer);

Does nothing if the table has no selection or editing cell.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	InsertRowsAbove;

•	InsertRows;

•	InsertColsLeft, InsertColsRight;

•	DeleteSelectedRows.


TRVTableItemInfo.IsCellSelected
 TRichView Reference | Item Types | Table

TRVTableItemInfo.IsCellSelected

Returns: is the specified cell selected or not.

function IsCellSelected(Row, Col: Integer): Boolean;

Example: iteration through all selected cells

for r := 0 to table.RowCount-1 do

  for c := 0 to table.ColCount-1 do

    if (table.Cells[r,c]<>nil) and

       table.IsCellSelected(r,c) then ...

This method must be called when the document is formatted.

See also:

•	Overview of selection in tables.

See also methods:

•	GetNormalizedSelectionBounds.


TRVTableItemInfo.LoadFromStream
 TRichView Reference | Item Types | Table

TRVTableItemInfo.LoadFromStream

Loads table from Stream.

procedure LoadFromStream(Stream: TStream);

Table must be saved using SaveToStream or SaveRowsToStream methods. Table can be loaded correctly only if collections of text, paragraph and list styles in TRVStyle are the same as at the moment of saving.

Applications rarely, if ever, call LoadFromStream directly. Usually tables are loaded from RVF files or streams with main documents.


TRVTableItemInfo.MergeCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.MergeCells

Merges the specified cells in one.

procedure MergeCells(TopRow, LeftCol, ColSpan, RowSpan: Integer; AllowMergeRC: Boolean);

Parameters:

TopRow, LeftCol – position of the top left cell for cell-merging.

ColSpan – number of columns for merging.

RowSpan – number of rows for merging.

The resulting cell is Cells[TopRow, TopCol] having ColSpan=ColSpan and RowSpan=RowSpan.

This method fails (does nothing) if the parameters do not define a rectangle (because of previous cell merging). You can check the possibility of merging using CanMergeCells.

AllowMergeRC = False forbids to perform merging, if it will cause appearing rows or columns containing only nils. It's not recommended to have such rows/columns, so you can either forbid such operation or to delete them using DeleteEmptyRows and DeleteEmptyCols (the latter is recommended).

See also:

•	Undo note.

See also methods:

•	CanMergeCells;

•	MergeSelectedCells;

•	GetNormalizedSelectionBounds;

•	UnmergeCells.


TRVTableItemInfo.MergeSelectedCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.MergeSelectedCells

Merges the selected cells.

procedure MergeSelectedCells(AllowMergeRC: Boolean);

This method fails (does nothing) if the selection does not have a rectangular shape (because of previous cell merging). You can check possibility of merging using CanMergeSelectedCells.

AllowMergeRC = False forbids to perform merging, if it will cause appearing rows or columns containing only nils. It's not recommended to have such rows/columns, so you can either forbid such operation or delete them with DeleteEmptyRows and DeleteEmptyCols (the latter is recommended).

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	CanMergeSelectedCells;

•	MergeCells;

•	GetNormalizedSelectionBounds;

•	UnmergeSelectedCells.


TRVTableItemInfo.SaveRowsToStream
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SaveRowsToStream

Saves the specified rows of table (from Index to Index+Count-1) to Stream.

procedure SaveRowsToStream(Stream: TStream; Index, Count: Integer);

(introduced in version 10)

The output is compatible with SaveToStream.

The result will be correct even if there are cells that overlap these rows because of RowSpan>1.

See also method:

•	LoadFromStream.

See also:

•	Example how to divide table in two parts.


TRVTableItemInfo.SaveToStream
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SaveToStream

Saves table to Stream.

procedure SaveToStream(Stream: TStream);

Applications rarely, if ever, call SaveToStream directly. Usually tables are saved to RVF files or streams with main documents.

See also method:

•	LoadFromStream;

•	SaveRowsToStream.


TRVTableItemInfo.Select
 TRichView Reference | Item Types | Table

TRVTableItemInfo.Select

Selects the range of cells in the table

procedure Select(StartRow, StartCol, RowOffs, ColOffs: Integer);

This method selects range (rectangle, if there is no cells-merging) of cells, starting from the cell (StartRow, StartCol). The parameters have the same meaning as in GetSelectionBounds.

Selection includes all cells intersected with imaginary rectangle that fully includes Cells[StartRow, StartCol] and Cells[StartRow+RowOffs, StartCol+ColOffs].

You cannot remove selection with this method, because Select(StartRow, StartCol, 0,0) selects one cell, use Deselect.

This method must be called when the document is formatted.

See also:

•	Overview of selection in tables

See also methods:

•	SelectRows, SelectCols;

•	GetSelectionBounds;

•	Deselect.


TRVTableItemInfo.SelectCols
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SelectCols

Selects Count columns starting from StartCol (to the right)

procedure SelectCols(StartCol, Count: Integer);

Parameters:

StartCol – index of the first column to select, in range 0..ColCount-1.

Count – number of columns to select.

This method must be called when the document is formatted.

See also:

•	Overview of selection in tables

See also methods:

•	SelectRows,

•	Select.


TRVTableItemInfo.SelectRows
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SelectRows

Selects Count rows starting from StartRow (down)

procedure SelectRows(StartRow, Count: Integer);

Parameters:

StartRow – index of the first row to select, in range 0..RowCount-1.

Count – number of rows to select.

This method must be called when the document is formatted.

See also:

•	Overview of selection in tables

See also methods:

•	SelectCols;

•	Select.


TRVTableItemInfo.SetCellBackgroundImage
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBackgroundImage

Assigns Value to Cells[Row, Col].BackgroundImage, as an editing operation.

procedure SetCellBackgroundImage(Value: TGraphic; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].BackgroundImage property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Image in Value is copied, so you still need to free memory for this it.

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBackgroundImageFileName
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBackgroundImageFileName

Assigns Value to Cells[Row, Col].BackgroundImageFileName, as an editing operation.

procedure SetCellBackgroundImageFileName(const Value: String; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].BackgroundImageFileName property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBackgroundStyle
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBackgroundStyle

Assigns Value to Cells[Row, Col].BackgroundStyle, as an editing operation.

procedure SetCellBackgroundStyle(Value: TRVItemBackgroundStyle; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].BackgroundStyle property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBestHeight
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBestHeight

Assigns Value to Cells[Row, Col].BestHeight, as an editing operation.

procedure SetCellBestHeight(Value: Integer; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].BestHeight property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBestWidth
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBestWidth

Assigns Value to Cells[Row, Col].BestWidth, as an editing operation.

procedure SetCellBestWidth(Value: Integer; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].BestWidth property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBorderColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBorderColor

Assigns Value to Cells[Row, Col].BorderColor, as an editing operation.

procedure SetCellBorderColor(Value: TColor; Row,Col: Integer);

(introduced in version 1.6)

Unlike direct assignment to Cells[Row, Col].BorderColor property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellBorderLightColor
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellBorderLightColor

Assigns Value to Cells[Row, Col].BorderLightColor, as an editing operation.

procedure SetCellBorderLightColor(Value: TColor; Row,Col: Integer);

(introduced in version 1.6)

Unlike direct assignment to Cells[Row, Col].BorderLightColor property, this method can be undone/redone, if it was called for table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellColor
 TRichView Reference | Item Types | Table

 TRVTableItemInfo.SetCellColor

Assigns Value to Cells[Row, Col].Color, as an editing operation.

procedure SetCellColor(Value: TColor; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].Color property, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellHint
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellHint

Assigns Value to Cells[Row, Col].Hint, as an editing operation.

procedure SetCellHint(const Value: String; Row,Col: Integer);

Unlike direct assignment to Cells[Row, Col].Hint property, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellVAlign
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellVAlign

Assigns Value to Cells[Row, Col].VAlign, as an editing operation.

procedure SetCellVAlign(Value: TRVCellVAlign; Row,Col: Integer);

(introduced in version 1.6)

Unlike direct assignment to Cells[Row, Col].VAlign property, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetCellVisibleBorders
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetCellVisibleBorders

Assigns values to Cells[Row, Col].VisibleBorders, as an editing operation.

procedure SetCellVisibleBorders(Left, Top, Right, Bottom: Boolean;

  Row,Col: Integer);

(introduced in version 1.6)

Unlike direct assignment to Cells[Row, Col].VisibleBorders subproperties, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetRowVAlign
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetRowVAlign

Assigns Value to Rows[Row].VAlign, as an editing operation.

procedure SetRowVAlign(Value: TRVCellVAlign; Row: Integer);

(introduced in version 1.6)

Unlike direct assignment to Rows[Row].VAlign property, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SetTableVisibleBorders
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SetTableVisibleBorders

Assigns values to VisibleBorders, as an editing operation.

procedure SetTableVisibleBorders(Left, Top, Right, Bottom: Boolean);

(introduced in version 10)

Unlike direct assignment to VisibleBorders subproperties, this method can be undone/redone, if it was called for the table inserted in TRichViewEdit (after insertion).

Use this method in conjunction with methods for updating editor window, see example.

See also:

•	Undo/redo in tables;

•	Undo/redo in TRichViewEdit.


TRVTableItemInfo.SplitSelectedCellsHorizontally
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SplitSelectedCellsHorizontally

Splits each selected cell into RowCount cells (inserting horizontal splitters).

procedure SplitSelectedCellsHorizontally(RowCount: Integer);

This method splits cells calling UnmergeCells, InsertRows and MergeCells. This method can change number of rows.

It's recommended to call this method only when selection has a rectangular shape, see CanMergeSelectedCells.

If no cells are selected, it splits the cell that is being edited.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	SplitSelectedCellsVertically;

•	UnmergeSelectedCells;

•	GetNormalizedSelectionBounds.


TRVTableItemInfo.SplitSelectedCellsVertically
 TRichView Reference | Item Types | Table

TRVTableItemInfo.SplitSelectedCellsVertically

Splits each selected cell into ColCount cells (inserting vertical splitters).

procedure SplitSelectedCellsVertically(ColCount: Integer);

This method splits cells calling UnmergeCells, InsertCols and MergeCells. This method can change number of columns.

It's recommended to call this method only when selection has a rectangular shape, see CanMergeSelectedCells.

If no cells are selected, it splits the cell that is being edited.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	SplitSelectedCellsVertically;

•	UnmergeSelectedCells;

•	GetNormalizedSelectionBounds.


TRVTableItemInfo.UnmergeCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.UnmergeCells

Unmerges cells.

procedure UnmergeCells(TopRow, LeftCol, ColSpan, RowSpan: Integer; UnmergeRows, UnmergeCols: Boolean);

Cells can be merged using the methods MergeCells or MergeSelectedCells.

This method unmerges all cells in range from Cells[TopRow, LeftCol] to Cells[TopRow+RowSpan, LeftCol+ColSpan].

If UnmergeRows=True, it unmerges each cell into RowSpan rows.

If UnmergeCols=True, it unmerges each cells into ColSpan columns.

UnmergeRows and UnmergeCells can both be True.

See also:

•	Undo note.

See also methods:

•	UnmergeSelectedCells;

•	MergeCells.


TRVTableItemInfo.UnmergeSelectedCells
 TRichView Reference | Item Types | Table

TRVTableItemInfo.UnmergeSelectedCells

Unmerges the selected cells.

procedure UnmergeSelectedCells(UnmergeRows, UnmergeCols: Boolean);

Cells can be merged using the methods MergeCells or MergeSelectedCells.

If UnmergeRows=True, it unmerges each selected cell into RowSpan rows.

If UnmergeCols=True, it unmerges each selected cells into ColSpan columns.

UnmergeRows and UnmergeCells can both be True.

This method must be called when the document is formatted.

See also:

•	Undo note.

See also methods:

•	UnmergeCells;

•	MergeSelectedCells;

•	GetNormalizedSelectionBounds.


TRVTableItemInfo.OnCellEditing
 TRichView Reference | Item Types | Table

TRVTableItemInfo.OnCellEditing

Occurs before starting editing of this cell and allows to prevent it.

type

  TRVCellEditingEvent = procedure (Sender: TRVTableItemInfo;

    Row, Col : Integer; Automatic: Boolean;

    var AllowEdit: Boolean) of object;

(introduced in version 1.7)

Input parameters

This event occurs when editor attempts to change content of Sender.Cells[Row, Col].

If Automatic=True, this is not actually a cell editing, but a multicell operation (clearing, applying style, etc.)

Output parameters

Set AllowEdit to False to disallow this operation.

Tables are not components, so their events cannot be assigned at design time in the Object Inspector. They must be assigned in code. Events are not saved in RVF files, so you need to reassign them when tables are loaded. The best place to assign this event is TRichView.OnItemAction event.

Example

// This procedure is assigned to OnCellEditing of all tables

procedure TMyForm.DoCellEditing(Sender: TRVTableItemInfo; Row, Col: Integer;

  Automatic: Boolean; var AllowEdit: Boolean);

begin

  // Preventing editing all cells in the top rows of all tables

  if Row=0 then

    AllowEdit := False;

end;

// MyRichViewEdit.OnItemAction. Assigns DoCellEditing to

// OnCellEditing events of all tables inserted in MyRichViewEdit.

// (this assignment occurs when table is inserted using

// AddItem or InsertItem methods, or is loaded from RVF or RTF file)

procedure TMyForm.MyRichViewEditItemAction(Sender: TCustomRichView;

  ItemAction: TRVItemAction; Item: TCustomRVItemInfo; var Text: String;

  RVData: TCustomRVData);

begin

  if (Item.StyleNo = rvsTable) and (ItemAction = rviaInserting) then

    TRVTableItemInfo(Item).OnCellEditing := DoCellEditing;

end;

See also:

•	TParaInfo.Options (rvpaoReadOnly, rvpaoStyleProtect, rvpaoDoNotWantReturns – protection options for paragraphs);

•	TFontInfo.Protection (protection options for text);

•	 TRVExtraItemProperty (rvepDeleteProtect, rvepResizable – protection option for nontext items).


TRVTableItemInfo.OnDrawBorder
 TRichView Reference | Item Types | Table

TRVTableItemInfo.OnDrawBorder

Allows custom drawing of table borders

type

  TRVTableDrawBorderEvent = procedure (Sender: TRVTableItemInfo;

    Canvas: TCanvas; Left,Top,Right,Bottom, Width: Integer;

    LightColor, Color, BackgroundColor: TColor;

    Style: TRVTableBorderStyle; Printing: Boolean;

    VisibleBorders: TRVBooleanRect; Row, Col: Integer;

    var DoDefault: Boolean) of object;

property OnDrawBorder: TRVTableDrawBorderEvent;

(introduced in version 1.7, modified in 1.8)

Input parameters

Sender – the table to draw border for (border can be drawn for the table itself or for the table cells).

Canvas – canvas where to draw.

Left, Top, Right, Bottom – rectangle for the border.

LightColor, Color, BackgroundColor – colors for border and for background (be careful - cell border is drawn after drawing cell content)

Style – border style.

Printing – True if this drawing is for printing; False if on screen.

VisibleBorders – VisibleBorders property for the table, or VisibleBorders property for the cell.

Row, Col – row and column of the cell (or -1 if this is a table border).

Output parameters

DoDefault – set to False to cancel the default border drawing.

For example,

{ Drawing a hairline border (both on screen and printer),

  assuming that CellBorderWidth=1, CellVSpacing=0, CellHSpacing=0.

  This example ignores VisibleBorders.

}

procedure TMyForm.DoDrawBorder(Sender: TRVTableItemInfo; Canvas: TCanvas;

  Left, Top, Right, Bottom, Width: Integer; LightColor, Color,

  BackgroundColor: TColor; Style: TRVTableBorderStyle; Printing: Boolean;

  VisibleBorders: TRVBooleanRect; var DoDefault: Boolean);

begin

  if Width=0 then

    exit;

  inc(Right);

  inc(Bottom);

  Canvas.Pen.Color := Color;

  Canvas.Pen.Style := psInsideFrame;

  Canvas.Pen.Width := 1;

  Canvas.Brush.Style := bsClear;

  Canvas.Rectangle(Left,Top,Right,Bottom);

  DoDefault := False;

end;

Tables are not components, so their events cannot be assigned at design time in the Object Inspector. They must be assigned in code. Events are not saved in RVF files, so you need to reassign them when tables are loaded. The best place to assign this event is TRichView.OnItemAction event.

// MyRichViewEdit.OnItemAction. Assigns DoDrawBorder to

// OnDrawBorder events of all tables inserted in MyRichViewEdit.

// (this assignment occurs when table is inserted using

// AddItem or InsertItem methods, or is loaded from RVF or RTF file)

procedure TMyForm.MyRichViewEditItemAction(Sender: TCustomRichView;

  ItemAction: TRVItemAction; Item: TCustomRVItemInfo; var Text: String;

  RVData: TCustomRVData);

begin

  if (Item.StyleNo = rvsTable) and (ItemAction = rviaInserting) then

    TRVTableItemInfo(Item).OnDrawBorder := DoDrawBorder;

end;


TRVTableCellData
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData

Properties   Methods

TRVTableCellData represents one cell in a table (see TRVTableItemInfo). Cells can be accessed using Cells property of table.

Unit RVTable.

Syntax

TRVTableCellData = class(TRVItemFormattedData)

 Hierarchy

TObject

TPersistent

TCustomRVData

TCustomRVFormattedData

TRVItemFormattedData

Methods and Properties

TRVTableCellData has many properties and methods corresponding to properties and methods of TRichView.

TRVTableCellData and class of object TRichView.RVData are derived from the same base class.

In addition, this class has properties affecting the cell view and layout:

•	Color – background color of cell;

•	BackgroundImage, BackgroundStyle – background image and its position;

•	BackgroundImageFileName – can be used when exporting to HTML;

•	BorderColor, BorderLightColor – colors of border;

•	BestWidth, BestHeight – preferred size of cell,

•	VAlign – vertical alignment of contents;

•	VisibleBorders – defines visible sides of cell border.

These properties can be saved with cell in RVF file or stream.

Also, this class has read-only properties:

•	ColSpan, RowSpan.

Important methods:

•	GetRVData.

See also

Table Cells Overview


TRVTableCellData.BackgroundImage
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BackgroundImage

Background image for the table cell

property BackgroundImage: TGraphic;

(introduced in v1.8)

Assignment to this property copies the image, so you still need to free the source image yourself.

Example 1 (assigning image):

bmp := TBitmap.Create;

bmp.LoadFromFile('c:\image.bmp');

table.Cells[r,c].BackgroundImage := bmp;

bmp.Free;

Example 2 (clearing the image):

table.Cells[r,c].BackgroundImage := nil;

See also properties:

•	BackgroundImageFileName;

•	BackgroundStyle;

•	Color.

See also properties of table:

•	BackgroundImage;

•	BackgroundStyle.

See also properties of TRichView:

•	BackgroundBitmap;

•	BackgroundStyle.


TRVTableCellData.BackgroundImageFileName
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BackgroundImageFileName

This is a string for storing file name associated with BackgroundImage

property BackgroundImageFileName: String;

(introduced in v1.9)

If rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML (unlike pictures and tables, cells are not items, so this property cannot be accessed using item string properties).

See also properties of table:

•	BackgroundImageFileName.


TRVTableCellData.BackgroundStyle
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BackgroundStyle

Defines the position of BackgroundImage.

property BackgroundStyle: TRVItemBackgroundStyle;

(introduced in v1.8)

See also:

•	BackgroundImage;

•	Color.

See also properties of table:

•	BackgroundStyle;

•	BackgroundImage.

See also properties of TRichView:

•	BackgroundStyle;

•	BackgroundBitmap.


TRVTableCellData.BestHeight
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BestHeight

Minimal height for the cell, pixels

property BestHeight: Integer

This property corresponds to <td height> in HTML.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellBestHeight.

The cell can be higher if it's required to show all its content (if rvtoIgnoreContentHeight is not included in table.Options).

Default value:

0

See also properties:

•	BestWidth.

See also properties of table:

•	Options (rvtoIgnoreContentHeight option).

See also:

•	Table Resizing.


TRVTableCellData.BestWidth
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BestWidth

Preferred width for the cell

property BestWidth: TRVHTMLLength;

This is a preferred width for cell, in pixels or percent of table width.

Corresponds to <td width> in HTML.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellBestWidth.

The cell can be wider than this value, if it's required to display its contents without overlapping. Cell always has enough width for displaying the widest its item + CellHPadding*2 + paragraph indents (FirstIndent, LeftIndent, RightIndent) (if rvtoIgnoreContentWidth is not included in table.Options).

The cell can be narrower than specified in this property, if the table is not wide enough.

Default value:

0

See also properties:

•	BestHeight.

See also properties of table:

•	BestWidth;

•	Options (rvtoIgnoreContentWidth option).

See also:

•	Table Resizing.


TRVTableCellData.BorderColor
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BorderColor

Color of border for this cell.

property BorderColor: TColor

(introduced in version 1.6)

If this value of this property is clNone, the cell uses table.CellBorderColor.

This value defines color of flat border around the cell or "dark" color of 3d border.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellBorderColor.

Default value:

clNone

See also properties:

•	BorderLightColor;

•	Color.

See also properties of table:

•	CellBorderColor;

•	BorderColor;

•	CellBorderStyle.


TRVTableCellData.BorderLightColor
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.BorderLightColor

"Light" color of 3d border for this cell

property BorderLightColor: TColor;

(introduced in version 1.6)

If this value of this property is clNone, the cell uses table.CellBorderLightColor.

This value defines light color of 3d border.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellBorderLightColor.

Default value:

clNone

See also properties:

•	BorderColor;

•	Color.

See also properties of table:

•	CellBorderColor;

•	BorderColor;

•	CellBorderStyle.


TRVTableCellData.Color
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.Color

Background color of the cell

property Color: TColor;

Set to clNone for transparent background.

This property corresponds to <td bgcolor> in HTML.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellColor.

Default value:

clNone

See also properties:

•	BorderColor;

•	BorderLightColor.

See also properties of table:

•	Color;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableCellData.ColSpan
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.ColSpan (read-only)

Read-only positive integer value specifying the number of columns spanned by this cell.

property ColSpan: Integer;

Initially this property is equal to 1 for all cells. This value can be changed due to cell-merging

Example:

This property corresponds to <td colspan> in HTML.

See also:

•	RowSpan.


TRVTableCellData.Hint
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.Hint

Contains the text string that can appear when the user moves the mouse pointer over the cell.

property Hint: String;

(introduced in version 10)

Default value:

'' (empty string)

See also:

•	TRVExtraItemStrProperty (rvespHint defines items hints, including table hints);

•	TCustomRichView.OnItemHint (unlike item hints, cell hints cannot be altered in this event).


TRVTableCellData.RowSpan
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.RowSpan (read-only)

Read-only positive integer value specifying the number of rows spanned by this cell

property RowSpan: Integer;

Initially this property is equal to 1 for all cells. This value can be changed due to cell-merging.

Example:

This property corresponds to <td rowspan> in HTML.

See also:

•	ColSpan.


TRVTableCellData.VAlign
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.VAlign

Defines vertical alignment of the cell content.

property VAlign:TRVCellVAlign;

(introduced in version 1.6)

If this property is set to rvcVDefault, the cell uses vertical alignment of its row, see TRVTableRow.VAlign.

Direct assignment to this property cannot be undone/redone by user, use table.SetCellVAlign.

Default value:

rvcVDefault


TRVTableCellData.VisibleBorders
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.VisibleBorders

Allows to hide some sides of cell border.

property VisibleBorders: TRVBooleanRect;

Direct assignment to this property cannot be undone/redone by user, use table.SetCellVisibleBorders.

Default value:

True, True, True, True (all sides are visible)

See also properties of table:

•	VisibleBorders;

•	CellBorderWidth;

•	CellBorderColor;

•	CellBorderLightColor.


TRVTableCellData.GetRVData
 TRichView Reference | Item Types | Table | Cell

TRVTableCellData.GetRVData

Returns object containing cell data (document items)

function GetRVData: TCustomRVData;

The cell is "an object containing data" itself. But when cell is in editing state, all its data are moved to inplace editor, and the cell is empty.

This method returns:

•	the cell itself, if it is not in editing state;

•	RVData property of inplace editor, otherwise.

So when working with content of cell directly, you can use this method and do not worry about editing state of a cell.

Example (retrieving text from table):

function GetTableText(table: TRVTableItemInfo): String;

var

  i, r, c: Integer;

  RVData: TCustomRVData;

begin

  Result := '';

  for r := 0 to table.RowCount-1 do

  begin

    for c := 0 to table.ColCount-1 do

      if table.Cells[r,c]<>nil then

      begin

        RVData := table.Cells[r,c].GetRVData;

        for i := 0 to RVData.ItemCount-1 do

        begin

          if (i>0) and RVData.IsFromNewLine(i) then

            Result := Result + #13#10;

          if RVData.GetItemStyle(i)=rvsTab then

            Result := Result + #9

           else if RVData.GetItemStyle(i)>=0 then

            Result := Result + RVData.GetItemText(i);

        end;

        Result := Result + table.TextColSeparator;

      end;

    Result := Result + table.TextRowSeparator;

  end;

end;

See also methods:

•	GetSourceRVData.


Additional properties of TRVTableCellData
 TRichView Reference | Item Types | Table | Cell

 Additional Properties and Methods of TRVTableCellData

TRVTableCellData has many properties and methods, similar to properties and methods of TRichView.

Some of them are listed below.

But when the cell is in editing state, RichViewEdit creates special inplace-editor and temporary moves all cell content to this editor.

To provide correct work with cell content both in normal and in editing state, call methods of cell.GetRVData instead of methods of the cell itself.

When working in editor, you seldom need to access cells' data directly, the most of operations can be performed using the methods that work with item at the caret position, read more.

See also: TRVTableItemInfo.Changed

Cell methods for appending items

(links are to the corresponding methods of TCustomRichView)

•	AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag;

•	AddBulletEx, AddBulletExTag;

•	AddControlEx, AddControlExTag;

•	AddHotspotEx, AddHotspotExTag;

•	AddFmt, AddItem;

•	AddNL, AddNLTag, AddTextNL;

•	AddPictureEx, AddPictureExTag;

•	AddNLATag, AddNLWTag.

(note: it's not recommended to use the methods of the group above for cells of table inserted in TRichViewEdit, if editor's UndoLimit<>0)

Obtaining information from cell

•	GetItemStyle;

•	GetBreakInfo, GetBulletInfo, GetControlInfo, GetHotspotInfo, GetPictureInfo, GetTextInfo;

•	GetItemTag, IsParaStart, GetItemPara, IsFromNewLine, GetOffsBeforeItem, GetOffsAfterItem.

Modifying items

SetBreakInfo, SetBulletInfo, SetControlInfo, SetHotspotInfo, SetPictureInfo, SetItemTag.

(note: it's not recommended to use the methods of the group above for cells of table inserted in TRichViewEdit, if editor's UndoLimit<>0)


TRVTableRow
 TRichView Reference | Item Types | Table | Row

TRVTableRow

Properties   Methods

This class represents one row in table (TRVTableItemInfo)

Unit RVTable;

Syntax

TRVTableRow = class(TRVDataList)

Hierarchy

TObject

TList

TRVList

TRVDataList

Using

Table has Rows property of class TRVTableRows. TRVTableRows is a list of objects of class TRVTableRow. TRVTableRow object is rarely, if ever, created directly in an application. It used only as an item of Rows property of tables.

Please do not use methods of this class for modifying (adding, deleting, replacing) cells. Use the proper methods of TRVTableItemInfo instead.

The key properties of this class are Items and Count.

Count is the number of columns in the table (all rows in the table have the same number of cells).

Row also has VAlign property defining default vertical alignment of its cells, and PageBreakBefore allowing to set page break before this row.

See Also

Table Cells Overview


TRVTableRow.Items
 TRichView Reference | Item Types | Table | Row

TRVTableRow.Items

Provides indexed access to the cells of table

property Items[Index: Integer]:TRVTableCellData; default;

Each item represents one cell of the table.

Usually cells are accessed as Cells property of table instead.


TRVTableRow.PageBreakBefore
 TRichView Reference | Item Types | Table | Row

TRVTableRow.PageBreakBefore

Allows to set explicit page break before this row.

property PageBreakBefore: Boolean;

(introduced in version 10)

If at least one row has PageBreaksBefore=True, absence of rvtoRowsSplit in table.PrintOptions is ignored.

Default value:

False


TRVTableRow.VAlign
 TRichView Reference | Item Types | Table | Row

TRVTableRow.VAlign

Defines default vertical alignment for contents of cells in the row

property VAlign:TRVCellVAlign;

(introduced in version 1.6)

rvcVDefault works like rvcMiddle.

Direct assignment to this property cannot be undone/redone by user, use table.SetRowVAlign.

Default value:

rvcTop

See also properties of cell:

•	VAlign

See also methods of table:

•	SetRowVAlign.


TRVTableRows
 TRichView Reference | Item Types | Table | Rows

TRVTableRows

Properties   Methods

TRVTableRows represents contents of table (see TRVTableItemInfo)

Unit RVTable.

Syntax

TRVTableRows = class(TRVList)

Hierarchy

TObject

TList

TRVList

Using

This is the type of Rows properties of table. TRVTableRows is a list of TRVTableRows which are in their order are lists of TRVTableCellData (i.e. table cells)

TRVTableRows object is rarely, if ever, created directly in an application. It used only as Rows property of tables.

Please do not use methods of this class for modifying (adding, deleting, replacing) rows. Use the proper methods of TRVTableItemInfo instead.

The key properties of this class are Items and Count. Count is the number of rows in the table.

This class has method for finding main cell for given merged cell: GetMainCell.

See Also

Table Cells Overview


TRVTableRows.Items
 TRichView Reference | Item Types | Table | Rows

TRVTableRows.Items

Provides indexed access to the rows of table

property Items[Index: Integer]: TRVTableRow; default;

Each item represents one row of the table.


TRVTableRows.GetMainCell
 TRichView Reference | Item Types | Table | Rows

TRVTableRows.GetMainCell

Returns the main (top left) cell for given merged cell.

function GetMainCell(ARow,ACol: Integer; var MRow, MCol: Integer): TRVTableCellData;

Some cells in table can be equal to nil due to cell-merging. This method allows to find the top left cell overlapping the given merged cell.

Input parameters:

ARow and ACol specify some cell in the table. Table.Cells[ARow, ACol] can be nil.

Output parameters:

MRow and MCol receive position of the main cell. This cell is never equal to nil.

if Table.Cells[ARow, ACol]<>nil then MRow will be equal to ARow and MCol will be equal to ACol.

Return value:

Table.Cells[MRow, MCol]


Label - TRVLabelItemInfo
 TRichView Reference | Item Types | Label

TRVLabelItemInfo

Properties    Methods

TRVLabelItemInfo is a class representing "label" in TRichView documents. This is a non-text item looking like text (but it cannot be wrapped). This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsLabel (-200)

Unit RVLabelItem.

Syntax

TRVLabelItemInfo = class(TRVRectItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

Properties

This item displays Text using font defined in TextStyleNo. ProtectTextStyleNo can be used to protect TextStyleNo from changing.

You can set minimal possible width for this item (MinWidth) and horizontal text Alignment.

You can define Cursor for this item.

There are no editing-style methods for changing properties of this item. If you want to change them as an editing operation, select this label, delete the selection, then insert a new one with new properties.

Related Properties of TRVStyle

•	FieldHighlightColor – color for highlighting label items (overrides background color specified in the text style)

•	FieldHighlightType specifies when to highlight label items.

Inherited Classes

The following item types are inherited from this class:

•	TRVSeqItemInfo (numbered sequences);

•	TRVEndNoteItemInfo (endnote);

•	TRVFootnoteItemInfo (footnote);

•	TRVNoteReferenceItemInfo (reference to the parent footnote or endnote).

See Also...

Demos:

•	Demos\Delphi\Assorted\Fields\MailMerge-LabelItems\

•	Demos\CBuilder\Assorted\Fields\MailMerge-LabelItems\


TRVLabelItemInfo.Alignment
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.Alignment

Defines horizontal alignment of text relative to the item.

property Alignment: TAlignment;

This property makes sense if Text width is less than MinWidth.

Default value:

taLeftJustify


TRVLabelItemInfo.Cursor
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.Cursor

Cursor for the item.

Cursor: TCursor;

Value of this property is not stored in RVF.

Default value:

crDefault (using default cursor)


TRVLabelItemInfo.MinWidth
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.MinWidth

Defines minimal width of this item, pixels.

property MinWidth: Integer;

Default value:

0

See also properties:

•	Alignment;

•	Text.


TRVLabelItemInfo.ProtectTextStyleNo
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.ProtectTextStyleNo

If set to True, TCustomRichViewEdit.ApplyTextStyle and ApplyStyleConversion will not be able to change TextStyleNo of this item.

ProtectTextStyleNo: Boolean;

Default value:

False


TRVLabelItemInfo.RemoveInternalLeading
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.RemoveInternalLeading

Allows removing spacing above the text.

RemoveInternalLeading: Boolean;

If True, the label item is displayed without leading (space) above the text (i.e. without font internal leading). Accent marks and other diacritical characters may occur in this area, so do not use this property if Text contains accented characters.

This property is useful is this label item is used as a drop cap (the first letter in a chapter, with vertical alignment = rvvaLeft).

Default value:

False


TRVLabelItemInfo.Text
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.Text

Visible text

Text: String;

Unlike text items, this is not the text returned by TCustomRichView.GetItemText.

 Unicode note: For Delphi/C++Builder 2009+, this is a Unicode text. For older versions, this is ANSI text.

See also properties:

•	Alignment;

•	TextStyleNo.


TRVLabelItemInfo.TextStyleNo
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.TextStyleNo

Defines text attributes.

property TextStyleNo: Integer;

This is the index in the TextStyles collection of the TRVStyle component linked to the TCustomRichView component containing this item.

Unicode property of text style is ignored.

If this item is inserted in editor, value of this property may be changed when ApplyTextStyle or ApplyStyleConversion method is called. You can prevent this by assigning True to  ProtectTextStyleNo property.

See also properties:

•	Text.


TRVLabelItemInfo.Create
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.Create

A constructor, creates a new TRVLabelItemInfo object

constructor Create(RVData: TPersistent); override;

Parameter:

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this item.

This constructor creates a new label with empty Text and TextStyleNo=0.

There is more convenient constructor, CreateEx.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVLabelItemInfo.CreateEx
 TRichView Reference | Item Types | Label

TRVLabelItemInfo.CreateEx

A constructor, creates a new TRVLabelItemInfo object with the specified Text and TextStyleNo.

constructor CreateEx(RVData: TPersistent;

  TextStyleNo: Integer; const Text: String);

Parameters:

RVData – RVData property of TRichView or TRichViewEdit where you wish to insert this item.

TextStyleNo – value for TextStyleNo property.

Text – value for Text property.

See also methods:

•	Create.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


Numbered Sequence - TRVSeqItemInfo
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo

Properties    Methods

TRVSeqItemInfo is a class representing numbered sequence in TRichView documents. This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsSequence (-202)

Unit RVSeqItem.

Syntax

TRVSeqItemInfo = class(TRVLabelItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

Properties

The main property of this class is SeqName. All items having the same value of this property are numbered continuously. You can restart numbering from the specified value, see  StartFrom and Reset properties.

Numbering type is defined in NumberType property.

Font for this item is defined in TextStyleNo. ProtectTextStyleNo can be used to protect TextStyleNo from changing.

Text for this item is calculated automatically.

There are no editing-style methods for changing properties of this item. If you want to change them as an editing operation, select this item, delete the selection, then insert a new one with new properties.

Related Properties of TRVStyle

•	FieldHighlightColor – color for highlighting numbering sequences (overrides background color specified in the text style)

•	FieldHighlightType specifies when to highlight numbering sequences.

Numbering Sequences and List Markers

Numbered sequences are similar to list markers. The table below shows differences between them.

Numbered sequences	List markers
Items can be inserted in any place of document.	List markers start paragraphs.
Counter for the item is calculated using SeqName property.	Counter for the item is calculated using list index and list level.
Simple numbering.	Multilevel numbering.
Visual appearance is defined using the item properties.	Visual appearance is defined in list styles.
Items in the same sequence may have different fonts, numbering type, format strings.	All list markers linked to the same list level have the same font, numbering type and format string.
TCustomRichViewEdit.ApplyTextStyle and ApplyStyleConversion can change item font.	TCustomRichViewEdit.ApplyTextStyle and ApplyStyleConversion cannot change item font.
Inherited Classes

The following item types are inherited from this class:

•	TRVEndNoteItemInfo (endnote);

•	TRVFootnoteItemInfo (footnote);

•	TRVNoteReferenceItemInfo (reference to the parent footnote or endnote).

See Also...

Demos:

•	Demos\Delphi\Assorted\Fields\MailMerge-LabelItems\

•	Demos\CBuilder\Assorted\Fields\MailMerge-LabelItems\


TRVSeqItemInfo.FormatString
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.FormatString

Text format.

FormatString: String;

If value of this property is not empty, it defines format for text. Use '%s' to specify where to insert numbering.

For example, if FormatString = 'Figure %s.', NumberType = rvseqUpperRoman, and counter value is 2, this item displays 'Figure II.'.

You can assign this property before inserting this item in TRichView.

This property is ignored when saving documents to RTF.

Default value:

'' (empty string)


TRVSeqItemInfo.NumberType
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.NumberType (read-only)

Numbering type.

property NumberType: TRVSeqType;

See TRVSeqType for possible values.

This property is initialized in constructor CreateEx.

This property is ignored in inherited classes: TRVFootnoteItemInfo and TRVEndnoteItemInfo.

See also properties:

•	FormatString.


TRVSeqItemInfo.Reset
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.Reset (read-only)

Resets counter to StartFrom.

Reset: Boolean;

This property is initialized in constructor CreateEx.


TRVSeqItemInfo.SeqName
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.SeqName (read-only)

Name of sequence. Items having the same value of this property are numbered continuously.

SeqName: String;

Character case is ignored for this property.

The following values are reserved and cannot be used for this property for TRVSeqItemInfo:

•	'@footnote@' (used in TRVFootnoteItemInfo);

•	'@endnote@' (used in TRVEndnoteItemInfo).

This property is initialized in constructor CreateEx.


TRVSeqItemInfo.StartFrom
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.StartFrom (read-only)

Value of counter for this item, if Reset = True.

StartFrom: Integer;

This property is initialized in constructor CreateEx.


TRVSeqItemInfo.Create
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.Create

A constructor, creates a new TRVSeqItemInfo object

constructor Create(RVData: TPersistent); override;

Please do not use this constructor, because it does not allow to set values of properties (including read-only properties).

Use CreateEx instead.


TRVSeqItemInfo.CreateEx
 TRichView Reference | Item Types | Numbered Sequence

TRVSeqItemInfo.CreateEx

A constructor, creates a new TRVSeqItemInfo object.

constructor CreateEx(RVData: TPersistent; const ASeqName: String;

  ANumberType: TRVSeqType; ATextStyleNo, AStartFrom: Integer;

  AReset: Boolean);

Parameters:

RVData – RVData property of TRichView or TRichViewEdit where you wish to insert this item.

ASeqName – value for SeqName property.

ANumberType – value for NumberType property.

ATextStyleNo – value for TextStyleNo property.

AStartFrom – value for StartFrom property.

AReset – value for Reset property.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


Ancestor for Notes - TCustomRVNoteItemInfo
 TRichView Reference | Item Types | Ancestor class for footnotes and endnotes

TCustomRVNoteItemInfo

Properties    Methods

TCustomRVNoteItemInfo is an ancestor class for footnote and endnote items. Objects of this class must not be created directly, create TRVEndNoteItemInfo (endnote) or TRVFootnoteItemInfo (footnote) instead.

Unit RVNote.

Syntax

TCustomRVNoteItemInfo = class(TRVSeqItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

TRVSeqItemInfo

Properties

This class introduces Document property – footnote/endnote text. This text is not displayed in TCustomRichView, but it is displayed on printing.

Document uses the same TRVStyle component as the main document (where footnote/endnote is inserted).

You can use ReplaceDocumentEd method to change Document as an editing operation.

See Also...

Demos:

•	Demos\Delphi\Editors\Notes

•	Demos\CBuilder\Editors\Notes


TCustomRVNoteItemInfo.Document
 TRichView Reference | Item Types | Ancestor class for footnotes and endnotes

TCustomRVNoteItemInfo.Document (read-only)

Footnote/endnote text (displayed on printing)

property Document: TRVNoteData;

You can use ReplaceDocumentEd method to change Document as an editing operation.


TCustomRVNoteItemInfo.ReplaceDocumentEd
 TRichView Reference | Item Types | Ancestor class for footnotes and endnotes

TCustomRVNoteItemInfo.ReplaceDocumentEd

Replaces content of Document as an editing operation.

procedure ReplaceDocumentEd(Stream: TStream);

Stream must contain new document in RVF format.


Endnote - TRVEndnoteItemInfo
 TRichView Reference | Item Types | Endnote

TRVEndnoteItemInfo

Properties    Methods

TRVEndnoteItemInfo is a class representing endnote in TRichView documents. This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsEndnote (-204)

Unit RVNote.

Syntax

TRVEndnoteItemInfo = class(TCustomRVNoteItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

TRVSeqItemInfo

TCustomRVNoteItemInfo

Using

Numbering type for endnotes is defined in EndnoteNumbering property of TRVStyle component (NumberType property, inherited from TRVSeqItemInfo, is ignored).

You can enumerate all endnotes in documents using RVGetFirstEndnote and RVGetNextEndnote functions.

Use RVGetNoteTextStyleNo to assign TextStyleNo property (in the constructor).

Limitation: in TRVReportHelper, all pages consisting only of endnotes' texts have the same height as the last document's page.

There are no editing-style methods for changing properties of this item (except for Document). If you want to change them as an editing operation, select this item, delete the selection, then insert a new one with new properties.

Example

This example inserts a new endnote in rveMain (TCustomRichViewEdit). TextStyleNo for this endnote is returned by RVGetNoteTextStyleNo function basing on the rveMain.CurTextStyleNo-th style).

Document for this endnote contains one reference (TextStyleNo for this reference is returned by RVGetNoteTextStyleNo function basing on the 0th style) and one space character of the 0th style.

var EndNote: TRVEndnoteItemInfo;

    NoteRef: TRVNoteReferenceItemInfo;

begin

  EndNote := TRVEndnoteItemInfo.CreateEx(rveMain.RVData,

    RVGetNoteTextStyleNo(rvs, rveMain.CurTextStyleNo), 1, False);

  NoteRef := TRVNoteReferenceItemInfo.CreateEx(EndNote.Document, RVGetNoteTextStyleNo(rveMain.Style,0));

  EndNote.Document.AddItem('', NoteRef);

  EndNote.Document.AddNLATag(' ', 0, -1, 0);

  if rveMain.InsertItem('', EndNote) then

    ...

end;

The topic about TRVNoteReferenceItemInfo contains example showing how to edit Document.

See Also...

Demos:

•	Demos\Delphi\Editors\Notes

•	Demos\CBuilder\Editors\Notes


TRVEndnoteItemInfo.Create
 TRichView Reference | Item Types | Endnote

TRVEndnoteItemInfo.Create

A constructor, creates a new TRVEndnoteItemInfo object

constructor Create(RVData: TPersistent); override;

Parameter:

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this item.

This constructor creates a new endnote with TextStyleNo=0.

There is more convenient constructor, CreateEx.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVEndnoteItemInfo.CreateEx
 TRichView Reference | Item Types | Endnote

TRVEndnoteItemInfo.CreateEx

A constructor, creates a new TRVEndnoteItemInfo object with the specified properties

constructor CreateEx(RVData: TPersistent;

  ATextStyleNo, AStartFrom: Integer; AReset: Boolean);

Parameters:

RVData – RVData property of TRichView or TRichViewEdit where you wish to insert this item.

ATextStyleNo – value for TextStyleNo property. It's recommended to use RVGetNoteTextStyleNo function for assigning this parameter.

AStartFrom – value for StartFrom property.

AReset – value for Reset property.

See also methods:

•	Create.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


Footnote - TRVFootnoteItemInfo
 TRichView Reference | Item Types | Footnote

TRVFootnoteItemInfo

Properties    Methods

TRVFootnoteItemInfo is a class representing footnote in TRichView documents. This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsFootnote (-203)

Unit RVNote.

Syntax

TRVFootnoteItemInfo = class(TCustomRVNoteItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

TRVSeqItemInfo

TCustomRVNoteItemInfo

Using

Numbering type for footnotes is defined in FootnoteNumbering property of TRVStyle component (NumberType property, inherited from TRVSeqItemInfo, is ignored).

You can enumerate all footnotes in documents using RVGetFirstFootnote and RVGetNextFootnote functions.

Use RVGetNoteTextStyleNo to assign TextStyleNo property (in the constructor).

Footnotes are numbered continuously in TCustomRichView. But when printing, footnote numbering can be restarted on each page, see FootnotePageReset property of TRVStyle component.

Limitation: footnote's Document must not be higher than the page height. Unlike endnotes, footnote is printed on a single page.

There are no editing-style methods for changing properties of this item (except for Document). If you want to change them as an editing operation, select this item, delete the selection, then insert a new one with new properties.

Example

This example inserts a new footnote in rveMain (TCustomRichViewEdit). TextStyleNo for this footnote is returned by RVGetNoteTextStyleNo function basing on the rveMain.CurTextStyleNo-th style).

Document for this footnote contains one reference (TextStyleNo for this reference is returned by RVGetNoteTextStyleNo function basing on the 0th style) and one space character of the 0th style.

var FootNote: TRVFootnoteItemInfo;

    NoteRef: TRVNoteReferenceItemInfo;

begin

  FootNote := TRVFootnoteItemInfo.CreateEx(rveMain.RVData,

    RVGetNoteTextStyleNo(rvs, rveMain.CurTextStyleNo), 1, False);

  NoteRef := TRVNoteReferenceItemInfo.CreateEx(FootNote.Document, RVGetNoteTextStyleNo(rveMain.Style,0));

  FootNote.Document.AddItem('', NoteRef);

  FootNote.Document.AddNLATag(' ', 0, -1, 0);

  if rveMain.InsertItem('', FootNote) then

    ...

end;

The topic about TRVNoteReferenceItemInfo contains example showing how to edit Document.

See Also...

Demos:

•	Demos\Delphi\Editors\Notes

•	Demos\CBuilder\Editors\Notes


TRVFootnoteItemInfo.Create
 TRichView Reference | Item Types | Footnote

TRVFootnoteItemInfo.Create

A constructor, creates a new TRVFootnoteItemInfo object

constructor Create(RVData: TPersistent); override;

Parameter:

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this item.

This constructor creates a new footnote with TextStyleNo=0.

There is more convenient constructor, CreateEx.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVFootnoteItemInfo.CreateEx
 TRichView Reference | Item Types | Footnote

TRVFootnoteItemInfo.CreateEx

A constructor, creates a new TRVFootnoteItemInfo object with the specified properties

constructor CreateEx(RVData: TPersistent;

  ATextStyleNo, AStartFrom: Integer; AReset: Boolean);

Parameters:

RVData – RVData property of TRichView or TRichViewEdit where you wish to insert this item.

ATextStyleNo – value for TextStyleNo property. It's recommended to use RVGetNoteTextStyleNo function for assigning this parameter.

AStartFrom – value for StartFrom property.

AReset – value for Reset property.

See also methods:

•	Create.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


Reference to the Parent Note - TRVNoteReferenceItemInfo
 TRichView Reference | Item Types | Reference to the parent note

TRVNoteReferenceItemInfo

Properties    Methods

TRVNoteReferenceItemInfo is an item type referring to the parent footnote or endnote item. Objects of this class are usually appended to the footnote's or endnote's Document (see AddItem). Besides, they can be appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsNoteReference (-205).

Unit RVNote.

Syntax

TRVNoteReferenceItemInfo = class(TRVLabelItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

Using

When inserted in footnote's/endnote's Document, the note reference displays the same text as the parent footnote/endnote.

When inserted in TCustomRichView, it displays NoteText.

Text for this item is calculated automatically.

Use RVGetNoteTextStyleNo to assign TextStyleNo property (in the constructor).

There are no editing-style methods for changing properties of this item. If you want to change them as an editing operation, select this item, delete the selection, then insert a new one with new properties.

Example

See examples in TRVFootnoteItemInfo and TRVEndNoteItemInfo showing how to insert footnote/endnote with document containing note reference.

This example shows how to edit note document in rveNote (TCustomRichViewEdit). The footnote/endnote is NoteItem.

This code copies document from footnote/endnote to the editor:

var Stream: TMemoryStream;

begin

  rveNote.NoteText := NoteItem.Text;

  rveNote.Clear;

  Stream := TMemoryStream.Create;

  try

    NoteItem.Document.SaveRVFToStream(Stream);

    Stream.Position := 0;

    rveNote.LoadRVFFromStream(Stream);

  finally

    Stream.Free;

  end;

  with rveNote do begin

    Format;

    SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1),

      ItemCount-1, GetOffsAfterItem(ItemCount-1));

  end;

You can see that the text of footnote/endnote is assigned to the editor's NoteText. If this document contains note references, they will display this text.

After editing, the document can be saved back to the footnote/endnote:

  if not rveNote.Modified then

    exit;

  Stream := TMemoryStream.Create;

  try

    rveNote.SaveRVFToStream(Stream, False);

    NoteItem.ReplaceDocumentEd(Stream);

  finally

    Stream.Free;

  end;

  rveNote.Modified := False;

See Also...

Demos:

•	Demos\Delphi\Editors\Notes

•	Demos\CBuilder\Editors\Notes


TRVNoteReferenceItemInfo.Create
 TRichView Reference | Item Types | Reference to the parent note

TRVNoteReferenceItemInfo.Create

A constructor, creates a new TRVNoteReferenceItemInfo object

constructor Create(RVData: TPersistent); override;

Parameter:

RVData – RVData property of TRichView or TRichViewEdit, where you wish to insert this item.

This constructor creates a new note reference with TextStyleNo=0.

There is more convenient constructor, CreateEx.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


TRVNoteReferenceItemInfo.CreateEx
 TRichView Reference | Item Types | Reference to the parent note

TRVNoteReferenceItemInfo.CreateEx

A constructor, creates a new TRVNoteReferenceItemInfo object with the specified properties.

constructor CreateEx(RVData: TPersistent; TextStyleNo: Integer);

Parameters:

RVData – RVData property of TRichView or TRichViewEdit where you wish to insert this item.

TextStyleNo – value for TextStyleNo property. It's recommended to use RVGetNoteTextStyleNo function for assigning this parameter.

See also methods:

•	Create.

See also methods of TCustomRichView:

•	AddItem.

See also methods of TCustomRichViewEdit:

•	InsertItem.


ERichViewError
 TRichView Reference | Classes

ERichViewError

This is an exception class used by TRichView Family of components. It does not introduce new methods and properties.

Unit RichView;

Syntax

ERichViewError = class(Exception)

Hierarchy

TObject

Exception


TCustomRVData and Others (TRichView Documents)
 TRichView Reference | Classes

TCustomRVData, TCustomRVFormattedData and Others (TRichView Documents)

These classes represent RichView documents. Documents contain a list of items. Some items may, in each order, contain subdocuments.

Class	Unit	Meaning
TCustomRVData	CRVData	Basic class for TRichView documents.
TCustomRVFormattedData	CRVFData	Basic class for formatted TRichView documents (allows storing items coordinates).
TRVControlData	RVCtrlData	Basic class for documents owned by windowed control.
TRichViewRVData	RVRVData	Document in TRichView and TDBRichView, a class of RVData property of these components.
TRVEditRVData	RVERVData	Document in TRichViewEdit and TDBRichViewEdit, a class of RVData property of these components.
TRVTInplaceRVData	RVTInplace	Document in cell inplace editor, a class of of RVData property of cell inplace editors.
TRVItemFormattedData	RVDataList	Basic class for formatted subdocuments owned by items.
TRVTableCellData	RVTable	Table cell.
TRVSubData	RVSubData	Basic class for invisible documents owned by items.
TRVNoteData	RVNote	Document in footnote or endnote.
This list does not include document classes used for printing.

Hierarchy

Overview

Special methods for TCustomRVData:

•	Edit;

•	GetRVData;

•	GetSourceRVData.

Special methods for TCustomRVFormattedData:

•	GetOriginEx.

These classes have many methods and properties similar to methods and properties in TRichView (what's why in this manual many links to RVData's methods refer to TRichView's methods).

For example, the methods for appending items:

(the links are to the corresponding methods of TRichView)

•	AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag,,

•	AddBulletEx, AddBulletExTag,

•	AddControlEx, AddControlExTag,

•	AddHotspotEx, AddHotspotExTag,

•	AddFmt, AddItem,

•	AddNL, AddNLTag, AddTextNL,

•	AddPictureEx, AddPictureExTag,

•	AddNLATag, AddNLWTag

Obtaining information from cell:

•	GetItemStyle, GetItemText -A -W,

•	GetBreakInfo, GetBulletInfo, GetControlInfo, GetHotspotInfo, GetPictureInfo

•	GetItemTag, GetItemVAlign, IsParaStart, GetItemPara, IsFromNewLine

Modifying items:

•	SetBreakInfo, SetBulletInfo, SetControlInfo, SetHotspotInfo, SetPictureInfo, SetItemTag, SetItemVAlign, SetItemText -A -W

See also

•	Controls, Documents, Items


TCustomRVData.Edit
 TRichView Reference | TCustomRVData

TCustomRVData.Edit

Initializes editor for this RVData.

function Edit: TCustomRVData;

For RVData of editor (main editor, or cell inplace editor), this method does nothing.

For table cell, this method creates cell inplace editor and returns its RVData.

If you want to select part of document in table cell, call Cell.Edit (or table.EditCell) before calling cell.SetSelectionBounds or cell.SelectAll.

This method must be called when the document is formatted.

Return value

GetRVData of the given RVData after initialization of editing.

Example

This example deletes all controls from rve: TRichViewEdit as an editing operation (that can be undone and redone by the user).

In this example, all references to the methods and properties of TCustomRVFormattedData point to the methods and properties of TRichView. TCustomRVFormattedData has all these methods and properties, with the same meaning.

procedure DeleteAllControls(RVData: TCustomRVData; rve: TCustomRichViewEdit);

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  i := 0;

  while i<RVData.ItemCount do begin

    case RVData.GetItemStyle(i) of

    rvsComponent:

      begin

        RVData := RVData.Edit;

        TCustomRVFormattedData(RVData).SetSelectionBounds(i, 0, i, 1);

        rve.DeleteSelection;

        i := rve.TopLevelEditor.CurItemNo-1;

      end;

    rvsTable:

      begin

        table := TRVTableItemInfo(RVData.GetItem(i));

        for r := 0 to table.RowCount-1 do

          for c := 0 to table.ColCount-1 do

            if table.Cells[r,c]<>nil then

              DeleteAllControls(table.Cells[r,c].GetRVData, rve);

      end;

    end; // of case

    inc(i);

  end; // of while

end;

Call:

DeleteAllControls(rve.RVData, rve);


TCustomRVData.GetRVData
 TRichView Reference | TCustomRVData

TCustomRVData.GetRVData

For the given document, returns the document containing its items.

function GetRVData: TCustomRVData;

For the most of document classes, this method returns Self (RVData.GetRVData = RVData).

The only exception is table cells (TRVTableCellData). When the cell is not edited, Cell.GetRVData = Cell. But when the cell is edited, this method returns RVData of the cell inplace editor.

Using RVData.GetRVData instead of RVData you can always access the document's items.

See also

•	GetSourceRVData;

•	Edit.


TCustomRVData.GetSourceRVData
 TRichView Reference | TCustomRVData

TCustomRVData.GetSourceRVData

This is an inverse method to GetRVData.

function GetSourceRVData: TCustomRVData;

For the most of document classes, this method returns Self, i.e. RVData.GetSourceRVData = RVData.

The only exception is RVData of the cell inplace editor, it returns the source cell (TRVTableCellData) for this editor.

See also

•	GetRVData.


TCustomRVFormattedData.GetOriginEx
 TRichView Reference | TCustomRVFormattedData

TCustomRVFormattedData.GetOriginEx

Returns coordinates of the given subdocument relative to the main document.

procedure GetOriginEx(var ALeft, ATop: Integer);

Output parameters

ALeft, ATop – coordinates of the top left corner of this RVData relative to the top left corner of the main document.

Coordinates of the given item relative to the main document are calculated as a sum of values returned by RVData.GetItemCoords  and RVData.GetOriginEx.


 TRichView Reference | Classes

 TPrintableRV is used internally by TRVPrint


TRVBooleanRect
 TRichView Reference | Classes

TRVBooleanRect

This is a class containing 4 boolean properties: Left, Top, Right, Bottom

Unit RVStyle;

Syntax

TRVRect = class (TPersistent)

(Introduced in version 1.2)

This class is used for defining visible sides for paragraph, cell and table borders.

See also:

•	TRVBorder.VisibleBorders;

•	TRVTableCellData.VisibleBorders;

•	TRVTableItemInfo.VisibleBorders.


TRVDeleteUnusedStylesData
 TRichView Reference | Classes

TRVDeleteUnusedStylesData

This class allows to delete unused text, paragraph and list styles in multiple documents (to delete styles that do not present in at least one of the documents)

Unit RVItem.

Syntax

TRVDeleteUnusedStylesData = class;

(introduced in version 10)

The only method of this class you need to use is the constructor:

constructor Create(ATextStyles, AParaStyles, AListStyles: Boolean);

Its parameters specify types of unused styles you want to delete.

The examples below assume that collections of text, paragraph and list styles are not saved in RVF documents (but stored in file or in the Registry). In this case, several documents share the same collections of styles. TCustomRichView.DeleteUnusedStyles cannot be used in this case, MarkStylesInUse and DeleteMarkedStyles must be used instead.

Note: usually it's much more simple (and recommended) to use one RVStyle per one RichView and store collections of styles inside RVF documents.

Example 1

How to remove unused styles in RichView1 and RichView2, linked to the same RVStyle.

uses RVItem;

  data := TRVDeleteUnusedStylesData.Create(True, True, True);

  RichView1.MarkStylesInUse(data);

  RichView2.MarkStylesInUse(data);

  RichView1.DeleteMarkedStyles(data);

  RichView2.DeleteMarkedStyles(data);

  data.Free;

Example 2

How to remove unused styles in several documents.

uses CRVData, RVItem;

  data := TRVDeleteUnusedStylesData.Create(True, True, True);

  RichView1.LoadRVF('Doc1.rvf');

  RichView1.MarkStylesInUse(data);

  RichView1.LoadRVF('Doc2.rvf');

  RichView1.MarkStylesInUse(data);

  ...

  RichViewDoNotCheckRVFStyleRefs := True;

  RichView1.LoadRVF('Doc1.rvf');

  RichView1.DeleteMarkedStyles(data);

  RichView1.SaveRVF('Doc1.rvf', False);

  RichView1.LoadRVF('Doc2.rvf');

  RichView1.DeleteMarkedStyles(data);

  RichView1.SaveRVF('Doc2.rvf', False);

  ...

  RichViewDoNotCheckRVFStyleRefs := False;

  data.Free;


TRVIntegerList
 TRichView Reference | Classes

TRVIntegerList

List of integer values, used internally by TRichView classes.

Unit RVClasses;

type

  TRVIntegerList = class(TList)

Main properties:

Items[Index: Integer]: Integer.

Count: Integer


TRVRect
 TRichView Reference | Classes

TRVRect

This is a class similar to TRect record.

Unit RVStyle;

Syntax

TRVRect = class (TPersistent)

(Introduced in version 1.2)

This class is used for representing offsets (padding) of colored background and border of paragraphs.

The class has Left, Top, Right and Bottom properties of Integer type.


DrawControl and Others
 TRichView Reference | Global procedures and functions

DrawControl and DrawButton, DrawEdit, DrawMemo,  DrawPanel Functions

These functions create bitmap having the size of the specified control, draw image of this control into this bitmap, return this bitmap.

Unit CtrlImg.

Syntax

function DrawControl(ctrl: TControl): TBitmap;

Also

function DrawButton(ctrl: TButton): TBitmap;

function DrawEdit(ctrl: TEdit): TBitmap;

function DrawMemo(ctrl: TMemo): TBitmap;

function DrawPanel(ctrl: TPanel): TBitmap;

DrawControl has the functionality of all other functions of this group.

TRVPrint use these functions for default printing of inserted controls, see OnPrintComponent event.


GetRVESearchOptions
 TRichView Reference | Global procedures and functions

GetRVESearchOptions Function

Converts options of TFindDialog/TReplaceDialog to TRichViewEdit search options.

Unit RVMisc.

Syntax

function GetRVESearchOptions(fo: TFindOptions): TRVESearchOptions;

This function always includes rvseoMultiItem in the result.

See also

•	TRichViewEdit.SearchText.


GetRVSearchOptions
 TRichView Reference | Global procedures and functions

GetRVSearchOptions Function

Converts options of TFindDialog to TRichView search options

Unit RVMisc.

Syntax

function GetRVSearchOptions(fo: TFindOptions): TRVSearchOptions;

This function always includes rvsroMultiItem in the result.

See also

•	TRichView.SearchText.


RV_GetPrinterDC
 TRichView Reference | Global procedures and functions

RV_GetPrinterDC

Returns handle compatible with the the current printer object.

Unit PtblRV.

Syntax

function RV_GetPrinterDC: HDC;

After using this handle, delete it with DeleteDC.

Alternatively, you can use Printer.Handle.

Example

The procedure below returns size of document area on page, converted to screen pixels. Document area is paper size minus margins.

For conversion, it uses screen resolution (RichViewPixelsPerInch is ignored).

It does not take headers and footers into account.

procedure GetPageSize(RVPrint: TRVPrint; var Width, Height: Integer);

var

  DC: HDC;

  phoX, phoY, phW, phH, lpy, lpx, LM, TM, RM, BM: Integer;

begin

  DC := RV_GetPrinterDC;

  Width := GetDeviceCaps(DC, HORZRES);

  Height := GetDeviceCaps(DC, VERTRES);

  lpy := GetDeviceCaps(DC, LOGPIXELSY);

  lpx := GetDeviceCaps(DC, LOGPIXELSX);

  phoX := GetDeviceCaps(DC, PHYSICALOFFSETX);

  phoY := GetDeviceCaps(DC, PHYSICALOFFSETY);

  phW := GetDeviceCaps(DC, PHYSICALWIDTH);

  phH := GetDeviceCaps(DC, PHYSICALHEIGHT);

  LM := MulDiv(RVPrint.LeftMarginMM, 5*lpx, 127)- phoX;

  TM := MulDiv(RVPrint.TopMarginMM, 5*lpy, 127)- phoY;

  RM := MulDiv(RVPrint.RightMarginMM, 5*lpx, 127)- (phW-(phoX+Width));

  BM := MulDiv(RVPrint.BottomMarginMM, 5*lpy, 127)- (phH-(phoY+Height));

  if RVPrint.FixMarginsMode=rvfmmAutoCorrect then

  begin

    if LM<0 then

    begin

      inc(RM, LM);

      LM := 0;

    end;

    if TM<0 then

    begin

      inc(BM, TM);

      TM := 0;

    end;

    if RM<0 then

      RM := 0;

    if BM<0 then

      BM := 0;

  end;

  dec(Width, LM+RM);

  dec(Height, TM+BM);

  DeleteDC(DC);

  DC := GetDC(0);

  Width := MulDiv(Width, GetDeviceCaps(DC, LOGPIXELSX), lpx);

  Height := MulDiv(Height, GetDeviceCaps(DC, LOGPIXELSY), lpy);

  ReleaseDC(0, DC);

end;

Example of using (making document width in editor equal to page width, taking difference in resolutions into account):

var w, h: Integer;

// rvoClientTextWidth must be excluded from RichViewEdit1.Options.

GetPageSize(RVPrint1, w,h);

RichViewEdit1.MaxTextWidth := w-RichViewEdit1.LeftMargin-RichViewEdit1.RightMargin;

RichViewEdit1.MinTextWidth := RichViewEdit1.MaxTextWidth;

RichViewEdit1.Format;


RV_RegisterHTMLGraphicFormat
 TRichView Reference | Global procedures and functions

RV_RegisterHTMLGraphicFormat Procedure

Allows to define HTML graphic formats. Images of these formats are saved in HTML as they are, without conversion to Jpegs.

Unit CRVData.

Syntax

procedure RV_RegisterHTMLGraphicFormat(ClassType: TGraphicClass);

It's recommended to use this function for the following formats: GIF, PNG.

It's not necessary to call it for TJpegImage.

These formats must have file extension associated, see TPicture.RegisterFileFormat.

See also:

•	RV_RegisterPngGraphic procedure;

•	How to use third party graphic formats in TRichView.


RV_RegisterPngGraphic
 TRichView Reference | Global procedures and functions

RV_RegisterPngGraphic Procedure

Registers PNG graphic class for using in TRichView.

Unit CRVData.

procedure RV_RegisterPngGraphic(ClassType: TGraphicClass);

(introduced in version 10)

Parameter

ClassType – class representing PNG image.

Call this procedure one time when the application starts (for example, in the initialization section of the main form's unit).

If PNG class is registered with this procedure, TRichView controls can save and load PNG images in RTF files. Optionally, bitmaps can be saved as PNG too, see TCustomRichView.RTFOptions property (rvrtfPNGInsteadOfBitmap).

Delphi does not include PNG class, so use third party classes.

See also:

•	How to use third party graphic formats in TRichView

Web links:

•	Gustavo Huffenbacher Daud's TPngObject: download file, free PNG graphic class (for Delphi/C++Builder 2009, use TPngImage included in VCL).


RVGetFirstEndnote and Others
 TRichView Reference | Global procedures and functions

RVGetFirstEndnote, RVGetNextEndnote, RVGetFirstFootnote, RVGetNextFootnote Functions

These functions allow to enumerate endnotes and footnotes in document.

Unit RVNote.

function RVGetFirstEndnote(RichView: TCustomRichView): TRVEndnoteItemInfo;

function RVGetNextEndnote(RichView: TCustomRichView;

  Endnote: TRVEndnoteItemInfo): TRVEndnoteItemInfo;

function RVGetFirstFootnote(RichView: TCustomRichView): TRVFootnoteItemInfo;

function RVGetNextFootnote(RichView: TCustomRichView;

  Footnote: TRVFootnoteItemInfo): TRVFootnoteItemInfo;

(introduced in version 10)

RVGetFirstEndnote returns the first endnote in RichView (or nil, if RichView has no endnotes).

RVGetNextEndnote returns the next endnote after Endnote (or nil, if this is the last endnote).

RVGetFirstFootnote returns the first footnote in RichView (or nil, if RichView has no footnotes).

RVGetNextFootnote returns the next footnote after Footnote (or nil, if this is the last footnote).


RVGetNoteTextStyleNo
 TRichView Reference | Global procedures and functions

RVGetNoteTextStyleNo Function

Returns index of text style for endnote or footnote.

Unit RVNote.

function RVGetNoteTextStyleNo(RVStyle: TRVStyle; StyleNo: Integer): Integer;

(introduced in version 10)

This function returns text style (index in RVStyle.TextStyles) having all properties of RVStyle.TextStyles[StyleNo], but:

•	SubSuperScriptType = rvsssSuperScript;

•	Protection := [rvprDoNotAutoSwitch].

If such text style does not exist, this function adds it to the end of RVStyle.TextStyles.


RVIsURL, RVIsEmail
 TRichView Reference | Global procedures and functions

RVIsURL, RVIsEmail Functions

These function return True if the string is URL or e-mail address.

Unit RVFuncs.

function RVIsURL(const s: String): Boolean;

function RVIsEmail(const s: String): Boolean;

(introduced in version 10)

First, RVIsURL calls RVIsCustomURL. If it returns False, RVIsURL checks for the following prefixes:

•	http://

•	ftp://

•	file://

•	gopher://

•	mailto:

•	https://

•	news:

•	telnet:

•	wais:

•	'www.

•	ftp.

In TRichView, this function is used to ignore URLs in live spelling check.Besides, it is used in demo projects and in RichViewActions.

See also: how to create a chat window.


Unicode Conversion
 TRichView Reference | Global procedures and functions

Unicode Conversion

Various Unicode-related functions.

Unit RVUni.

function RVU_RawUnicodeToWideString(const s: TRVRawByteString):TRVUnicodeString;

function RVU_GetRawUnicode(const s: TRVUnicodeString):TRVRawByteString;

RVU_RawUnicodeToWideString converts "raw Unicode" string to TRVUnicodeString.

RVU_GetRawUnicode converts TRVUnicodeString to "raw Unicode" string.

type

  TRVCodePage = type cardinal; // defined in RVStyle unit

function RVU_AnsiToUnicode(CodePage: TRVCodePage; const s: TRVAnsiString): TRVRawByteString;

function RVU_UnicodeToAnsi(CodePage: TRVCodePage; const s: TRVRawByteString): TRVAnsiString;

function RVU_AnsiToUTF8(CodePage: TRVCodePage; const s: TRVAnsiString): TRVRawByteString;

RVU_AnsiToUnicode converts ANSI string (in the specified CodePage) to "raw Unicode" string.

RVU_UnicodeToAnsi converts "raw Unicode" string to ANSI string (in the specified CodePage).

RVU_AnsiToUTF8 converts ANSI string (in the specified CodePage) to UTF-8 string.

type

  TRVUnicodeTestResult = (rvutNo, rvutYes, rvutProbably, rvutEmpty, rvutError);

function RV_TestStreamUnicode(Stream: TStream): TRVUnicodeTestResult;

function RV_TestFileUnicode(const FileName: String): TRVUnicodeTestResult;

function RV_TestStringUnicode(const s: TRVRawByteString): TRVUnicodeTestResult;

These functions do very basic test of stream, file or string content to determine if they contain Unicode or ANSI text.

Possible results:

•	rvutNo – it is ANSI text;

•	rvutYes – it is (very very probably) Unicode text;

•	rvutProbably – it may be either ANSI or Unicode;

•	rvutEmpty – empty content;

•	rvutError – error (reading file or stream).

First, these function check number of bytes in content. If it is odd, this is not Unicode text (rvutNo).

Next, they check the first 2 bytes of text. If it is a Unicode byte order mark, this is very probably Unicode (rvutYes).

Next, they check if there are 0-bytes in the first 500 bytes. If yes, it is not an ANSI (rvutYes), otherwise it may be any (rvutProbably).

You can also use WinAPI function IsTextUnicode performing more advanced tests.

See also:

•	Unicode in TRichView.


Functions from RVGetText Unit
 TRichView Reference | Global procedures and functions

Functions from RVGetText and RVGetTextW Units

The units RVGetText and RVGetTextW include the identical sets of functions returning text from TRichView.

Functions from RVGetText return ANSI strings, functions from RVGetTextW return Unicode strings.

RVGetText:

function GetCurrentLineText(rve: TCustomRichViewEdit): TRVAnsiString;

function GetVisibleText(rv: TCustomRichView): TRVAnsiString;

function GetAllText(rv: TCustomRichView): TRVAnsiString;

function GetRVDataText(RVData: TCustomRVData): TRVAnsiString;

function GetCurrentParaSectionText(rve: TCustomRichViewEdit): TRVAnsiString;

function GetCurrentParaText(rve: TCustomRichViewEdit): TRVAnsiString;

function GetCurrentChar(rve: TCustomRichViewEdit): TRVAnsiString;

function GetCurrentWord(rve: TCustomRichViewEdit): TRVAnsiString;

RVGetTextW:

function GetCurrentLineText(rve: TCustomRichViewEdit): TRVUnicodeString;

function GetVisibleText(rv: TCustomRichView): TRVUnicodeString;

function GetAllText(rv: TCustomRichView): TRVUnicodeString;

function GetRVDataText(RVData: TCustomRVData): TRVUnicodeString;

function GetCurrentParaSectionText(rve: TCustomRichViewEdit): TRVUnicodeString;

function GetCurrentParaText(rve: TCustomRichViewEdit): TRVUnicodeString;

function GetCurrentChar(rve: TCustomRichViewEdit): TRVUnicodeString;

function GetCurrentWord(rve: TCustomRichViewEdit): TRVUnicodeString;

GetCurrentLineText returns the current line of text (the line containing the caret).

GetAllText returns all text in rv, GetRVDataText returns all text in RVData.

GetCurrentParaSectionText returns text of the paragraph section with the caret (paragraph section is a part of document limited either by paragraph breaks or by new line breaks (added with  Shift + Enter ).

GetCurrentParaText returns text of the paragraph with the caret.

GetCurrentChar returns character to the left of the caret. If the caret is at the beginning of line, returns the character to the right. If no character, returns empty string.

GetCurrentWord returns the word with the caret.

For non-text items, these function return their text representation.

See also:

•	RVGetTextRange


Functions from RVLinear Unit
 TRichView Reference | Global procedures and functions

Functions from RVLinear Unit

const RVCharsPerLineBreak: Integer = 1;

      RVNonTextCharacter: Char = ' ';

function RVGetLinearCaretPos(rve: TCustomRichViewEdit): Integer;

procedure RVSetLinearCaretPos(rve: TCustomRichViewEdit; LinearPos: Integer);

RVGetLinearCaretPos returns the caret position (as a number of characters before the caret; non-text objects (except for the tables and tabulators) are treated as one character, line breaks are treated as RVCharsPerLineBreak characters). RVSetLinearCaretPos moves the caret to the specified position.

procedure RVGetSelection(rv: TCustomRichView; var SelStart, SelLength: Integer);

procedure RVSetSelection(rv: TCustomRichView; SelStart, SelLength: Integer);

RVGetSelection returns the selection position in richedit-like parameters (SelStart and SelLength). RVSetSelection sets selection by these values.

type

  TRVSelection = record

    SelStart, SelLength: Integer;

    MultiCell: Boolean;

    StartRow, StartCol, RowOffs, ColOffs: Integer;

  end;

procedure RVGetSelectionEx(rv: TCustomRichView; var Selection: TRVSelection);

procedure RVSetSelectionEx(rv: TCustomRichView; const Selection: TRVSelection);

RVGetSelectionEx returns the selection position in TRVSelection record. RVSetSelectionEx sets selection by this record. These function can handle not only a normal selection, but a multicell selection in tables as well.

function RichViewToLinear(rv: TCustomRichView; CurRVData, RVData: TCustomRVData;

  ItemNo, ItemOffs: Integer; var LinearPos: Integer): Boolean;

function LinearToRichView(rv: TCustomRichView; CurRVData: TCustomRVData;

  var LinearPos: Integer; var RVData: TCustomRVData;

  var ItemNo, ItemOffs: Integer): Boolean;

RichViewToLinear converts the position specified in RichView coordinates (RVData – document, ItemNo – index of item in this document, ItemOffs – offset in this item) to linear coordinate (a number of characters from the beginning of CurRVData before this position; non-text objects (except for the tables and tabulators) are treated as one character, line breaks are treated as RVCharsPerLineBreak characters). LinearToRichView performs an opposite conversion.

function RVGetTextRange(rv: TCustomRichView; RangeStart, RangeLength: Integer): String;

function RVGetTextLength(rv: TCustomRichView): Integer;

RVGetTextRange returns text from rv, from RangeStart to RangeLength position. Non-text items (except for the tables and tabulators) are returned as RVNonTextCharacter. If RVCharsPerLineBreak=1, #13 is used as line break. If RVCharsPerLineBreak=2, #13#10 is used as line break.

The call RVGetTextRange(rv, 0, RVGetTextLength(rv)) returns the whole text.

All these functions are compatible, they calculate position identically. The text returned by RVGetTextRange has one-to-one correspondence to RichView document (unlike text returned by the functions from RVGetText unit).

 Unicode note: for Delphi/C++Builder 2009 or newer, RVGetTextRange returns Unicode text. For older versions of Delphi, it returns ANSI text.


TCheckpointData
 TRichView Reference | Types

TCheckpointData Type

Unit RVStyle;

TCheckpointData = type Pointer;

Value of this type identifies one checkpoint.

It can be obtained as a parameter of several events, or as a return value of several methods of TRichView.

All properties of checkpoint can be extracted from this value using other RichView methods.

See "Checkpoints" for details.


TRVAnsiString
 TRichView Reference | Types

TRVAnsiString Type

Unit RVTypes.

Declaration for Delphi 2009 or newer:

TRVAnsiString = type AnsiString;

Declaration for older versions of Delphi:

TRVAnsiString = type String;

Strings of this type contain ANSI text.

See also

•	TRVUnicodeString

•	TRVRawByteString


TRVBiDiMode
 TRichView Reference | Types

TRVBiDiMode Type

Unit RVStyle;

type

  TRVBiDiMode =

    (rvbdUnspecified, rvbdLeftToRight, rvbdRightToLeft);

Value of this type defines default text reading direction for document (TRichView.BiDiMode), paragraph (TParaInfo.BiDiMode), or text (TFontInfo.BiDiMode).

Value	Meaning
rvbdUnspecified	Bidirectional text is not supported (if specified for document), or text direction is inherited from higher level: • for text – from paragraph; • for paragraph – from document.
rvbdLeftToRight	Default text reading order is left-to-right.
rvbdRightToLeft	Default text reading order is right-to-left.
See also:

Bidirectional text in TRichView


TRVBorderStyle
 TRichView Reference | Types

TRVBorderStyle Type

Unit RVStyle

TRVBorderStyle = (rvbNone, rvbSingle, rvbDouble, rvbTriple,

  rvbThickInside, rvbThickOutside);

Style of border around paragraph. Type for Border.Style property.

Style	Border
rvbNone	No border
rvbSingle
rvbDouble
rvbTriple
rvbThickInside
rvbThickOutside
(examples are made with Color=clRed, Width=1, InternalWidth=1)


TRVBreakStyle
 TRichView Reference | Types

TRVBreakStyle Type

Unit RVStyle

  TRVBreakStyle =

    (rvbsLine, rvbsRectangle,

     rvbs3d, rvbsDotted, rvbsDashed);

Style of break item.

Style	Example
rvbsLine
rvbsRectangle
rvbs3d	(break color is ignored)
rvbsDotted
rvbsDashed


TRVCellVAlign
 TRichView Reference | Types

TRVCellVAlign Type

Unit RVTable;

type

  TRVCellVAlign =

    (rvcTop,  rvcMiddle, rvcBottom, rvcVDefault);

Types vertical alignment in cells.

See VAlign property of table rows and VAlign property of cells.


TRVDisplayOptions
 TRichView Reference | Types

TRVDisplayOption, TRVDisplayOptions Types

rvdoALL Global Constant

Unit RVScroll

type

  TRVDisplayOption = (rvdoImages, rvdoComponents, rvdoBullets);

  TRVDisplayOptions = set of TRVDisplayOption;

const

  rvdoALL = [rvdoImages, rvdoComponents, rvdoBullets];


TRVESearchOptions
 TRichView Reference | Types

TRVESearchOption, TRVESearchOptions Type

Unit RVEdit;

type

  TRVESearchOption = (rvseoMatchCase, rvseoDown, rvseoWholeWord, rvseoMultiItem);

  TRVESearchOptions = set of TRVESearchOption;

Options for searching in RichViewEdit, see TCustomRichViewEdit.SearchText.

Value	Meaning
rvseoMatchCase	If included, character case is taken into account when comparing string.
rvseoDown	If included, search is performed to the end of document. If not included, it is performed to the top of document.
rvseoWholeWord	If included, the searched string matches only whole words.
rvseoMultiItem	If included, the search can match substrings of several text items. If not included, the text is searched in each text item separately. For example, if the document contains the text Hello, the substring 'Hello' can be found only if this option is included, because 'He' and 'llo' belong to different items.


TRVExtraItemProperty
 TRichView Reference | Types

TRVExtraItemProperty Type

Unit RVItem;

type

 TRVExtraItemProperty =

  (rvepUnknown, rvepVShift, rvepVShiftAbs,

   rvepImageWidth, rvepImageHeight,

   rvepTransparent, rvepTransparentMode,

   rvepTransparentColor, rvepMinHeightOnPage,

   rvepSpacing, rvepResizable,

   rvepDeleteProtect, rvepNoHTMLImageSize,

   rvepAnimationInterval, rvepVisible);

Identifies item property of integer type.

Property	Applicable To	Default Value	Meaning
rvepUnknown			Not a property. For internal use.
rvepVShift	• pictures • hot-pictures • controls • bullets • hotspots	0	Vertical offset, in % of item height (default), or in pixels (see rvepVShiftAbs). Negative values move the item down, positive move it up (relative to the position specified in VAlign)
rvepVShiftAbs	• pictures • hot-pictures • controls • bullets • hotspots	0	If non-zero, rvepVShift defines vertical offset in pixels instead of %.
rvepImageWidth, rvepImageHeight	• pictures • hot-pictures	0	If set to positive value, define size of the image. The actual image is not modified, it is just drawn stretched. See also rvepAnimationInterval property below.
rvepTransparent, rvepTransparentMode, rvepTransparentColor	• pictures • hot-pictures (if they are TBitmap)		Correspond to properties of TBitmap: Transparent, TransparentMode, TransparentColor. Limitations: • transparency is turned off in 256-color mode; • transparency is not supported when printing (although print preview shows transparent bitmaps) • TBitmap implementation of transparency is not ideal; sometimes it may cause weird colors for 256-color images (probably, it was fixed in last versions of Delphi)
rvepMinHeightOnPage	• pictures • hot-pictures	0	Affects printing, allows printing large pictures on several pages. Positive value defines minimal height of part of image allowed to be on page. For example: • 1 – the image can be printed on two or more pages, it can separated between pages in any place; • 100 – if the rest of page can contain >= 100 pixels of the image, the image will be separated, otherwise it will be printed on single page; •  0 – the image/control will be printed on single page. Do not overuse this feature, it has limitations: • such images/controls are always printed from new line; • for control, OnPrintComponent must return bitmap having exactly the size of the control (if this property = 0, you can return larger bitmap and it will be stretched allowing to create a better printing output)
rvepSpacing	• pictures • hot-pictures • controls • bullets • hotspots	1	Spacing around the item. Must be a positive value. Default value is 1 (for backward compatibility; very probably, it will be changed to 0).
rvepResizable	• pictures • hot-pictures • controls	1 (for pictures and hot-pictures), 0 (for controls).	Allows resizing with mouse • 0 – no resizing; • non-zero value – resizing is allowed.
rvepDeleteProtect	all non-text items	0	• 0 – no protection; • non-zero value – item cannot be deleted in editing operations. See also: rvprDeleteProtect option of Protection for text style.
rvepNoHTMLImageSize	• pictures • hot-pictures • bullets • hotspots • list markers	0	If non-zero, image size is not saved in HTML, even if rvsoImageSizes is included in the Options parameter for SaveHTML/SaveHTMLEx This option is ignored for pictures and hot-pictures, if rvepImageWidth or rvepImageHeight properties are non-zero.
rvepAnimationInterval	• pictures • hot-pictures (if they are TBitmap)	0	Animation delay in 1/100 of second. If nonzero and rvepImageWidth and/or rvepImageHeight are defined, playing bitmap animation (in imagewidth x imageheight frame)
rvepVisible	• controls	1	Set to 0 to hide the control.
See also

•	TRVExtraItemStrProperty

See also methods of TRichView

•	SetItemExtraIntProperty,

•	GetItemExtraIntProperty.

See also methods of TRichViewEdit

•	SetItemExtraIntPropertyEd,

•	SetCurrentItemExtraIntProperty,

•	GetCurrentItemExtraIntProperty.


TRVExtraItemStrProperty
 TRichView Reference | Types

TRVExtraItemStrProperty Type

Unit RVItem;

type

  TRVExtraItemStrProperty = (

    rvespUnknown,

    rvespHint,

    rvespAlt,

    rvespImageFileName);

Identifies item property of string type.

Default value for all properties is '' (empty string).

Property	Applicable To	Meaning
rvespUnknown		Not a property. For internal use.
rvespAlt	• pictures • hot-pictures • bullets • hotspots	Text representation of image. Saved as "<img alt>" attribute in HTML files. Must not contain line breaks and double quotes.
rvespHint	all items (but not shown for controls and tables)	Popup hint can be displayed for items if rvoShowItemHints is included in RichView.Options and RichView.ShowHint=True.  Hints are displayed by assigning to RichView.Hint. See also OnItemHint event. Note: this feature adds 4 bytes in memory to each item. If you do not need it, enable RVDONOTUSEITEMHINTS compiler define in RV_Defs.inc. After enabling this define, you can still use OnItemHint. Hint string must not contain line breaks and double quotes. When exporting to HTML, it is exported as "title" attribute. For RTF, hints are exported and imported only for hyperlinks. In OnWriteHyperlink event, the proper value of Extras parameter is set by default.
rvespImageFileName	• pictures • hot-pictures • tables	Provides a place for storing image file name. For tables, it is a background image, also accessible as table.BackgroundImageFileName. See also: TRVTableCellData.BackgroundImageFileName If rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML (paths will be converted to relative paths).
See also

•	TRVExtraItemProperty

See also methods of TRichView

•	SetItemExtraStrProperty,

•	GetItemExtraStrProperty.

See also methods of TRichViewEdit

•	SetItemExtraStrPropertyEd,

•	SetCurrentItemExtraStrProperty,

•	GetCurrentItemExtraStrProperty.


TRVFontInfoProperties
 TRichView Reference | Types

TRVFontInfoProperty, TRVFontInfoProperties Types

Unit RVStyle;

type

  TRVFontInfoProperty = (

    rvfiFontName, rvfiSize, rvfiCharset, rvfiUnicode,

    rvfiBold, rvfiItalic, rvfiUnderline, rvfiStrikeout,

    rvfiOverline, rvfiAllCaps,

    rvfiVShift, rvfiColor, rvfiBackColor,

    rvfiJump, rvfiHoverBackColor, rvfiHoverColor, rvfiHoverUnderline,

    rvfiJumpCursor,

    rvfiNextStyleNo, rvfiProtection, rvfiCharScale, rvfiBaseStyleNo,

    rvfiBiDiMode, rvfiCharSpacing, rvfiHTMLCode, rvfiRTFCode,

    {$IFDEF RVLANGUAGEPROPERTY}

    rvfiLanguage,

    {$ENDIF}

    rvfiCustom);

  TRVFontInfoProperties = set of TRVFontInfoProperty;

Identifies properties of TFontInfo.

const

  RVAllFontInfoProperties: TRVFontInfoProperties =

    [Low(TRVFontInfoProperty)..High(TRVFontInfoProperty)];

Constant, lists all TFontInfo properties.


TRVFReaderStyleMode
 TRichView Reference | Types

TRVFReaderStyleMode Type

Unit RVStyle;

type

  TRVFReaderStyleMode =

  (rvf_sIgnore, rvf_sInsertMap, rvf_sInsertMerge)

Defines mode for loading collection of styles from RVF (if they are contained there, see rvfoSaveTextStyles and rvfoSaveParaStyles RVFOptions).

This is a type of the following properties of TCustomRichView:

•	RVFTextStylesReadMode (loading TextStyles);

•	RVFParaStylesReadMode (loading ParaStyles and ListStyles).

Mode	When loading RVF...	When Inserting RVF...
rvf_sIgnore	Collections of styles in RVF are ignored. For correct loading, this RVF file must be saved with the same collections of styles.
rvf_sInsertMerge	Current collection of styles will be replaced with values from RVF.	Current styles will be merged with styles from RVF (new styles will be added to the collection, if necessary).
rvf_sInsertMap	Current collection of styles will be replaced with values from RVF.	Styles from RVF will be mapped to the most similar existing styles. New styles will not be added.
You should be careful with the last two modes: it's recommended to use them only if TRVStyle component is used exclusively by the given TRichView[Edit].

Loading operations include:

•	LoadRVF,

•	LoadRVFFromStream,

•	loading from database fields.

Insertion operations include:

•	InsertRVFFromStream,

•	AppendRVFFromStream,

•	TRichViewEdit.InsertRVFFromFileEd,

•	TRichViewEdit.InsertRVFFromStreamEd,

•	pasting from the Clipboard,

•	drag&drop.


TRVHTMLLength
 TRichView Reference | Types

TRVHTMLLength Type

Unit RVTable;

type

  TRVHTMLLength = type Integer;

Represents length in percent or pixels

Range	Meaning
>0	Length in pixels
<0	Length in percent (for example, -50 means 50%)
=0	Length is undefined (default)
See also

•	TRVTableItemInfo.BestWidth

•	TRVTableCellData.BestWidth


TRVItemBackgroundStyle
 TRichView Reference | Types

TRVItemBackgroundStyle Type

Unit RVStyle;

type

  TRVItemBackgroundStyle =

    (rvbsColor, rvbsStretched, rvbsTiled, rvbsCentered);

Defines background style (position of background image).

Value	Meaning
rvbsColor	No image.
rvbsStretched	Image stretched to fill the whole area. Not all image types can be stretched.
rvbsTiled	Image is repeated to fill the whole area.
rvbsCentered	Image is located at the center.
See also:

•	TRVTableItemInfo.BackgroundStyle (background of table)

•	TRVTableCellData.BackgroundStyle (background of cell)


TRVOleDropEffects
 TRichView Reference | Types

TRVOleDropEffect, TRVOleDropEffects

Type of drag&drop operation.

type

  TRVOleDropEffect = (rvdeNone, rvdeCopy, rvdeMove, rvdeLink);

  TRVOleDropEffects = set of TRVOleDropEffect;

This type defines how drag&drop cursor looks like.

Effect	Meaning
rvdeNone	Drag&drop is not possible
rvdeCopy	The source object will be copied to the target
rvdeMove	The source object will be moved to the target
rvdeLink	Link to the source object will be inserted in the target
See events of TCustomRichViewEdit:

•	OnOleDragEnter;

•	OnOleDragOver;

•	OnOleDrop.


TRVParaInfoProperties
 TRichView Reference | Types

TRVParaInfoProperty, TRVParaInfoProperties Types

Unit RVStyle;

type

 TRVParaInfoProperty = (

    rvpiFirstIndent, rvpiLeftIndent, rvpiRightIndent,

    rvpiSpaceBefore, rvpiSpaceAfter, rvpiAlignment,

    rvpiNextParaNo, rvpiDefStyleNo, rvpiLineSpacing, rvpiLineSpacingType,

    rvpiBackground_Color,

    rvpiBackground_BO_Left, rvpiBackground_BO_Top,

    rvpiBackground_BO_Right, rvpiBackground_BO_Bottom,

    rvpiBorder_Color, rvpiBorder_Style,

    rvpiBorder_Width, rvpiBorder_InternalWidth,

    rvpiBorder_BO_Left, rvpiBorder_BO_Top,

    rvpiBorder_BO_Right, rvpiBorder_BO_Bottom,

    rvpiBorder_Vis_Left, rvpiBorder_Vis_Top,

    rvpiBorder_Vis_Right, rvpiBorder_Vis_Bottom,

    rvpiNoWrap, rvpiReadOnly, rvpiStyleProtect, rvpiDoNotWantReturns,

    rvpiKeepLinesTogether, rvpiKeepWithNext, rvpiTabs,

    rvpiBiDiMode, rvpiCustom);

  TRVParaInfoProperties = set of TRVParaInfoProperty;

Identifies properties of TParaInfo.

const

  RVAllParaInfoProperties: TRVParaInfoProperties =

    [Low(TRVParaInfoProperty)..High(TRVParaInfoProperty)];

Constant, lists all TParaInfo properties.


TRVPrintingStep
 TRichView Reference | Types

TRVPrintingStep Type

Unit PtblRV

TRVPrintingStep = (rvpsStarting, rvpsProceeding, rvpsFinished);

Parameter of this type is used in OnSendingToPrinter and OnFormatting events.


TRVRawByteString
 TRichView Reference | Types

TRVRawByteString Type

Unit RVTypes.

Declaration for Delphi 2009 or newer:

TRVRawByteString = type RawByteString;

Declaration for older versions of Delphi:

TRVRawByteString = type String;

String of this type may contain arbitrary data, not necessary an ANSI text.

Usually, this type is used for strings containing item text. In this case, it contains "raw Unicode" for text items associated with Unicode text style, and ANSI string otherwise.

See also

•	TRVAnsiString

•	TRVUnicodeString


TRVReaderStyleMode
 TRichView Reference | Types

TRVReaderStyleMode Type

Unit RVStyle;

type

  TRVReaderStyleMode =

    (rvrsUseSpecified, rvrsUseClosest, rvrsAddIfNeeded);

Defines modes for loading formatting from RTF.

Mode	Meaning
rvrsUseSpecified	All character/paragraph formatting in RTF will be ignored, all text/paragraphs will be formatted with the specified style.
rvrsUseClosest	RTF formatting will be mapped to the the most similar existing style. New styles will not be added.
rvrsAddIfNeeded	This mode provides the most closer look to the original RTF. RichView will try to use existing styles as much as possible, but if style with the desired formatting does not exist, RichView will create and use a new style.
See TRichView.RTFReadProperties.TextStyleMode and ParaStyleMode.


TRVSaveFormat
 TRichView Reference | Types

TRVSaveFormat Type

Unit RVStyle;

type

  TRVSaveFormat =

  (rvsfText, rvsfHTML, rvsfRTF, rvsfRVF);

Identifies saving format.

This type is used in some events of RichView, such as OnSaveComponentToFile and OnSaveItemToFile, and SavePicture method.


TRVSaveOptions
 TRichView Reference | Types

TRVSaveOption, TRVSaveOptions Types

Unit RVStyle;

type

  TRVSaveOption = (rvsoOverrideImages,

    rvsoFirstOnly, rvsoMiddleOnly, rvsoLastOnly,

    rvsoDefault0Style, rvsoNoHypertextImageBorders,

    rvsoImageSizes, rvsoForceNonTextCSS, rvsoUseCheckpointsNames,

    rvsoMarkersAsText, rvsoNoDefCSSStyle, rvsoInlineCSS,

    rvsoUseItemImageFileNames,

    rvsoXHTML, rvsoUTF8);

  TRVSaveOptions = set of TRVSaveOption;

Options for HTML export. Used for parameter of SaveHTML, SaveHTMLEx, SaveHTMLToStream, SaveHTMLToStreamEx.

Options for saving images, both for SaveHTML, SaveHTMLEx

Option	Meaning
rvsoOverrideImages	If set, RichView can override existing images. If not set, RichView will generate unique names for images.
rvsoNoHypertextImageBorders	By default, browsers add borders around hypertext images. This option suppresses borders for hotspots and hot-pictures.
rvsoImageSizes	If set, RichView saves widths and heights of images in HTML explicitly. This option provides more smooth (and sometimes faster) loading by browsers. This option does not affect pictures having defined rvepImageWidth and/or rvepImageHeight item extra integer properties. Sizes are always saved for such images. You can override this setting for the specific item using rveoNoHTMLImagesSize item extra integer properties .
rvsoUseItemImageFileNames	If included, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML. If this option is included, OnHTMLSaveImage and  OnSaveImage2 events have initial value of the Location parameter equal to the image file name. File names for items are defined via rvespImageFileName string property.
Options for saving list markers, both for SaveHTML, SaveHTMLEx

Option	Meaning
rvsoMarkersAsText	If included, paragraph lists are saved as normal text or images. Usually, HTML files saved with this option look closer to the original document. If not included, lists are saved as <ul> and <ol> HTML tags.
If rvsoMarkersAsText is not included

Export using CSS (SaveHTMLEx); CSS of lists are inserted directly in HTML:

•	rvlstBullet, rvlstUnicodeBullet – exported as bullets with default markers (disc, circle or square). FormatString and Font are ignored;

•	rvlstDecimal,rvlstLowerAlpha,rvlstUpperAlpha,rvlstLowerRoman,rvlstUpperRoman – exported as lists with the proper numbering. FormatString and Font are ignored;

•	rvlstPicture,rvlstImageList,rvlstImageListCounter – exported as a bullet with picture. It's possible to change default image saving by OnHTMLSaveImage;

•	indents are saved, but not very accurately.

Export without CSS (SaveHTML):

•	rvlstBullet, rvlstUnicodeBullet,rvlstPicture,rvlstImageList – exported as bullets with default markers (disc, circle or square). FormatString, Picture, ImageList and Font are ignored;

•	rvlstDecimal,rvlstLowerAlpha,rvlstUpperAlpha,rvlstLowerRoman,rvlstUpperRoman – exported as lists with the proper numbering. FormatString and Font are ignored;

•	rvlstImageListCounter – saved as a decimal numbering;

•	indents are not saved.

If rvsoMarkersAsText is included

Markers are saved without special HTML keywords for lists (like <ol>, <ul>, <li>).

Font and format strings settings are respected.

Saving without CSS (SaveHTML): all indents are ignored.

Saving with CSS (SaveHTMLEx): LeftIndent and MarkerIndent are retained. FirstIndent are retained for non-hanging markers only (MarkerIndent>=LeftIndent)..

Generally, HTML files saved with this option look closer to the original.

Other options, both for SaveHTML, SaveHTMLEx

Option	Meaning
rvsoUseCheckpointsNames	Checkpoints' names are used instead of checkpoint indices. Recommended.
rvsoXHTML	If included, XHTML is saved instead of HTML
rvsoUTF8	If included, Unicode (UTF-8) HTML file is saved. Highly recommended for multilingual documents.
rvsoDefault0Style	If set, no formatting will be saved for text of the 0-th style (TextStyles[0]). Browsers will use a default font for it. This option affects the appearance of all styles, because only attributes different from attributes of the 0th style are saved.
Options for SaveHTML

Option	Meaning
rvsoForceNonTextCSS	CSS is used for exporting non-text items. This option allows to retain colors of breaks and layout of tables saved with SaveHTML (without using CSS for text and paragraph styles). Note: SaveHTMLEx always uses CSS in this case.
Options for SaveHTMLEx

Option	Meaning
rvsoNoDefCSSStyle	By default, SaveHTMLEx assigns attributes of TextStyles[0] to <body> and <table>, and attributes of all other styles are saved relative to attributes of TextStyles[0]. If you include this option, TextStyles[0] will be treated like any other style. The same for ParaStyles[0]. It's not recommended to use this option: it generates much larger CSS and HTML. This option is useful if HTML generated by TRichView is used as a part of larger HTML, and you do not want to change properties of <body> and <table>.
rvsoInlineCSS	If included, CSS is inserted directly in <p>, <span> and <li> tags (instead of generating CSS table at the beginning of HTML). This option generates highly overbloated HTML. Not recommended.
Options for saving only part of document, both for SaveHTML, SaveHTMLEx

These options are useful when generating HTML documents what will be inserted in larger HTML document.

Option	Meaning
rvsoFirstOnly	If set, RichView saves only opening part of HTML (opens <html> tag, saves full <head> tag, opens <body> tag)
rvsoMiddleOnly	If set, RichView saves only body of HTML document (content inside <body> tag)
rvsoLastOnly	If set, RichView saves closing part of HTML document (closes <body> and <html> tags)
If none of these three options specified, full HTML document is saved.

You cannot set two or all of these flags at the same time (nothing will be saved in such case).


TRVSearchOptions
 TRichView Reference | Types

TRVSearchOption, TRVSearchOptions Types

Unit RVScroll.

type

  TRVSearchOption = (rvsroMatchCase, rvsroDown, rvsroWholeWord, rvsroFromStart, rvsroMultiItem);

  TRVSearchOptions = set of TRVSearchOption;

Options for searching in RichView, see TCustomRichView.SearchText.

Value	Meaning
rvsroMatchCase	If included, a character case is taken into account when comparing strings.
rvsroDown	If included, the search is performed to the end of the document. If not included, it is performed to the top of the document.
rvsroWholeWord	If included, the searched string matches only whole words.
rvsroFromStart	If included, the search starts from the beginning/end of the document. If not included, it starts from the selection or the first/last visible item.
rvsroMultiItem	If included, the search can match substrings of several text items. If not included, the text is searched in each text item separately. For example, if the document contains the text Hello, the substring 'Hello' can be found only if this option is included, because 'He' and 'llo' belong to different items.


TRVSeqType
 TRichView Reference | Types

TRVSeqType Type

Unit RVStyle.

type

  TRVSeqType = (rvseqDecimal, rvseqLowerAlpha,

    rvseqUpperAlpha, rvseqLowerRoman, rvseqUpperRoman);

Numbering type for sequences, endnotes and footnotes.

Type	Meaning
rvseqDecimal	1, 2, 3,...
rvseqLowerAlpha	a, b, c, ..., z, aa, ab, ...
rvseqUpperAlpha	A, B, C, ..., Z, AA, AB, ...
rvseqLowerRoman	i, ii, iii, iv, ...
rvseqUpperRoman	I, II, III, IV, ...
This is a type of the following properties:

•	TRVStyle.EndnoteNumbering;

•	TRVStyle.FootnoteNumbering;

•	TRVSeqItemInfo.NumberType.


TRVTableBorderStyle
 TRichView Reference | Types

TRVTableBorderStyle Type

Unit RVTable;

type

  TRVTableBorderStyle =

    (rvtbRaised, rvtbLowered, rvtbColor,

     rvtbRaisedColor, rvtbLoweredColor);

Defines style of border in table. This is a type of BorderStyle and CellBorderStyle properties of table.

Value	Meaning
rvtbRaised	Raised 3d border, with default colors.
rvtbLowered	Sunken 3d border, with default colors.
rvtbColor	Flat border of BorderColor/CellBorderColor color.
rvtbRaisedColor	Raised 3d border: • left and top sides: BorderLightColor/CellBorderLightColor; • bottom and right sides: BorderColor/CellBorderColor).
rvtbLoweredColor	Sunken 3d border: • left and top sides: BorderColor/CellBorderColor); • bottom and right sides: BorderLightColor/CellBorderLightColor).
See also

•	Colors and layout of tables


TRVTextDrawStates
 TRichView Reference | Types

TRVTextDrawState, TRVTextDrawStates Types

Unit RVStyle;

type

  TRVTextDrawState = (rvtsSelected, rvtsHover,

    rvtsItemStart, rvtsItemEnd,

    rvtsDrawItemStart, rvtsDrawItemEnd,

    rvtsControlFocused, rvtsSpecialCharacters);

  TRVTextDrawStates = set of TRVTextDrawState;

States of text, used for drawing.

See TRVStyle.OnDrawStyleText, OnDrawTextBack

State	Meaning
rvtsSelected	text is selected (for copying to the Clipboard)
rvtsHover	[hyper]text is below a mouse pointer
rvtsItemStart	this call of event draws text item from the beginning
rvtsItemEnd	this call of event finishes drawing of text item
rvtsDrawItemStart	this call of event draws part of text item from the beginning
rvtsDrawItemEnd	this call of event finishes drawing of part of text item.
rvtsControlFocused	TRichView has input focus
rvtsSpecialCharacters	rvoShowSpecialCharacters is included in TRichView.Options.
For example

(there are two items: 'This is an example.' and 'Selected',

and three "drawing items": 'This is an', 'example.' and 'Selected'

Calls of TRVStyle.OnDrawStyleText will be:

'This is an' with [rvtsItemStart,rvtsDrawItemStart,rvtsDrawItemEnd]

'example.' with [rvtsItemEnd, rvtsDrawItemStart, rvtsDrawItemEnd]

'Selected' with [rvtsItemStart, rvtsItemEnd, rvtsDrawItemStart, rvtsDrawItemEnd]

'lect' with [rvtsSelected]

Note 1: custom drawing of selected text is not supported for bidirected text

Note 2: this order of drawing (selected text over non-selected) is since version 1.6


TRVUndoType
 TRichView Reference | Types

TRVUndoType Type

Unit RVEdit

type

  TRVUndoType =

      (rvutNone, rvutDelete, rvutInsert,

       rvutPara, rvutMiscTyping, rvutInsertPageBreak,

       rvutRemovePageBreak, rvutTyping,

       rvutTag, rvutStyleNo, rvutAddCheckpoint,

       rvutRemoveCheckpoint, rvutModifyCheckpoint,

       rvutModifyItem, rvutCustom);

Types of standard undo actions (except for rvutNone and rvutCustom). Useful if you wish to show (in menu or hint) which action is to be undone.

There are no hard-coded names for actions, because they are application specific. For example, rvutTag (changing item's tag) can have special meaning for application (editing hyperlink, or another item property).

The demo Demos\Delphi\Editors\Editor 1\ has suggested names of actions in RVUndoStr.pas.

There are two special undo types:

Type	Meaning
rvutNone	No undo/redo available (disable undo or redo menu item or button)
rvutCustom	Undo action has a special name (see BeginUndoCustomGroup).


TRVUnicodeString
 TRichView Reference | Types

TRVUnicodeString Type

Unit RVTypes.

Declaration for Delphi 2009 or newer:

TRVUnicodeString = type UnicodeString;

Declaration for older versions of Delphi:

TRVUnicodeString = type WideString;

Strings of this type contain Unicode text (UTF-16).

See also

•	TRVAnsiString

•	TRVRawByteString


TRVVAlign
 TRichView Reference | Types

TRVVAlign Type

Unit RVStyle;

  TRVVAlign = (

    rvvaBaseline,  // bottom of picture -> baseline

    rvvaMiddle,    // center of picture -> baseline

    rvvaAbsTop,    // top of picture    -> top of line

    rvvaAbsBottom, // bottom of picture -> bottom of line

    rvvaAbsMiddle, // center of picture -> center of line

    rvvaLeft,      // align to left side

    rvvaRight      // align to right side

    );

Vertical align of pictures and controls in RichView

Align	Scheme
rvvaBaseline
rvvaMiddle
rvvaAbsTop
rvvaAbsBottom
rvvaAbsMiddle
rvvaLeft
rvvaRight
Note: non-standard values of HTML align attributes (abstop, absbottom, absmiddle) are used for export of rvvaAbs*** values. Microsoft Internet Explorer and Mozilla understand them, but not Opera.

This property can be applied to:

•	pictures and hot-pictures

•	bullets and hotspots

•	controls

•	label items

•	numbered sequences

See also methods of TCustomRichView:

•	GetItemVAlign,

•	SetItemVAlign.

See also properties of TCustomRichView:

•	ClearLeft,

•	ClearRight.

See also methods of TCustomRichViewEdit:

•	GetCurrentItemVAlign,

•	SetItemVAlignEd,

•	SetCurrentItemVAlign,

•	ClearTextFlow.

See also properties of TRVStyle:

•	FloatingLineColor


Global Constants and Variables
 TRichView Reference | Global constants and variables

List of Global Constants and Variables

Global Variables and Typed Constants

Editing, Caret

•	RichViewEditCaretWidth: Integer;

•	RichViewEditCaretHeightExtra: Integer;

•	RichViewEditMaxCaretHeight: Integer.

Editing, Other

•	RichViewEditDefaultProportionalResize: Boolean;

•	RichViewEditEnterAllowsEmptyMarkeredLines: Boolean;

•	RichViewUnicodeInput: TRichViewUnicodeInput;

•	RichViewTableAutoAddRow: Boolean.

Saving and Loading

•	RichViewSavePInHTML: Boolean;

•	RichViewSaveDivInHTMLEx: Boolean;

•	RichViewSavePageBreaksInText: Boolean;

•	RichViewDoNotCheckRVFStyleRefs: Boolean;

•	RichViewResetStandardFlag: Boolean;

•	RichViewPixelsPerInch: Integer.

Tables

•	RichViewTableAutoAddRow: Boolean;

•	RichViewTableGridStyle2: TPenStyle;

•	RichViewTableGridStyle: TPenStyle;

•	RichViewTableGridColor: TColor;

•	RichViewAllowCopyTableCells: Boolean.

Formatting and Displaying

•	RichViewSafeFormatting:Boolean;

•	RichViewShowGhostSpaces: Boolean;

•	RVVisibleSpecialCharacters: TRVSpecialCharacters.

•	RichViewWrapAnywhere: Boolean;

Printing

•	RichViewPixelsPerInch: Integer;

•	RichViewAlternativePicPrint: Boolean.

Live spelling check

•	RichViewApostropheInWord: Boolean.

Other

•	RichViewCompareStyleNames: Boolean.

Global Functional Variables

•	RVIsCustomURL: TCustomRVIsURLFunction;

•	RV_AfterImportGraphic: TRV_AfterImportGraphicsProc.

Constants

•	rvs*** constants;

•	Constants and variables related to Clipboard.


Constants Related to the Caret
 TRichView Reference | Global constants and variables

RichViewEditCaretWidth, RichViewEditCaretHeightExtra, RichViewEditMaxCaretHeight Typed Constants

These typed constants allow to control the caret appearance in RichViewEdit.

Unit  RVERVData.

Syntax

const RichViewEditCaretWidth: Integer = 1;

      RichViewEditCaretHeightExtra: Integer = 0;

      RichViewEditMaxCaretHeight: Integer = 1000;

RichViewEditCaretWidth – width of the caret.

Value of RichViewEditCaretHeightExtra is added to the top and the bottom of the caret (negative values make the caret shorter, positive values make it longer).

RichViewEditMaxCaretHeight – maximal possible caret height.


RichViewEditDefaultProportionalResize
 TRichView Reference | Global constants and variables

RichViewEditDefaultProportionalResize Typed Constant

Unit  RVERVData.

Syntax

const

  RichViewEditDefaultProportionalResize: Boolean = True;

By default, dragging corner handles resizes picture proportionally (like in MS Word).

Set to False to enable free resizing using the corner handles (use  Shift  key to resize proportionally in this mode)


RichViewEditEnterAllowsEmptyMarkeredLines
 TRichView Reference | Global constants and variables

RichViewEditEnterAllowsEmptyMarkeredLines Typed Constant

Unit  RVERVData.

Syntax

const

  RichViewEditEnterAllowsEmptyMarkeredLines: Boolean = False;

Set to True if you do not want to autoremove bullets & numbering from blank lines when the user presses  Enter .


RichViewUnicodeInput
 TRichView Reference | Global constants and variables

RichViewUnicodeInput Typed Constant

TRichViewUnicodeInput Type

Unit RVEdit.

Syntax

type

  TRichViewUnicodeInput = (rvuiStandard, rvuiAlternative);

const RichViewUnicodeInput: TRichViewUnicodeInput = rvuiStandard;

This constant is ignored for Delphi/C++Builder 2009 or newer (they provide true Unicode text input).

RichViewEdit uses two methods to process typing of unicode text:

•	"Standard" method processes WM_CHAR and converts typed characters to Unicode.

•	"Alternative" method uses ToUnicode procedure. It cannot process "dead keys" correctly, so it should not be used for keyboard layouts having "dead keys".

If RichViewUnicodeInput=rvuiStandard, the "alternative" method is used only for the following languages:

•	languages without their own code page (so it's impossible to use WM_CHAR);

•	Kazakh, Tatar, Mongolian, Azerbaijani (cyrillic&latin), Uzbek, Kyrgyz, Serbian (these languages include some characters that do not belong to code page).

Generally, it works very well. But for some "exotic" keyboard layouts the "standard" method does not provide completely correct input. Set this variable to rvuiAlternative to always use the "alternative" method. Do it only as an option, if you have troubles with the specific keyboard layout.


RichViewPixelsPerInch
RichViewPixelsPerInch Typed Constant

Number of pixels in one screen inch.

Unit RVFuncs.

Syntax

const

  RichViewPixelsPerInch : Integer = 0;

If 0 (default), RichView uses the screen resolution (Screen.PixelsPerInch).

If non zero, this value is used.

This value is used when converting pixels on the screen to mm, inches, twips, pixels on the printer, and vice versa.

The most important applications are:

•	printing;

•	RTF export&import.

This constant does not affect text (TRVStyle.TextStyles.PixelsPerInch property is used for text, it has the same meaning). This constant affects pictures and tables.

The main possible values: 96 (small font mode), 120 (large font mode).

Assigning positive value this constant makes printing and RTF export independent of the screen resolution (small font/large fonts mode).


RichViewTableAutoAddRow
 TRichView Reference | Global constants and variables

RichViewTableAutoAddRow

Unit RVTable.

Syntax

const

  RichViewTableAutoAddRow: Boolean = True;

(introduced in version 10)

Set to False to disable auto insertion of new table row when user presses  Tab  key in the last table cell.

The row auto insertion works only in TRichViewEdit and TDBRichViewEdit.


Constants Related to Table Grid
 TRichView Reference | Global constants and variables

RichViewTableGridStyle, RichViewTableGridStyle2, RichViewTableGridColor Typed Constants

Typed constants defining grid for all tables.

Unit RVTable.

Syntax

const

  RichViewTableGridStyle:  TPenStyle = psDot;

  RichViewTableGridStyle2: TPenStyle = psClear;

  RichViewTableGridColor:  TColor = clBtnFace

RichViewTableGridStyle – pen style for drawing invisible borders of tables in editing mode. You can hide grid in all tables assigning psClear to this variable.

RichViewTableGridStyle2 – pen style for drawing invisible borders of tables in TRichView or in TRichViewEdit in read-only mode.

RichViewTableGridColor – pen color for drawing invisible borders of tables.

Table borders can be invisible in the following cases:

•	their width is 0 (see BorderWidth and CellBorderWidth properties);

•	some sides are hidden (see VisibleBorders and Cell.VisibleBorders properties).

You can hide/show table grid for the specific table, see rvtoHideGridLines in Options property.


RichViewAllowCopyTableCells
 TRichView Reference | Global constants and variables

RichViewAllowCopyTableCells Typed Constant

Unit CRVData.

Syntax

const

  RichViewAllowCopyTableCells: Boolean = True;

Set to False to disallow copying multicell selection (it will be copied as empty RVF).


Constants Related to HTML and Text
 TRichView Reference | Global constants and variables

RichViewSavePInHTML, RichViewSaveDivInHTMLEx, RichViewSavePageBreaksInText Typed Constants

Unit CRVData.

Syntax

const

  RichViewSavePInHTML: Boolean = False;

  RichViewSaveDivInHTMLEx: Boolean = False;

  RichViewSavePageBreaksInText: Boolean = False;

Set RichViewSavePInHTML to True is you want SaveHTML to write <p> instead of <div> in HTML. This variable does not affect SaveHTMLEx. This setting changes appearance of resulting HTML documents (usually browsers add additional spacing between <p>).

Set RichViewSaveDivInHTMLEx to True is you want SaveHTMLEx to write <div> instead of <p> in HTML. This variable does not affect SaveHTML. This setting does not change appearance of resulting HTML documents (because all <p> or <div> visual attributes are defined in CSS).

Set RichViewSavePageBreaksInText to True if you want to save explicit page breaks as #$0C characters. This typed constant affects all plain text export methods.


RichViewResetStandardFlag
 TRichView Reference | Global constants and variables

RichViewResetStandardFlag Typed Constant

Unit RVStyle.

Syntax

const

  RichViewResetStandardFlag: Boolean = True;

If True, Standard properties of styles which were added from inserted RVF will be reset to False (it only affects RVF insertion, not loading).

If this flag is True, new styles having Standard=True may appear only after calling LoadRVF or LoadRVFFromStream.


RichViewSafeFormatting
 TRichView Reference | Global constants and variables

RichViewSafeFormatting Typed Constant

Unit CRVFData.

Syntax

const

  RichViewSafeFormatting:Boolean = False;

Set to True to change formatting method. In some very rare cases the standard formatting method causes line breaks in unexpected places, because certain WinAPI function returns weird results.


RichViewShowGhostSpaces
 TRichView Reference | Global constants and variables

RichViewShowGhostSpaces Typed Constant

Unit CRVFData.

Syntax

const

  RichViewShowGhostSpaces: Boolean = False;

(introduced in version 10)

Set to True if you want to show space characters at the end of lines when rvoShowSpecialCharacters is included in TCustomRichView.Options. Caret cannot be placed after these spaces.


RichViewWrapAnywhere

Unit CRVFData.

Syntax

const

  RichViewWrapAnywhere: Boolean = False;

(introduced in version 10)

If you set it to True, text in all TRichView controls can be wrapped in any place, for example inside words. Can be used to simulate LED displays.


RVVisibleSpecialCharacters
 TRichView Reference | Global constants and variables

RVVisibleSpecialCharacters Typed Constant

Unit RVStyle.

Syntax

type

  TRVSpecialCharacter = (rvscSpace, rvscNBSP, rvscParagraph, rvscSoftHyphen, rvcFloatingLines);

  TRVSpecialCharacters = set of TRVSpecialCharacter;

const

  RVVisibleSpecialCharacters: TRVSpecialCharacters = [rvscSpace..rvcFloatingLines];

(introduced in version 10)

Lists characters which will be shown when rvoShowSpecialCharacters is included in TCustomRichView.Options.

Value	Meaning
rvscSpace	If included, space characters are shown (as middle dots). Hidden spaces at the ends of lines are not shown, see RichViewShowGhostSpaces
rvscNBSP	If included, non breaking space characters are shown (as circles)
rvscParagraph	If included, end-of-paragraph and end-of-line marks are shown (as pilcrows and arrows, respectively)
rvscSoftHyphen	If included, soft hyphen characters are shown in Unicode text.
rvscParagraphAttrs	If included together with rvscParagraph, additional icons are drawn next  to end-of-paragraph marks: • triangle-arrow showing paragraph direction (if defined); • rectangle if any non-default printing option is defined (never displayed for headings 1...9) • heading level (1...9)
rvcFloatingLines	If included, floating lines are displayed for left-and right-aligned items, see TRVStyle.FloatingLineColor
See also:

•	TRVStyle.SpecialCharactersColor


RichViewApostropheInWord
 TRichView Reference | Global constants and variables

RichViewApostropheInWord

Unit RVThread;

Syntax

var

  RichViewApostropheInWord: Boolean = True;

Specifies how apostrophe characters ('''' and #146) are processed in live spelling.

If True: apostrophes are allowed in middle of words, even if they are included in Delimiters property. For example, "doesn't" is processed as one word instead of "doesn" and "t".

If False: apostrophes are processed like all other delimiters. For example, when checking French text with Addict3, it is recommended to include '''' in Delimiters and assign RichViewApostropheInWord=False.

Note: apostrophe is not included in Delimiters by default.


RichViewCompareStyleNames
 TRichView Reference | Global constants and variables

RichViewCompareStyleNames

Unit RVStyle.

Syntax

const

  RichViewCompareStyleNames: Boolean = False;

If set to True, methods for searching and comparing styles take StyleName property into account.


RichViewAlternativePicPrint
 TRichView Reference | Global constants and variables

RichViewAlternativePicPrint Typed Constant

Unit RVFuncs.

Syntax

const

  RichViewAlternativePicPrint: Boolean = False;

If set to True, alternative picture printing procedure is used. The alternative procedure is less reliable, but does not depend on the screen color resolution. It may be useful if your application work on server in 16 or 256 color mode.


RichViewDoNotCheckRVFStyleRefs
 TRichView Reference | Global constants and variables

RichViewDoNotCheckRVFStyleRefs Typed Constant

Unit CRVData.

Syntax

const

  RichViewDoNotCheckRVFStyleRefs: Boolean = False;

(introduced in version 10)

If set to True, TRichView ignore invalid style references when loading RVF documents.

It is useful only if you do not store collections of styles in documents and want to delete unused styles in multiple documents, see TRVDeleteUnusedStylesData.


rvsXXX constants
 TRichView Reference | Global constants and variables

rvs*** Constants

There are three groups of rvs*** constants:

•	identifiers of types of RichView items;

•	indices in the collection of text styles (RVStyle.TextStyles) corresponding to the initial entries;

•	values used by TRichView internally when saving and loading RVF files (see RVF specification).

Identifiers of Item Types

Use the first group of constants to compare with values returned by RichView.GetItemStyle or TRichViewEdit.CurItemStyle.

Constant	Value	Item Type	Unit
rvsBreak	-1	break (horizontal line)	RVStyle
rvsPicture	-3	picture	RVStyle
rvsHotspot	-4	hotspot (picture from ImageList - hyperlink)	RVStyle
rvsComponent	-5	inserted Delphi control	RVStyle
rvsBullet	-6	bullet (picture from ImageList)	RVStyle
rvsHotPicture	-10	hot picture (picture - hyperlink)	RVStyle
rvsListMarker	-11	list marker (bullet or numbering of paragraphs)	RVStyle
rvsTab	-12	tabulator	RVStyle
rvsTable	-60	table	RVTable
rvsLabel	-200	label (non-text item looking like text)	RVLabelItem
rvsSequence	-202	numbered sequence	RVSeqItem
rvsFootnote	-203	footnote	RVNote
rvsEndnote	-204	endnote	RVNote
rvsNoteReference	-205	reference to the parent footnote or endnote	RVNote
All these constants are negative so you can distinguish them from indices in the collection of text styles.

See also: RichView item types.

Indices in The Collection of Text Styles

The second group of constants is almost obsolete, because the status of these text styles is changed from "standard" (in older versions) to "initial". You can completely customize collections of text styles by removing initial items and adding new items.

All these constants are defined in RVStyle unit.

Constant	Value	Suggested Using
rvsNormal	0	Normal text
rvsHeading	1	Heading 1
rvsSubheading	2	Heading 2
rvsKeyword	3	Keywords
rvsJump1	4	Hypertext 1
rvsJump2	5	Hypertext 2
It's still highly recommended to use the 0-th style as the default (normal) text. For example, this style is used as a default style in exported HTML files.

There is a special constant rvsDefStyle.

Constant	Value	Meaning
rvsDefStyle	MaxInt	"Use default text style"
This constant can be used as a StyleNo parameter for methods that add text in TRichView.

When this value is specified instead of the index in the collection of text styles, the paragraph's default text style will be used.

This is a "pilot" feature. Very probably, in future links between text and paragraph styles will be implemented differently.


Clipboard Related Constants and Variables
 TRichView Reference | Global constants and variables

Clipboard Related Constants

Unit RVStr.

Clipboard Format Names

Names of the Clipboard formats for copying RVF, RTF, URL, HTML.

Syntax

const

  RVFormatName = 'RichView Format';

  RTFormatName = 'Rich Text Format';

  URLFormatName = 'UniformResourceLocator';

  HTMLFormatName = 'HTML Format';

Clipboard Format Identifiers

var CFRV_RVF, CFRV_RTF, CFRV_HTML, CFRV_URL: Word;

  ...

  CFRV_RVF := RegisterClipboardFormat(RVFormatName);

  CFRV_RTF := RegisterClipboardFormat(RTFormatName);

  CFRV_URL := RegisterClipboardFormat(URLFormatName);

  CFRV_HTML := RegisterClipboardFormat(HTMLFormatName);


RVIsCustomURL
 TRichView Reference | Global constants and variables

RVIsCustomURL

Unit RVFuncs.

Syntax

type

  TCustomRVIsURLFunction = function (const Word: String): Boolean;

const

  RVIsCustomURL: TCustomRVIsURLFunction = nil;

You can assign your function to this variable. This function must return True if Word parameter contains URL. For example, you can create function returning True if Word is started from 'icq:'. It's not necessary to detect standard URL types here, detect only your own types of URLs.

This procedure is called by RVIsURL function.

See demos:

•	Demos\Delphi\Assorted\Hypertext\URLs\

•	Demos\CBuilder\Assorted\Hypertext\URLs\


RV_AfterImportGraphic
 TRichView Reference | Global constants and variables

RV_AfterImportGraphic

Unit RVFuncs.

Syntax

type

  TRV_AfterImportGraphicsProc = procedure(Graphic: TGraphic);

var

  RV_AfterImportGraphic: TRV_AfterImportGraphicsProc;

This procedure is called for all pictures imported with RTF. By default, it is assigned to procedure that does nothing.


How To...
 TRichView Reference | How to...

How To...

How to...

(printing)

•	Change page size and orientation for printing RichView

•	Draw page numbers, headers and footers

(editing)

•	Implement commands like "make bold", "apply font", etc.

•	Implement Find and Replace dialogs

•	Switch insert/overtype mode

•	Move the caret to the beginning or to the end of document in editor

•	Make Unicode editor

•	Make a plain text editor

•	Implement smart indents

(miscellaneous)

•	Use third-party graphic classes with RichView

•	Combine several documents in one

•	Remove all formatting


change page size and orientation
 TRichView Reference | How to...

...change page size and orientation for printing RichView

TRVPrint uses global printer settings of application.

These settings can be modified by standard Delphi/C++Builder components: TPrintDialog, TPrinterSetupDialog (located on Dialogs page of the Component Palette).

You can change them from code using the global Printer object (unit Printers). For example, you can choose printer using Printer.PrinterIndex, or change page orientation using Printer.Orientation.

Changes will be in effect after calling TRVPrint.FormatPages method.


draw page numbers, headers and footers
 TRichView Reference | How to...

...draw page numbers, headers and footers

Complex headers and footers, the same for all pages

The component supports complex headers and footers, they can be multiline, contain images, tables, etc.

They must be assigned to TRVPrint component by the methods SetHeader and SetFooter.

See the example:

•	Demos\Delphi\Assorted\Printing\Headers\

•	Demos\CBuilder\Assorted\Printing\Printing\

There is a limitation of this method: the same header and footer for all pages, with no dynamic fields (like page number).

Drawing headers and footers yourself

If you need different headers for different pages, you need to draw them yourself, using OnPagePrepaint event.

This demo shows how to draw a simple text as a header:

•	Demos\Delphi\Assorted\Printing\Printing\

•	Demos\CBuilder\Assorted\Printing\Printing\

Since you draw this text yourself, you can draw as many lines as you want.

RichViewActions process this event themselves and draw one plain text line. They understand several codes like page number and pages count.

Drawing complex headers and footers using TRVReportHelper

If you need to draw more complex headers (different for different pages), you can use TRVReportHelper component for this:

http://www.trichview.com/support/files/printheader.zip (for Delphi)

This demo uses TRVReportHelper to draw header in TRVPrint.OnPagePrepaint event.

This demo draws the same header for all pages, but can be easily changed to draw different ones.

It is is shown in this demo:

http://www.trichview.com/support/files/cppheader.zip (for C++Builder).

The next demo uses TRVReportHelper for drawing both header/footer and the main document:

http://www.trichview.com/support/files/a4.zip (for Delphi)

It draws the result on the metafile, but can be easily changed to draw on the printer canvas.

The most complex case:

•	headers are complex documents;

•	headers have different heights on different pages.

http://www.trichview.com/support/files/printheaderex.zip (for Delphi)

Online updates

New information on this topic will be posted here: http://www.trichview.com/forums/viewtopic.php?t=327


implement commands like "make bold", "apply font", etc.
 TRichView Reference | How to...

...implement commands like "make bold", "apply font", etc.

The key method is ApplyStyleConversion.

Example:

•	Demos\Delphi\Editors\Editor 2\

•	Demos\CBuilder\Editors\Editor 2\

Alternatively, you can use RichViewActions.


implement Find and Replace dialogs
 TRichView Reference | How to...

...implement Find and Replace dialogs

Find

The key method is TRichView.SearchText or TRichViewEdit.SearchText.

Search can be case sensitive or not, up or down. "Whole word" option is also supported.

You can convert options from Find dialog to SrchOptions parameter of these methods using GetRVSearchOptions or GetRVESearchOptions.

Replace

Use TRichViewEdit.SearchText to select the old string.

Then use InsertText to replace it with the new one. This method removes the selected part of document before performing insertion. If you search in backward direction, set CaretBefore parameter to True.

Examples

Demos:

Find dialog is implemented in the main editor demo:

•	Demos\Delphi\Editors\Editor 1\

•	Demos\CBuilder\Editors\Editor 1\

Both Find and Replace dialogs are implemented in the demo:

•	Demos\Delphi\Assorted\Search and Replace\

•	Demos\CBuilder\Assorted\Search and Replace\

Alternatively, you can use RichViewActions.


switch insert/overtype mode
 TRichView Reference | How to...

...switch insert/overtype mode

The overwrite mode is not supported directly, but you can implement it using events.

The code is below.

var IgnoreNextChar: Boolean = False;

procedure TForm1.RichViewEdit1KeyDown(Sender: TObject; var Key: Word;

  Shift: TShiftState);

begin

  IgnoreNextChar := RichViewEdit1.SelectionExists;

end;

procedure TForm1.RichViewEdit1KeyPress(Sender: TObject; var Key: Char);

var rve: TCustomRichViewEdit;

    ItemNo, Offs: Integer;

begin

  if IgnoreNextChar then begin

    IgnoreNextChar := False;

    exit;

  end;

  IgnoreNextChar := False;

  if not ((Key=#9) or (Key>=' ')) then

    exit;

  rve := RichViewEdit1.TopLevelEditor;

  if rve.SelectionExists then

    exit;

  ItemNo := rve.CurItemNo;

  Offs  := rve.OffsetInCurItem;

  if (Offs>=rve.GetOffsAfterItem(ItemNo)) then begin

    if (ItemNo+1<rve.ItemCount) and

       not rve.IsFromNewLine(ItemNo+1) then begin

      inc(ItemNo);

      Offs := rve.GetOffsBeforeItem(ItemNo);

      end

    else

      exit;

  end;

  rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs+1);

  rve.Invalidate;

end;

More details and demo: http://www.trichview.com/forums/viewtopic.php?t=171


move the caret to the beginning or to the end of document in editor
 TRichView Reference | How to...

...move the caret to the beginning or to the end of document in TRichViewEdit

The caret is always at the end of selection.

Selection can be changed using method TRichViewEdit.SetSelectionBounds.

Moving to the beginning:

var

  ItemNo, Offs: Integer;

...

ItemNo := 0;

Offs   := MyRichViewEdit.GetOffsBeforeItem(ItemNo);

MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);

Moving to the end:

var

  ItemNo, Offs: Integer;

...

ItemNo := MyRichViewEdit.ItemCount-1;

Offs   := MyRichViewEdit.GetOffsAfterItem(ItemNo);

MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);

See also:

•	TRichViewEdit.CurItemNo and OffsetInCurItem;

•	Example how to move caret to the beginning of paragraph.


make Unicode editor
 TRichView Reference | How to...

...make Unicode editor

See in the topic Unicode in TRichView..


make a plain text editor
 TRichView Reference | How to...

...make a plain text editor

How to make a plain text editor based on TRichViewEdit

•	Exclude all but text from AcceptDragDropFormat property.

•	Process OnPaste event (see below).

•	Disable all UI commands changing text and paragraph attributes.

procedure TMyForm.MyRichViewEditPaste(Sender: TCustomRichViewEdit;

  var DoDefault: Boolean);

var s: String;

begin

  if Clipboard.HasFormat(CF_TEXT) then begin

    s := Clipboard.AsText;

    Sender.InsertText(s, False);

  end;

  DoDefault := False;

end;

How to make ONE LINE plain text editor

•	Exclude all but text from AcceptDragDropFormat property.

•	Process OnPaste event (see below).

•	Process OnOleDrop event (see below).

•	Disable all UI commands changing text and paragraph attributes or inserting multiline text.

•	Set WordWrap property = False.

•	Include rvoDoNotWantReturns in EditorOptions.

•	Set VSmallStep property = 1, before calling Format.

•	If you do not want tabulators as well, set RVStyle.SpacesInTab = 4.

uses Clipbrd, ActiveX;

// Returning one line string made from s.

// This function replaces all line breaks with ' | '.

// You can change this function, for example to return the first line

function MakeOneLineString(const s: String): String;

var p: Integer;

begin

  Result := AdjustLineBreaks(s);

  while True do begin

    p := Pos(#13#10, Result);

    if p=0 then

      break;

    Delete(Result, p, 2);

    Insert(' | ', Result, p);

 end;

end;

procedure TMyForm.MyRichViewEditOleDrop(Sender: TCustomRichView;

  const DataObject: IDataObject; Shift: TShiftState; X, Y: Integer;

  PossibleDropEffects: TRVOleDropEffects; var DropEffect: TRVOleDropEffect;

  var DoDefault: Boolean);

var FmtEtc: TFormatEtc;

  StgMedium: TStgMedium;

  ptr: Pointer;

  s: String;

  p, ByteCount, CharCount: Integer;

begin

  DoDefault := False;

  FillChar(StgMedium, sizeof(StgMedium), 0);

  FillChar(FmtEtc, sizeof(FmtEtc), 0);

  FmtEtc.cfFormat := CF_TEXT; // CF_UNICODETEXT for Delphi 2009+

  FmtEtc.dwAspect := DVASPECT_CONTENT;

  FmtEtc.lindex := -1;

  FmtEtc.tymed := TYMED_HGLOBAL;

  if DataObject.GetData(FmtEtc, StgMedium)<>S_OK then

    exit;

  if StgMedium.tymed=TYMED_HGLOBAL then begin

    ptr := GlobalLock(StgMedium.HGlobal);

    try

      ByteCount := GlobalSize(StgMedium.HGlobal);

      CharCount := ByteCount;

      // CharCount := CharCount div 2; // uncomment for Delphi 2009+

      SetLength(s, CharCount);

      Move(ptr^, PChar(s)^, ByteCount);

    finally

      GlobalUnlock(StgMedium.HGlobal);

    end;

    p := Pos(#0, s);

    if p>0 then

      s := Copy(s, 1, p-1);

    MyRichViewEdit.InsertText(MakeOneLineString(s), False);

  end;

  ReleaseStgMedium(StgMedium);

end;

procedure TMyForm.MyRichViewEditPaste(Sender: TCustomRichViewEdit;

  var DoDefault: Boolean);

var s: String;

begin

 if Clipboard.HasFormat(CF_TEXT) then begin

    s := Clipboard.AsText;

    Sender.InsertText(MakeOneLineString(s), False);

  end;

  DoDefault := False;

end;


implement smart indenting
 TRichView Reference | How to...

...implement smart indenting

You can find the examples in the support forum: http://www.trichview.com/forums/viewtopic.php?t=2044

There are two examples available.

Indenting in programming style

When the user presses  Enter , the code adds space characters at the beginning of the new paragraph (as many spaces as at the beginning of the current paragraph).

Indenting in Microsoft Word style

The code changes FirstIndent and LeftIndent of paragraph, if  Tab / Backspace  is pressed when the caret is at the beginning of paragraph. First, it changes FirstIndent. Next, if FirstIndent is already changed, it changes LeftIndent. The code changes indents only if the caret is at the beginning of non-empty paragraph.


combine several TRichView documents in one
 TRichView Reference | How to...

...combine several TRichView documents in one

See in the topic TCustomRichView.InsertRVFFromStream.


use third-party graphic classes with RichView
 TRichView Reference | How to...

...use third-party graphic classes with RichView

Using third party graphic classes

You can use graphic classes created by third party developers.

These classes can be used just like standard classes (TBitmap, TIcon, TMetafile, TJpegImage).

You can add picture in a document using AddPictureEx or InsertPicture.

Example:

gif: TGifImage;

...

gif := TGifImage.Create;

gif.LoadFromFile('demo.gif');

editor.InsertPicture('Demo', gif, rvvaBaseLine);

For example, you can use free graphic classes:

•	Anders Melander's TGifImage www.torry.net/vcl/graphics/gif/gifimage.exe (update for Delphi 6 and newer: www.trichview.com/resources/thirdparty/gifimage.zip);

•	TJvGifImage from JEDI's JVCL http://jvcl.sourceforge.net;

•	Gustavo Huffenbacher Daud's TPngObject www.trichview.com/resources/thirdparty/pngimage.zip.

Starting from Delphi 2007, advanced version of Anders Melander's TGifImage is included in VCL, so TGifImage becomes a standard graphic class.

Starting from Delphi 2009, TPngImage is included in VCL.

Gif animation

To support animation, assign TCustomRichView.AnimationMode = rvaniOnFormat.

The following units must be included in your projects:

•	RVGifAnimate for Anders Melander's TGifImage;

•	RVJvGifAnimate for TJvGifImage from JEDI's JVCL;

•	RVGifAnimate2007 for standard Delphi TGifImage (in Delphi 2007 or newer).

Controlling automatic insertion of graphics when importing RTF

Sometimes images are inserted automatically (for example, when importing RTF).

Question 1: What graphic classes does RichView use for loading non-standard graphic formats (such as GIF or PNG)?

Answer: RichView uses the graphic class which is registered for the given file extension.

If third party creator has not associated his graphic class with the extension, you can do it yourself with TPicture.RegisterFileFormat:

TPicture.RegisterFileFormat('gif','Gif Image',TGifImage);

This registration is especially necessary if you define this graphic format as HTML graphic format.

Workaround for Delphi bug in constructors of graphic classes

If you use Delphi 5/C++Builder 5 or older, use RV_CreateGraphics (defined in RVFuncs unit) instead of direct call of graphic class constructor.

type

  TRV_CreateGraphicsFunction =

    function (GraphicClass: TGraphicClass): TGraphic;

var

  RV_CreateGraphics: TRV_CreateGraphicsFunction;

For example, use this code to copy graphic from TPicture to TGraphic:

var pic: TPicture;

  gr: TGraphic;

...

pic := TPicture.Create;

pic.LoadFromFile(FileName);

gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));

gr.Assign(pic.Graphic);

pic.Free;

// now you can use gr

It is not necessary if you use Delphi 6/C++Builder 6 or newer.

Exporting graphics in HTML

By default, all images are converted to JPEGs. This is obviously undesirable for formats like GIF and PNG.

You can specify which graphic classes must not be converted.

Use RV_RegisterHTMLGraphicFormat procedure, for example:

uses CRVData;

...

// call this before the first html export

RV_RegisterHTMLGraphicFormat(TGifImage);

This registration affects only images of the given format. Other formats will be converted to JPEGs.

Specifying PNG class

Specify graphic class for PNG images using RV_RegisterPngGraphic, for example:

uses CRVData;

...

RV_RegisterPngGraphic(TPngObject).

It allows loading PNG images from RTF files and saving PNG images to RTF files without converting to bitmaps or metafiles.


create a chat window
 TRichView Reference | How to...

...create a chat window

You can find the complete demo of a chat window on the support forum: http://www.trichview.com/forums/viewtopic.php?t=63

This demo shows how to implement a chat window with the following features. The user types a plain text message in TEdit. This message can contain special commands, they are processed before displaying in TRichView window.

This demo supports:

•	text commands;

•	emoticons;

•	URL detection.

Examples of text commands:

•	\b to make text bold (toggle);

•	\cRRGGBB to change text color.

Emoticons are easily customizable (their codes and graphics are stored in arrays). This demo uses bitmaps, but you can change them to Gif images (see how to use third-party graphic classes), including animations. For additional ideas about emoticons, see the demo in Demos\Delphi\Assorted\Graphics\Emoticons\.

URL detection use RVIsURL and RVIsEmail functions. You can use RVIsCustomURL to define your own types of links.


remove text formatting
 TRichView Reference | How to...

...remove text formatting

The code below removes text formatting from the whole document.

It converts indices of all text styles and paragraph styles to 0s. Optionally, it can keep hyperlinks (they are converted to the hypertext style with the lowest index).

Optionally, it can remove list markers as well.

This code changes text items, tabulators and list markers. All other item types remains unchanged.

Note 1: if the document contains both Unicode and non-Unicode text, or non-Unicode text of different Charsets, some text information may be lost.

Note 2: this is not an editing operation. When called for TRichViewEdit, undo buffer must be cleared.

// this code uses some undocumented methods

procedure RemoveFormatting(RVData: TCustomRVData; RemoveMarkers, KeepLinks: Boolean);

var i, HypertextStyleNo: Integer;

    UnicodeTo, UnicodeHTo: Boolean;

  {.............................................................}

  procedure DoRemoveFormatting(RVData: TCustomRVData);

  var i, r, c, StyleNo, StyleNoTo: Integer;

      PB, UnicodeFrom, ThisUnicodeTo: Boolean;

      table: TRVTableItemInfo;

  begin

    for i := RVData.ItemCount-1 downto 0 do begin

      RVData.GetItem(i).ParaNo := 0;

      StyleNo := RVData.GetItemStyle(i);

      case StyleNo of

        rvsTable:

          begin

            table := TRVTableItemInfo(RVData.GetItem(i));

            for r := 0 to table.RowCount-1 do

              for c := 0 to table.ColCount-1 do

                if table.Cells[r,c]<>nil then

                  DoRemoveFormatting(table.Cells[r,c].GetRVData);

          end;

        rvsListMarker:

          if RemoveMarkers then begin

            PB := RVData.PageBreaksBeforeItems[i];

            RVData.DeleteItems(i, 1);

            if i<RVData.ItemCount then begin

              RVData.GetItem(i).SameAsPrev := False;

              RVData.GetItem(i).PageBreakBefore := PB;

            end;

          end;

        rvsTab:

          if RVData.GetRVStyle.TextStyles[

            TRVTabItemInfo(RVData.GetItem(i)).TextStyleNo].Jump and KeepLinks then

            TRVTabItemInfo(RVData.GetItem(i)).TextStyleNo := HypertextStyleNo

          else begin

            TRVTabItemInfo(RVData.GetItem(i)).TextStyleNo := 0;

            RVData.SetItemTag(i, 0);

          end;

        1..MaxInt:

          begin

            if KeepLinks and RVData.GetRVStyle.TextStyles[StyleNo].Jump then begin

              ThisUnicodeTo := UnicodeHTo;

              StyleNoTo := HypertextStyleNo;

              end

            else begin

              ThisUnicodeTo := UnicodeTo;

              StyleNoTo := 0;

              RVData.SetItemTag(i, 0);

            end;

            UnicodeFrom := RVData.GetRVStyle.TextStyles[StyleNo].Unicode;

            RVData.GetItem(i).StyleNo := StyleNoTo;

            if UnicodeFrom and not ThisUnicodeTo then begin

              RVData.GetItem(i).ItemOptions := RVData.GetItem(i).ItemOptions-[rvioUnicode];

              RVData.SetItemTextR(i,

                RVU_UnicodeToAnsi(RVData.GetStyleCodePage(0), RVData.GetItemTextR(i)));

              end

            else if not UnicodeFrom and ThisUnicodeTo then begin

              RVData.GetItem(i).ItemOptions := RVData.GetItem(i).ItemOptions+[rvioUnicode];

              RVData.SetItemTextR(i,

                RVU_AnsiToUnicode(RVData.GetStyleCodePage(0), RVData.GetItemTextR(i)));

            end;

          end;

      end;

    end;

  end;

  {.............................................................}

begin

  HypertextStyleNo := 0;

  if KeepLinks then

    for i := 0 to RVData.GetRVStyle.TextStyles.Count-1 do

      if RVData.GetRVStyle.TextStyles[i].Jump then begin

        HypertextStyleNo := i;

        break;

      end;

  UnicodeTo  := RVData.GetRVStyle.TextStyles[0].Unicode;

  UnicodeHTo := RVData.GetRVStyle.TextStyles[HypertextStyleNo].Unicode;

  DoRemoveFormatting(RVData);

end;

How to use:

  RemoveFormatting(RichViewEdit1.RVData, True, True);

  NormalizeRichView(RichViewEdit1.RVData); // from RVNormalize.pas, from RichViewActions

  RichViewEdit1.DeleteUnusedStyles(True, True, True);

  RichViewEdit1.ClearUndo;

  RichViewEdit1.Format;

More information: http://www.trichview.com/forums/viewtopic.php?t=2392


Version History
 TRichView Reference | Version History

Version History

Version History and Compatibility Issues

•	New in version 12

•	New in version 11

•	New in version 10

•	New in version 1.9

•	New in version 1.8

•	New in version 1.7

•	New in version 1.6

•	New in version 1.5

•	New in version 1.4

•	New in version 1.3

•	New in version 1.2

•	Compatibility with older (freeware) version


New in version 12

Compatibility issues

Assignment to PageBreaksBeforeItems requires reformatting even if the given item starts a paragraph (because it clears text flow around side-aligned items).

OutlineLevel property allows saving headings in HTML and RTF, so be careful if you assumed that saved HTML and RTF files do not have headings.

Some existing code may assume that the text searching functions can select a substring only in a single text item. While the new behavior (searching in multiple text items) requires specifying a new option in the parameter of SearchText methods explicitly, GetRVSearchOptions and GetRVESearchOptions functions always return this new option.

Left- and right-aligned objects

Two new values are available for TRVVAlign type: rvvaLeft and rvvaRight. They can be used for all non-text items, except for tables, breaks, tabs, list markers, footnotes and endnotes.

New methods are available for accessing vertical alignment:

•	TRichView.GetItemVAlign,

•	TRichView.SetItemVAlign,

•	TRichViewEdit.GetCurrentItemVAlign,

•	TRichViewEdit.SetItemVAlignEd,

•	TRichViewEdit.SetCurrentItemVAlign.

Properties and methods for controlling text flow around side-aligned images:

•	TRichView.ClearLeft,

•	TRichView.ClearRight,

•	TRichViewEdit.ClearTextFlow.

Showing invisible characters

New options for RVVisibleSpecialCharacters allowing to display/hide lines for floating objects, paragraph directions, printing options and outline levels.

New colors can be defined in TRVStyle:

•	FloatingLineColor,

•	SpecialCharactersColor.

Headings

New property in paragraph style: OutlineLevel defines headings.

Other

New option of text searching (rvsroMultiItem for TRichView.SearchText, rvseoMultiItem for TRichViewEdit.SearchText) allows the searched string matching substrings of several text items.

New event in TRVStyle: OnAfterApplyStyle.

New event in TRichView: OnGetItemCursor

New property in TRVLabelItemInfo: RemoveInternalLeading

New methods in TRVOfficeConverter: IsValidImporter allows checking a file before importing.

New values in TRichView.RVFOptions and RVFWarnings (rvfoIgnoreUnknownCtrlProperties, rvfwUnknownCtrlProperties)


New in version 11
 TRichView Reference | Version History

New in version 11

The main feature of this update is compatibility with Delphi and C++Builder 2009.

Compatibility issues

New string types

New string types are declared in RVTypes.pas: TRVAnsiString, TRVUnicodeString, TRVRawByteString. These string types are used instead of String and WideString in many methods, properties and events.

TRVAnsiString is used for parameters and variables containing ANSI strings.

TRVUnicodeString is used for parameters and variables containing Unicode strings.

TRVRawByteString is used for parameters and variables containing either ANSI or “ raw Unicode” strings.

The standard String type is used for parameters and variables containing ANSI strings in older versions of Delphi/C++Builder, and Unicode strings for Delphi/C++Builder 2009.

Changed parameters of events

In the following events, type of some parameters was changed from String to TRVRawByteString: OnDrawStyleText, OnReadHyperlink, OnItemAction, OnSaveItemToFile, OnRVDblClick, OnRVRightClick, OnItemTextEdit. In existing projects, change types of parameters in these events manually.

In OnSaveComponentToFile event, it is assumed that OutStr parameter is ANSI string (for Delphi/C++Builder versions prior to 2009). When saving to UTF-8 HTML files, it is converted to UTF-8 automatically. In previous versions of TRichView, programmers need to return UTF-8 string in this case.

Removing (renaming) "not recommended for Unicode applications" methods

In older versions of TRichView, there were a group of methods marked as "not recommended for Unicode applications". In TRichView version 11, these all these methods were renamed, R is added to the end of names of these methods. For example, "GetItemText" was renamed to GetItemTextR. These methods have TRVRawByteString parameters. These methods are not described in the help file any more (you will not see "not recommended for Unicode applications" remark in this help file any more). Instead of these methods, a new group of methods is introduced: methods working with String type (Unicode for Delphi/C++Builder 2009, ANSI for older versions).

For example, GetItemTextA always returns ANSI string, GetItemTextW always returns Unicode string, GetItemText returns ANSI/Unicode string depending on Delphi version. The methods without -A and -W postfixes can be used to create projects portable to all versions of Delphi.

The affected methods are:

•	AddNLTag (and its versions);

•	GetWordAt;

•	GetItemText;

•	SetItemText;

•	GetCurrentItemText;

•	SetItemTextEd;

•	SetCurrentItemText.

The same naming convention is applied to the methods that previously had two versions (ANSI and Unicode):

•	CopyText;

•	GetSelText;

•	InsertStringTag;

•	InsertText;

•	PasteText;

•	SearchText.

The following methods have only String (ANSI/Unicode string depending on Delphi version) version:

•	AddFmt;

•	AddItem;

•	InsertItem;

•	GetTextInfo;

•	GetCurrentTextInfo.

The following method is removed (only -R version): AddTextBlockNL.

These changes break some existing low level code, especially the changes in GetItemText and SetItemText. Specifically, in the following examples GetItemText/SetItemText must be changed to GetItemTextR/SetItemTextR:

•	conversion to/from Unicode (ConvertToUnicode);

•	removing text formatting.

Delphi and C++Builder 2009

In the new versions of Delphi/C++Builder, String type is Unicode by default.

Many properties and parameters in TRichView become Unicode in Delphi/C++Builder 2009:

•	tag strings (in tags-are-PChars mode);

•	extra item properties;

•	names of checkpoints;

•	visible text in labels, numbered sequences, endnotes, footnotes;

•	text in list markers (not only bullets, but all numbering);

•	live spelling interface;

•	hypertext targets (OnReadHyperlink, OnWriteHyperlink);

•	and others.

Default (initial) values of the following properties are changed in Delphi/C++Builder 2009:

•	Unicode property of text style (from False to True);

•	TRichView.RTFReadProperties.UnicodeMode (from rvruNoUnicode to rvruOnlyUnicode);

•	TRichView.Options (rvoAutoCopyUnicodeText is included, rvoAutoCopyText is excluded).

When saving text styles (in RVF files or Delphi forms) in older versions of Delphi/C++Builder, only non-default value (True) of Unicode property of text style is saved. When saving text styles (in RVF files or Delphi forms) in Delphi/C++Builder 2009, value of Unicode property is always saved, default or not. The main consequence is the following: when loading forms/RVF files with styles saved by older versions of Delphi/C++Builder in Delphi/C++Builder 2009+, Unicode property of all text styles become True. For RVF files, all text in text items is converted to Unicode automatically.

Events parameters of TRVRawByteString type (OnDrawStyleText, OnReadHyperlink, OnItemAction, OnSaveItemToFile, OnRVDblClick, OnRVRightClick, OnItemTextEdit) must be converted to String before using. For example, for OnRVDblClick event:

// Example for Delphi 2009 or newer!!!

procedure TForm1.RichView1RVDblClick(Sender: TCustomRichView;

  ClickedWord: TRVRawByteString; Style: Integer);

var s: String;

begin

  if (Style>=0) and Sender.Style.TextStyles[Style].Unicode then

     s := RVU_RawUnicodeToWideString(ClickedWord) // converting from "raw Unicode" to UnicodeString

  else

     s := RVU_RawUnicodeToWideString(  // converting from ANSI to UnicodeString

      RVU_AnsiToUnicode(Sender.RVData.GetStyleCodePage(Style), ClickedWord));

  Panel1.Caption := s;

end;

New methods, properties and events

New TCustomRichView.OnAddStyle event.

New NoVScroll property of TRichView.

New options for line spacing ("at least" and "exactly" options).

New in saving and loading

RTF:

New option for saving formatted header and footer in RTF: include rvrtfSaveHeaderFooter in RTFOptions.

New properties for RTFReadProperties: CharsetForUnicode and UseCharsetForUnicode.

RVF:

Applications compiled in Delphi/C++Builder 2009 save RVF version 1.3.1, applications compiled in the older versions of Delphi saves RVF version 1.3 (previous version of RVF). RVF version 1.3.1 stores many strings (checkpoints names, DocProperties, tags, and others) in UTF-8 encoding.

Other

Special support for non-breaking hyphens in Unicode text, better table layout algorithm, copying multicell selection as text (in addition to RVF), making multicell selection with keyboard.


New in version 10
 TRichView Reference | Version History

New in version 10

Compatibility issues

The following changes may affect existing applications.

HTML

•	HTML tag names, color constants, CSS names are saved in lower case;

•	SaveHTMLEx does not use the following attributes for cells and tables any more: bordercolor, bordercolorlight, bordercolordark, background, bgcolor. CSS style is used instead. These attributes are not standard.

•	OnSaveItemToFile is called with Unicode parameter = True when saving UTF-8 HTML files ("raw Unicode" text is expected on output).

Tables

•	Table layout algorithm: when there is not enough space for columns having widths specified in pixels, they are decreased proportionally (previously, only the rightmost columns were decreased)

•	By default, table grid is not shown in read-only editors any more (it also affects TBDRichViewEdit when its dataset is not in the edit mode).

•	In editor,  Tab  key in the last table cell adds a new row; set the global variable RichViewTableAutoAddRow to False to disable.

Editing

•	BeginUpdate and EndUpdate have new functionality.

•	Simple version GetWordAt always returns ANSI string.

•	Paste can paste graphic files in CF_HDROP format.

RTF

•	bookmarks are read from RTF as checkpoints.

•	Local links are converted automatically when reading and writing RTF.

•	Sub/superscripts and VShift are saved and loaded to RTF differently.

Other

•	meaning of ItemNo parameter in OnControlAction is changed.

•	RVF insertion methods ignore background.

Main new features

•	Animation of pictures;

•	"Smart popups";

•	page breaks inside table cells.

New item types

•	labels;

•	sequences;

•	footnotes;

•	endnotes;

•	references to parent notes.

New in saving and loading

HTML:

New options in Options parameter of SaveHTML and SaveHTMLEx:

•	rvsoXHTML – if included, XHTML is saved instead of HTML;

•	rvsoUTF8 – if included, HTML/XHTML is saved in UTF-8 encoding.

You can choose between using <p> and <div>.

Font families are stored in CSS for the most frequently used fonts. For example, if font name is 'Arial', the string 'Arial', 'Helvetica', sans-serif will be saved.

RTF:

You can specify class representing PNG images using the function RegisterPngGraphic. After that, TRichView will be able to write and read PNG images in RTF.

You can save page parameters using DocParameters property.

Options for saving smaller RTF files: rvrtfSavePicturesBinary, rvrtfPNGInsteadOfBitmap.

RTF bookmarks are read as checkpoints. When exporting, links started from '#' are converted to links to checkpoints. When importing, links to checkpoints are converted to links started from '#'.

New properties for TCustomRichView.RTFReadProperties:

•	StoreImagesFileNames allows storing file names of external images;

•	BasePathLinks specifies whether to add path to file in hyperlinks;

•	IgnoreBookmarks allows ignoring bookmarks;

•	IgnoreNotes allows ignoring footnotes and endnotes;

•	IgnoreSequences allows ignoring numbered sequences;

•	IgnoreTables allows ignoring tables;

•	ReadDocParameters allows reading DocParameters;

•	UseSingleCellPadding sets mode for loading tables cell padding.

Text:

•	You can allow saving explicit page breaks in text files/streams. Set RichViewSavePageBreaksInText typed constant to True.

Other:

•	LoadFromStream loads document in RVF, RTF or text formats (autodetect).

New in DB controls

•	TDBRichView and TDBRichViewEdit can be placed in TDBCtrlGrid.

•	TDBRichView and TDBRichViewEdit can update standard DB actions.

•	TDBRichView.OnLoadCustomFormat, TDBRichViewEdit.OnLoadCustomFormat and OnSaveCustomFormat events allow loading and saving data to fields in custom formats.

•	Special support for Unicode memo fields.

New in drag&drop

Low level events:

•	OnOleDragEnter;

•	OnOleDragOver;

•	OnOleDragLeave;

•	OnOleDrop.

New in Unicode processing

•	Support for the word joiner Unicode character (code $2060). This character is invisible and it disallows line breaking before and after it. A special support is required because almost no font has a glyph for this character (it works properly only if inserted in the middle of text item).

•	WM_UNICHAR message is processed, if the current text is Unicode.

•	TCustomRichView.SearchTextW and TCustomRichViewEdit.SearchTextW allows searching for WideString.

New in layout and formatting

•	If you set RichViewShowGhostSpaces typed constant to True, spaces hidden between lines will be shown if rvoShowSpecialCharacters is in TCustomRichView.Options.

•	You can define which characters to show in ShowSpecialCharacters mode. They are listed in RVVisibleSpecialCharacters typed constant.

•	New possible values for TCustomRichView.BackgroundStyle.

•	New property TCustomRichView.MaxLength – maximal count of characters per line.

•	New property TCustomRichView.WordWrap allows to disable word wrapping.

•	If you set RichViewWrapAnywhere typed constant to True, text can be wrapped in any place.

New text attributes

•	New text Protection options: rvprStyleSplitProtect, rvprSticking2, rvprSticking3.

•	New property HoverEffects allows hyperlinks underlining.

•	New properties UnderlineType, UnderlineColor and HoverUnderlineColor allow to customize underlines.

•	New property SubSuperScriptType allows implementing subscripts and superscripts.

New in printing

•	TRVReportHelper and TRVPrint do not require parent control any more. They can be placed on data module or created without owner.

•	TRVPrintPreview displays full paper size, including areas where printer cannot print (see WinAPI function GetDeviceCaps, PHYSICAL*** constants).

•	TRVPrintPreview.PrintableAreaPen property. If you set its Style<>psClear, RVPrintPreview shows borders of printable area (this rectangle was displayed as a full page in previous versions)

•	TRVPrint.FixMarginsMode property.

New in item properties

•	rvepVisible item property allows to hide controls;

•	rvepResizable item property works for pictures too;

•	rvespAlt item property can be applied to bullets and hotspots as well as to pictures and hot-pictures;

•	new values for VAlign property of items: rvvaAbsTop, rvvaAbsBottom, rvvaAbsMiddle.

•	new styles for breaks (horizontal lines): dashed and dotted; all types of breaks are drawn without rounded corners.

New in checkpoints

New set of editing methods working with checkpoint exactly at the position of caret:

•	InsertCheckpoint;

•	GetCheckpointAtCaret;

•	RemoveCheckpointAtCaret.

New in tables

•	Table cells can be printed on several pages (previously, page breaks were possible only between rows).

•	New option for table.Options: rvtoNoCellSelect. If included, multicell selection by mouse is not allowed.

•	New property table.VisibleBorders allows to hide some sides of table border. Direct assignment to this property cannot be undone/redone, use table.SetTableVisibleBorders for that.

•	Table grid is not shown in read-only editors any more. More exactly, it is shown using global variable RichViewTableGridStyle2 (default value: psClear). The same pen style is used for drawing table grid in viewer.

•	Copying multicell selection as a table fragment (in RVF format); special pasting is not implemented yet, pasted as a new table.

•	Adding new table row when user presses  Tab  in the last cell (set the global variable RichViewTableAutoAddRow to False to disable this feature).

•	New properties RowCount, ColCount.

•	New properties CellHPadding, CellVPadding.

•	New property Cell.Hint.

•	New property Row.PageBreakBefore.

•	New methods SetCellBackgroundImageFileName and SetCellHint.

•	Improved table layout algorithm.

•	better SplitSelectedCellsVertically and SplitSelectedCellsHorizontally implementations.

New in RVF

If image was not returned in OnRVFPictureNeeded event, this event is called the second time with the value of rvespImageFileName property in the Name parameter (if value of this property was stored for this item).

Custom Caret

You can draw your own caret instead of the system one. It is activated CustomCaretInterval, measured in OnMeasureCustomCaret event, drawn in OnDrawCustomCaret event.

Other

•	The following Windows messages are processed by TCustomRichView: EM_GETSEL, EM_SETSEL, EM_GETTEXTRANGE. If you do not need these messages, you can define RVDONOTUSELINEARPOSITIONS in RV_Defs.inc. It slightly reduces exe-file size.

•	Pasting graphic files in CF_HDROP format, see PasteGraphicFile.

•	New characters are included in the default value of TCustomRichView.Delimiters.

•	meaning of TCustomRichViewEdit's BeginUpdate and EndUpdate was changed.

•	New option for TCustomRichView.SearchText: rvsroFromStart.

•	Changes in TCustomRichView.GetWordAt.

•	Ability to delete unused styles in multiple documents, see TRVDeleteUnusedStylesData.

•	Much faster reformatting, especially if rvoFastFormatting is included in TCustomRichView.Options (default). Much faster loading RTF files. Much faster copying to the Clipboard.

•	Function RVIsCustomURL.

•	 Ctrl +   and  Ctrl + ?  scroll the document down/up instead of moving caret.

•	(in Unicode mode in WinNT/2000/XP/Vista) special support for typing in Kazakh, Tatar, Mongolian, Azerbaijani (Cyrillic & Latin), Uzbek, Kyrgyz, Serbian.

•	New "hidden" parameters in TCustomRichView.OnControlAction.


New in version 1.9
 TRichView Reference | Version History

New in version 1.9

Compatibility issues

•	TRVStyle.CurrentItemColor is used for drawing frame around the current item instead of TRVStyle.HoverColor.

•	ApplyTextStyle, ApplyParaStyle, ApplyStyleConversion, ApplyParaStyleConversion are applied to cells of all selected tables.

•	OnSaveImage2 event: ImageSaveNo is declared as a var-parameter (it does not make sense otherwise)

•	RTF export: only Standard styles can be exported as style sheet.

•	Default value of RVStyle.SpacesInTab is changed from 8 to 0.

•	Default value of TRichViewEdit.EditorOptions is changed from [rvoClearTagOnStyleApp] to [rvoWantTabs, rvoCtrlJumps].

•	New characters are added to default value of Delimiters property.

New: tab stops

•	Tabs – properties of paragraph style defining tab stops.

•	TRVStyle.DefTabWidth defines default distance between tab stops.

•	TRVStyle.SpacesInTab: if equals to 0, methods for adding/inserting multiline text, RTF, and Tab key inserts tabulator (item of special type). If this property has positive value, all these methods work like before (inserting several spaces in place of tabs).

•	TRichView.AddTab, TRichViewEdit.InsertTab adds/inserts tabulator

New: Live spelling check

See overview topic

New in TRichView

•	VAlign property, ClientToDocument method;

•	rvoShowSpecialCharacters in Options;

•	BeginOleDrag – allows drag&drop of inserted controls;

•	Reformat method – formatting method that keeps selection;

•	AddTextNLA method;

•	LoadTextFromStream, LoadTextFromStreamW;

•	Events: OnItemHint, OnProgress.

New item properties

•	additional string properties: hint, alt text, image file name; a set of methods supporting them: TRichView's GetItemExtraStrProperty and SetItemExtraStrProperty, TRichViewEdit's GetCurrentItemExtraStrProperty, SetCurrentItemExtraStrProperty and  SetItemExtraStrPropertyEd (this set of methods is similar to methods working with additional integer properties);

•	rveoNoHTMLImagesSize additional integer property

Printing

Added: rvpaoKeepLinesTogether and rvpaoKeepWithNext Options for paragraph style.

Tables

•	rvtoIgnoreContentWidth and rvtoIgnoreContentHeight options for TRVTableItemInfo.Options;

•	AssignProperties method;

•	better table layout algorithm.

RTF

•	TRichView.RTFReadProperties.ExtractMetafileBitmaps – allows extracting bitmaps wrapped in metafiles.

•	output RTF file size is greatly reduced;

•	a number of small improvements in RTF import and export.

HTML export

•	SaveHTMLEx is modified to conform "HTML 4.01 Transitional" standard, see http://validator.w3.org/;

•	improvements in CSS export;

•	SaveHTMLEx  saves characters of "Symbol" font as HTML entities (like &alpha;);

•	better saving of RTF-like tables (with CellHSpacing=CellVSpacing=-1 to simulate 1-pixel width border) with SaveHTMLEx, or SaveHTML with rvsoForceNonTextCSS in the Options parameter;

•	ImagesPrefix parameter of SaveHTML/SaveHTMLEx can contain a full path (determined by the presence of ':').

TRVOfficeConverter

•	added: PreviewMode property.

TRVReportHelper

•	added: OnDrawCheckpoint event

Database controls

•	OnLoadDocument event for TDBRichViewEdit.

•	OnNewDocument and OnLoadDocument for TDBRichView.

Other improvements

•	TRVStyle.CurrentItemColor.

•	rvoNoCaretHighlightJumps in EditorOptions;

•	faster redrawing on typing;

•	better processing of bidirected text;

•	ApplyTextStyle, ApplyParaStyle, ApplyStyleConversion, ApplyParaStyleConversion are applied to cells of all selected tables;

•	all TRichViewEdit methods for inserting one item return boolean value: True if the item was successfully inserted (insertion can fail because of protection). You can use SetCurrent*** methods to set additional properties of this item after the insertion.

•	support for soft (optional) hyphens (WideChar($AD)) and zero-width spaces (WideChar($200B)) in Unicode text. Normally soft hyphen is invisible. It is displayed as a hyphen only if line breaks is after it.If rvoShowSpecialCharacters is in Options, it is shown as "not" sign (WideChar($AC)), like in MS Word. Unlike spaces and paragraph marks, soft hyphens change their widths when switching normal/show-special-chars modes. So call Reformat when switching these modes. Processing of these characters may slow down formatting of Unicode text. If you do not need them, activate RVDONOTUSESOFTHYPHENS in RV_Defs.inc Zero-width spaces are processed correctly even if this character is not present in the font.

•	RVF (RichView Format) forward compatibility improved.


New in version 1.8
 TRichView Reference | Version History

New in version 1.8

Compatibility issues

Changes that can affect existing code:

•	OnHTMLSaveImage is called for tables to save background image;

•	OnHTMLSaveImage is called to save cell background image; in this case, parameter ItemNo = -1; you can distinguish saving of document background and cell background by RVData parameter.

•	MaxTextWidth property does not include left and right margins any more, so now it works according to the help file;

•	parameters are changed in OnChanging event (should not be a problem because this event is rarely used);

•	table.OnDrawBorder event has two new parameters: Row and Col;

•	changes in rvteoHTMLCode and rvteoRTFCode (Options of text style);

•	TRichView does not use font external leading any more (it may add extra spacing between lines), so its line spacing just like in TRichViewEdit now.

•	default selection mode: select by words;

•	RVF version number is changed from 1.2 to 1.3 (see RVF specification); new version of RVF is not completely compatible with the old version (new version of TRichView can read old RVF; old versions of TRichView may not read new RVF);

•	rvprSticking protection option meaning was changed (split into 3 rvprStick*** options).

Drag&Drop

See overview.

Background images for tables and cells

•	table.BackgroundImage, BackgroundStyle;

•	cell.BackgroundImage, BackgroundStyle.

Resizing pictures and controls with mouse

By default, all pictures and hot-pictures can be resized with the mouse (except for TIcon-s).

By default, controls cannot be resized. But you can explicitly allow resizing for the given control, if you set its rvepResizable property to non-zero value. See also SelectControl method.

You can disallow resizing in the given RichViewEdit by including rvoNoImageResize in its EditorOptions property.

Extra items' integer properties

•	rvepSpacing – spacing around the item (image or control);

•	rvepResizable allows resizing the given control with the mouse;

•	rvepDeleteProtect protects the non-text item from deletion in editing operations.

Printing and preview

•	ColorMode property for TRVPrint and TRVReportHelper: allows black and white or grayscale printing/previewing for color documents;

•	much more accurate print preview;

•	new properties of TRVPrintPreview: ClickMode, Color, PageBorderColor, PageBorderWidth, ShadowColor, ShadowWidth.

Selecting:

•	new line selection mode, see TRVStyle.LineSelectCursor

•	defining visual appearance of selection, see TRVStyle.SelectionStyle

•	defining selection mode, see TRVStyle.SelectionMode

RVF

•	tags can contain space characters;

•	in text-mode RVF, TRichView saves text RVF files even if the document contains Unicode text (text files can be edited in text editors)

•	ability to save arbitrary additional text strings (DocProperties).

HTML export

•	by default, all images are saved in HTMLs as Jpegs. This is obviously undesirable if images already have formats recognizable by web browsers (such as Gif or Png). Now you can specify graphic formats that must not be converted to Jpeg on HTML export, using RV_RegisterHTMLGraphicFormat procedure.

•	OnSaveHTMLExtra event now allows to insert HTML code before the </body> tag;

•	new OnSaveParaToHTML, OnSaveImage2, OnSaveItemToFile events;

•	new options for HTML export;

•	OnWriteHyperlink event supersedes OnURLNeeded.

RTF export

•	OnWriteHyperlink event supersedes OnURLNeeded;

•	new OnSaveItemToFile event.

RTF import

•	import of DDB (device dependent bitmaps);

•	using some advanced RTF features when importing images from RTF saved by MS Word 2000+.

•	more special RTF characters are recognized

•	new event: OnImportPicture

DB controls

•	new event: TDBRichViewEdit.OnNewDocument;

•	new property: TDBRichViewEdit.IgnoreEscape.

Other improvements

•	TRVReportHelper.OnDrawHyperlink event;

•	default text styles for paragraph styles (TParaInfo.DefStyleNo);

•	improvements in processing of bidirected text;

•	new action in OnItemAction event: rviaInserted;

•	faster redrawing on editing;

•	previously reserved break styles are implemented;

•	RefreshListMarkers method.


New in version 1.7
 TRichView Reference | Version History

New in version 1.7

Compatibility issues

•	TCustomRichView.DeleteLines is renamed to DeleteItems.

•	If you assign non-default values to extra item properties, saved RVF files will not be opened with applications that use older version of RichView.

•	OnDrawPageBreak event has additional parameter. If you already use this event, you must change declaration of event handler manually.

•	All references to TImageList were replaced with TCustomImageList. Especially important: parameter of OnRVFImageListNeeded was changed; if you already use this event, you must change declaration of event handler manually;

•	FirstIndent is not applied to line starts inside paragraphs ( Shift + Enter ).

•	DeleteUnusedStyles has a new parameter (deleting list styles).

•	GetWordAt parameters are changed.

•	Accessing invalid item in RVStyle.TextStyles and ParaStyles does not cause "List index is out of bounds" error any more.

•	OnHTMLSaveImage is called for background bitmap; this may affect old code that assumes ItemNo is always an index of item.

•	Declarations of some types are moved in other files.

•	Format of CSS was slightly changed to support list styles.

The main new feature: paragraph lists (bullets and numbering)

•	TRVStyle.ListStyles

Methods of TCustomRichView:

•	SetListMarkerInfo,

•	GetListMarkerInfo.

Methods of TCustomRichViewEdit:

•	ApplyListStyle,

•	RemoveLists,

•	ChangeListLevels.

New options for HTML export – rvsoMarkersAsText.

New parameter in DeleteUnusedStyles (deleting list styles)

Extra integer properties for items (stretching, transparent color for bitmaps, etc)

Methods of TCustomRichView:

•	SetItemExtraIntProperty – changes value of property (without document reformatting);

•	GetItemExtraIntProperty – returns value of property.

Methods of TCustomRichViewEdit:

•	SetItemExtraIntPropertyEd – changes value of property, updates the document;

•	SetCurrentItemExtraIntProperty – the same for item at the position of caret;

•	GetCurrentItemExtraIntProperty – returns value of property of item at the position of caret.

Soft page breaks (preliminary implementation)

Methods of TCustomRichView:

•	AssignSoftPageBreaks, ClearSoftPageBreaks - displays/hides soft page breaks

Property of TRVStyle

•	SoftPageBreakColor

Other improvements in TCustomRichView

New methods:

•	DeleteParas – deletes the specified paragraphs, updates the document;

•	GetLineNo – returns line for the specified position;

•	GetWordAt (parameters are changed);

•	GetItemAt – returns item in the given coordinates.

New events:

•	OnItemAction – occurs on operations with item;

•	OnPaint.

New properties:

•	RTFReadProperties.ConvertHighlight, LineBreaksAsParagraphs.

New Options for HTML export: rvsoUseCheckpointsNames.

New Options for RVF: rvfoSaveLayout, rvfoLoadLayout.

Events:

•	OnSaveHTMLExtra, OnSaveRTFExtra – allow saving additional information in HTML and RTF.

Other improvements in TCustomRichViewEdit

Methods:

•	ApplyParaStyleConversion (and OnParaStyleConversion event) – implements commands like "change paragraph alignment", "increase indent", etc.

•	InsertText, InsertTextW have additional optional parameter;

•	GetCurrentLineCol – returns line and column at the caret position;

•	ConvertToPicture, ConvertToHotPicture – convert picture to hot-picture and vice versa

Properties:

•	Modified: Boolean

New EditorOption – rvoDoNotWantShiftReturns.

Other improvements in TRVStyle

•	InvalidPicture – picture that used instead of invalid or missed pictures;

•	InvalidItem for TextStyles, InvalidItem for ParaStyles – are returned when accessing item which is out of index range.

New properties of text style (TFontInfo):

•	Options – affects HTML and RTF export

New properties of paragraph style (TParaInfo):

•	new protection Option – rvpaoDoNotWantReturns.

Improvements in TDBRichViewEdit

•	AutoDeleteUnusedStyles

Improvements in TRVOfficeConverter

•	ExcludeHTMLImportConverter, ExcludeHTMLExportConverter;

•	ExtensionsInFilter;

•	ErrorCode – returns error code for the last import/export operation.

Improvements in TRVPrint

•	OnPrintComponent is optional since this version;

•	ClipMargins property – disallows printing on margins;

•	headers and footers: TRVPrint.SetHeader, SetFooter, HeaderYMM, FooterYMM.

•	reading headers and footers from RTF: TRichView.RTFReadProperties.SetHeader, SetFooter, HeaderYMM, FooterYMM;

•	OnPagePostpaint;

•	ColorMode – allows black&white and grayscale printing and preview;

Improvements in all visual controls of the package

•	UseXPThemes	- allows using WindowsXP themes (visual styles)

Improvements in tables

Global variable RichViewTableGridStyle: TPenStyle – drawing invisible table borders.

Methods:

•	SetCellVisibleBorders – sets VisibleBorders property for the cell.

Properties:

•	HeadingRowCount – defines table header;

•	new Option – rvtoRTFAllowAutofit.

Events:

•	OnCellEditing – allows to prevent cell editing;

•	OnDrawBorder – custom drawing for cell borders.

New help topics

•	Valid Documents

•	Custom Drawing

•	Examples for DBRichViewEdit

•	New overview: Item Types

•	More examples and cross references.

Miscellaneous

Better RTF import (including import of inserted symbols, Unicode paired quotes and dashes), better IME support, better Unicode text processing, faster formatting, and so on.

Packages for D7 and CB6.


New in version 1.6
 TRichView Reference | Version History

New in version 1.6

Compatibility issues

•	TRVPrint.OnPrintComponent event has changed type of Sender parameter (from TRVPrint to TCustomRVPrint). If you use this event in your existing projects, change type of this parameter in your handlers for this event.

•	Parameters added in TRichView.DeleteUnusedStyles.

Changes in TRVPrint

•	new: TRVPrint.TransparentBackground

•	new: TRVPrint.GetFirstItemOnPage

•	new: TRVPrint.MirrorMargins

Changes in tables

•	Vertical alignment of cells (cells' VAlign and rows' VAlign, SetCellVAlign and SetRowVAlign of table).

•	BorderColor and BorderLightColor of cells allow to override default values (see also SetCellBorderColor and SetCellBorderLightColor).

•	Ability to hide table grid in editor (new option for table Options – rvtoHideGridLines).

•	Ability to print table background in white (new option for table PrintOptions – rvtoWhiteBackground).

•	New table Options – rvtoCellBelowBorders and rvtoOverlappingCorners.

•	Tables with rvtoEditing excluded from Options now ignore commands for cells clearing and style applying.

•	Hidden sides of borders can be shown as dotted gray line (if rvtoHideGridLines is not in table Options). Previous versions show grid only for zero-width borders.

New components

 TRVOfficeConverter – allows using Microsoft Office converters

 TRVReportHelper – reserved for future use.

HTML export

New options – rvsoImageSizes, rvsoForceNonTextCSS.

RTF export

You can save hyperlinks in RTF, using OnURLNeeded event.

New option for saving RTF files – rvrtfSaveEMFDefault.

RTF import

•	new: reading hyperlinks: OnReadHyperlink event;

•	reading tables (see also: RTFReadProperties.AutoHideTableGridLines);

•	reading external images (see important note for using third-party graphics formats);

•	new: ignoring hidden text (see RTFReadProperties.SkipHiddenText).

Horizontal scrolling

new: HScrollPos, HScrollMax, OnHScrolled.

Visual effects and formatting

•	new: TRVStyle.InactiveSelColor and InactiveSelTextColor;

•	new: CharSpacing property of text style.

DB Components

DB components can display RTF and plain text fields.

new: TDBRichViewEdit.FieldFormat allows to edit RTF and text fields

Miscellaneous

•	New component-editor (click RichView and choose "Settings..." in popup menu) allows to set properties related to updating styles.

•	New methods of TRichViewEdit: InsertStringTag and InsertStringWTag.

•	Parameters are added in TRichView.DeleteUnusedStyles.

•	Essential styles can be marked with Standard property.

•	TRichView.SearchText and TRichViewEdit.SearchText now searches in table cells.

•	Hypertext works automatically in read-only editors (user does not need to press and hold  Ctrl ).

•	Editor can hide caret in read-only mode (new option in EditorOptions - rvoHideReadOnlyCaret).

•	Methods for loading text files understand page-break characters (characters with code $0C).

•	Methods for loading text files can be used for Unix text files (with #$0A characters separating lines).

•	TRichViewEdit.SelectCurrentLine.


New in version 1.5
 TRichView Reference | Version History

New in version 1.5.4

Compatibility issues

1. Changed types in events. Important (please read before installing the update!):

Types of parameters were changed in some events: "TRichView" was changed to "TCustomRichView", "TRichViewEdit" to "TCustomRichViewEdit".

After installing, open all forms containing RichView or RichViewEdit, and modify declarations of event handlers: change "TRichView" to "TCustomRichView", "TRichViewEdit" to "TCustomRichViewEdit". You must do it manually!

(This is one-time change that is required only for projects created with older version of the components)

For example, for TRichView.OnRVMouseDown

procedure TForm1.RichView1RVMouseDown(

                Sender: TRichView;

                Button: TMouseButton;

                Shift: TShiftState;

                ItemNo, X, Y: Integer);

begin

...

end;

must be changed to

procedure TForm1.RichView1RVMouseDown(

                Sender: TCustomRichView;

                Button: TMouseButton;

                Shift: TShiftState;

                ItemNo, X, Y: Integer);

begin

...

end;

Sorry for inconvenience.

2. Changed component hierarchy

TRichViewEdit, TDBRichView, TDBRichViewEdit are not descendants of TRichView any more. All of them (and TRichView itself) are descendants of TCustomRichView.

TDBRichViewEdit is not a descendant of TRichViewEdit any more. Both them are descendants of TCustomRichViewEdit.

See new scheme of hierarchy.

3. New parameter

New parameter of SaveCSS/SaveCSSToStream. Please use empty set ([]) for it.

New feature: RTF Import

•	TRichView.LoadRTF;

•	TRichView.LoadRTFFromStream;

•	TRichViewEdit.InsertRTFFromFileEd;

•	TRichViewEdit.InsertRTFFromStreamEd;

•	TRichViewEdit.PasteRTF;

•	TRichViewEdit.CanPasteRTF;

•	and property TRichView.RTFReadProperties.

New feature: saving text and paragraph styles in RVF

•	New rvfoSaveTextStyles and rvfoSaveParaStyles RVFOptions

•	TRichView.RVFTextStylesReadMode;

•	TRichView.RVFParaStylesReadMode;

•	Related: TRichView.DeleteUnusedStyles.

New feature: hot pictures

Hot pictures are the same as normal pictures, but they are also hypertext jumps.

New methods: AddHotPicture, AddHotPictureTag, InsertHotPicture.

Old methods (GetPictureInfo, SetPictureInfo, GetCurrentPictureInfo, SetCurrentPictureInfo, SetPictureInfoEd) now work with both pictures and hot pictures.

New properties for text and paragraph formatting:

•	TFontInfo.StyleEx (new option – rvfsAllCaps);

•	TFontInfo.CharScale;

•	TParaInfo.LineSpacing;

•	TParaInfo.LineSpacingType;

•	TParaInfo.Options.

New feature: Tab navigation through links and inserted controls

TRichView.TabNavigation property;

TRichView.GetFocusedItem method.

New feature: Proportional resizing of controls in documents

RichView now can resize controls depending on document width.

Let ItemNo - index of control item (rvsComponent).

var Item: TRVControlItemInfo;

  ...

Item := RichView.GetItem(ItemNo) as TRVControlItemInfo;

Item.PercentWidth := 50; // 50% of document width (minus paragraph indents)

Effect will be after reformatting.

Known problem: such controls may not work properly in paragraphs with word-wrapping turned off.

Miscellaneous

•	OnCaretMove

•	GetLastCheckpoint, GetPrevCheckpoint

•	two new possible values of Direction parameter of OnCaretGetOut

•	TRVStyle.ParaStyles.FindStyleWithAlignment and FindSuchStyle

•	"whole word" option for TRichView.SearchText and TRichViewEdit.SearchText (thanks to Louis Kessler)

Improved:

•	support of third party graphic classes

•	RTF export

•	HTML export: SaveHTML now retains right and justify alignments.


New in version 1.4
 TRichView Reference | Version History

New in version 1.4

Compatibility issues

•	TRichView.OnControlAction declaration was changed. If you use this event, please add "var" to ctrl parameter of your event handler after rebuilding the package. Failing to do it causes memory access errors when running your applications.

•	GetCurrent***Info/SetCurrent***Info methods of TRichViewEdit now differ from Get***Info(ItemNo,...)/Set***InfoEd(ItemNo,...). "Current" methods can be used to work with items in cell-inplace editor in the same way as with items in main editor (programmer does not need to know if the item is in main editor or in sub-editor, he/she can always work with item at the position of caret). "Not-current" methods cannot be used to work with items in inplace editor, because such items cannot be addressed using only their indices.

The main new feature: tables

There is a new set of topics about them.

New methods

TRichView:

•	AddNLATag, AddItem, GetItem, GetItemNo,

•	GetJumpPointLocation

•	GetItemCoords, GetItemClientCoords

TRichViewEdit:

•	InsertItem,

•	GetCurrentItem, GetCurrentItemEx

•	SetItemTextEd,SetCurrentItemText, GetCurrentItemText,

•	CanChange

•	BeginItemModify, EndItemModify

•	ResizeCurrentControl,  AdjustControlPlacement2

TFontInfos:

•	FindStyleWithCharset

New properties

•	TParaInfo.NextParaNo

•	TRVStyle.DefCodePage

•	TRichView.HScrollVisible

•	TRichView.RVData

•	TRichView.InplaceEditor

•	New option (rvoAutoSwitchLang) in TRichViewEdit.EditorOptions (thanks to Pavel Zhelty)

•	New states in TRVTextDrawStates

New events:

•	TRichView.OnCopy

•	TRichView.OnHTMLSaveImage

•	TRichViewEdit.OnCaretGetOut

•	New "hidden" parameters in TRVStyle.OnDrawStyleText and OnDrawTextBack

Cursors

Two new cursors. Ability to use system default hypertext cursor

Miscellaneous

Special support for Unicode Hindi keyboard input (note: Hindi uses complex glyphs composed from several Unicode characters; such glyphs are not fully supported yet)

Known problems

•	TRVStyle does not work properly in frame (Delphi 5+ and C++Builder 5+)

•	wrong displaying of underline for Unicode text in Windows95 (WinNT/2000 is OK)


New in version 1.3
 TRichView Reference | Version History

New in version 1.3

The main additions in version 1.3

•	Undo/Redo (many topics, this is the link to the overview);

•	Unicode support (many topics, this is the link to the overview);

•	Events for custom drawing (several topics; this is the link to the list)

•	TRichView.RTFOptions, CopyRTF, SaveRTF, SaveRTFToStream

•	TRVPrint.OnPagePrepaint event

•	TFontInfo.Protection property

•	TRVStyle.UseSound property

•	TRichView.AddTextBlockNL, SetItemText, GetItemText, SaveTextToStream, SaveTextToStreamW methods;

•	TRichView.OnControlAction event;

•	new options in TRichView.Options, TRichViewEdit.EditorOptions;

•	new parameter in TRichView.LoadText;

•	TFontInfo.IsEqual, TFontInfos.FindStyleWithFontStyle, FindStyleWithFontSize, FindStyleWithColor, FindStyleWithFontName, FindSuchStyle, FindStyleWithFont

•	new global variables

•	HTML export improved.

Compatibility issues

•	declaration of some types were moved (usually from RichView.pas to either RVScroll.pas or RVStyle.pas; in some cases you will need to correct uses clause of units in older projects, if Delphi will not find some types).

•	TRichView.LoadText has a new parameter.

•	TFontInfo.SingleSymbols property removed; see TFontInfo.Protection.

•	Older version of RichView will not be able to read RVF with Unicode.


New in version 1.2
 TRichView Reference | Version History

New in version 1.2

The main additions in version 1.2

•	Borders and Background of Paragraphs;

•	spacing between paragraphs (TParaInfo.SpaceBefore,TParaInfo.SpaceAfter) and ability to move items to the new line inside paragraphs ( Shift + Enter  in editor, also see TRichView.IsFromNewLine, TRichView.IsParaStart, TRichView.SetAddParagraphMode);

•	ability to specify explicit page breaks (TRVStyle.PageBreakColor, TRichView.PageBreaksBeforeItems, TRichView.Options, TRichViewEdit.InsertPageBreak, TRichViewEdit.RemoveCurrentPageBreak);

•	ability to change background color of text under mouse (TFontInfo.HoverBackColor);

•	ability to save and load styles to registry (TRVStyle.LoadReg, TRVStyle.SaveReg, Delphi 4+ is required);

•	ability to search upwards in RichView (TRichView.SearchText);

•	ability to save background in RVF file or stream (optionally) (TRichView.RVFOptions, RVF Overview).

Compatibility issues

•	default search direction in TRichView.SearchText was changed;

•	some keys for saving styles in ini-files were changed (SingleSymbolsN -> FontSingleSymbolsN, VShiftN -> FontVShiftN, NextStyleNoN -> FontNextStyleNoN, AlignmentN -> ParaAlignmentN);

•	components do not use text HoverColor for drawing selected hypertext links any more; you can return old behavior turning on RVUSETEXTHOVERCOLORWITHSELECTED define;

•	removed method TRVStyle.SaveCSSFile (replaced with TRVStyle.SaveCSSToStream);

•	RVF format was changed. RichView v1.2 can read RVF files saved by old versions of RichView, but older versions can not read new RVF files.

New and updated topics (from version 1.1.3 to version 1.2)

New:

•	TFontInfo.HoverBackColor

•	TRVStyle.LoadReg

•	TRVStyle.SaveReg

•	TRVRect

•	TRVBooleanRect

•	TRVBorderStyle

•	Borders and Background of Paragraphs

•	TParaInfo.SpaceBefore

•	TParaInfo.SpaceAfter

•	TParaInfo.Border

•	TParaInfo.Background

•	TRVBorder

•	TRVBorder Properties

•	TRVBorder.BorderOffsets

•	TRVBorder.Color

•	TRVBorder.InternalWidth

•	TRVBorder.Style

•	TRVBorder.VisibleBorders

•	TRVBorder.Width

•	TRVBackgroundRect

•	TRVBackgroundRect Properties

•	TRVBackgroundRect.BorderOffsets

•	TRVBackgroundRect.Color

•	TRichView.IsFromNewLine

•	TRichView.SetAddParagraphMode

•	TRVStyle.PageBreakColor

•	TRichView.PageBreaksBeforeItems

•	TRichViewEdit.InsertPageBreak

•	TRichViewEdit.RemoveCurrentPageBreak

•	TRVStyle.SaveCSSToStream

•	TRichView.SaveHTMLToStream

•	TRichView.SaveHTMLToStreamEx

Updated (not including topics where only references were corrected):

•	RichView Paragraphs, Building RichView Document

•	Export of RichView contents to HTML, RichView Methods for Saving and Loading, Searching and Replacing,

•	RVF Overview, RVF Specification

•	TRVSearchOption

•	TRichView.SearchText

•	TRichViewEdit.SearchText

•	TRichView.IsParaStart

•	TRichView.Options

•	TRichView.RVFOptions

•	TRichView.SaveHTML

•	TRichView.SaveHTMLEx

•	TRVSaveOption

•	TRichView.SavePicture

Removed:

•	TRVStyle.SaveCSSFile


Compatibility with older versions
 TRichView Reference | Version History

Compatibility with older (freeware) versions of RichView

See compatibility issues for versions: 10, 1.9 1.8, 1.7 1.6 1.5, 1.4, 1.3, 1.2

For former users of freeware version

You can use this version of TRichView, TRVStyle, TRVPrint components in your projects started with older version.

But

•	You lose all hypertext in text styles then you open old project with new TRVStyle; this is because there were only two hypertext styles in older versions (had indices rvsJump1, rvsJump2); now any text style can be hypertext, regardless of its index. In order to fix, set Jump=True, HoverColor to TRVStyle.HoverColor for hypertext items.

•	There are some obsolete methods, but they still work. For example, all methods which in older versions added left-aligned items (AddFromNewLine), now add items with the 0th paragraph style; all methods which in older versions added center-aligned items (AddCenterLine) now add items with the 1st paragraph style. Initial values of paragraph styles: 0th paragraph is left aligned, 1th is centered by default.

•	Checkpoints are not items any more, but some additional information associated with items. Add***Checkpoint methods still work: such method appends checkpoint that will be associated with the next appended item. Therefore, you now cannot add two or more checkpoints one by one without item between them. You can choose one of two options when compiling RichView source:

o	RichView raises exception when you try to add checkpoint after checkpoint (default mode);

o	RichView ignores the second checkpoint; Add***Checkpoint*** methods will return the index of previous added checkpoint in this case; this mode is turned on by defining RVALLOWCPBYCP conditional define.

•	New version has no special design-time property editors for RVStyle.TextStyles

•	For C++Builder users: some names of methods and properties are now written in another case. "CheckPoint" is "Checkpoint" now, "HotSpot" is "Hotspot" now.


 Editing-Style Method

This method is designed for implementing editing operations. This method should not be used for document generation.

This method:

•	does nothing if ReadOnly=True;

•	quickly reformats the affected part of a document;

•	repaints window of editor;

•	calls OnChange;

•	sets Modified to True.

This method can be undone.

If LiveSpellingMode is rvlspOnChange and OnSpellingCheck event is assigned, this method starts/resumes live spelling check.

This method requires document to be formatted before its call.

This method keeps document formatted after its call.

More information...


 Editing-Style Method for Insertion

This method:

•	does nothing if ReadOnly=True;

•	deletes the selected part of the document (inserted item(s) replace the selection)

•	inserts new item(s) in the position of caret;

•	quickly reformats the affected part of the document;

•	repaints the window of editor;

•	sets Modified to True;

•	calls OnChange.

If LiveSpellingMode is rvlspOnChange and OnSpellingCheck event is assigned, this method starts/resumes live spelling check.

This method can be undone.

If the current selection was protected from deletion or modification, this method does nothing.


 Viewer-Style Method

This method is designed for document generation. This method should not be used for editing operations.

This method:

•	does not repaint the window;

•	does not check ReadOnly property (RichVew does not have this property),

•	does not call OnChange event (RichView does not have this event),

•	does not change Modified property (RichView does not have this property),

•	does not reformat the document.

This method cannot be undone.

If you call it in editor with enabled undo/redo feature, you must clear undo/redo buffers before subsequent calling of any editor-style method and allowing users to modify the document.

This method does not require the document to be formatted before its call.

In order to display the document after calling this method, you need to format it explicitly (with Format or FormatTail method).

More information...


Formatted Documents

Formatted documents can be displayed and edited. Some methods (editing-style methods) and events work only if the document is formatted and must not be called for unformatted documents.

Document becomes unformatted after calling any viewer-style method, for example AddNL (and any other Add*** methods), Clear, DeleteItems. To format it, call Format.

Document becomes formatted after calling Format. Any editor-style method requires formatted document before its call, and leaves the document formatted.

See also: Viewer vs Editor.


TRichView.AddTextBlockNLA
 TRichView Reference | TRichView

TCustomRichView.AddTextBlockNLA

Adds one or more text lines to the end of document as one paragraph.

procedure AddTextBlockNLA(s: String; StyleNo, ParaNo: Integer);

(Introduced in version 1.3)

This method is the same as AddTextNL, but adds all new text items as one paragraph (see SetAddParagraphMode): line breaks inside paragraph are used instead of paragraph breaks.

It adds the first new text item in the current add-paragraph-mode, then calls SetAddParagraphMode(False), then adds the rest of text, then restores add-paragraph-mode.

Parameters:

s is a text string to add. It may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

StyleNo is an index in the TextStyles collection of the linked RVStyle component, or rvsDefStyle constant. It defines font attributes for the text.

ParaNo is an index in the ParaStyles collection of the linked RVStyle component, must be >=0 for this method. It defines attributes for the new paragraph.

Methods type:  viewer-style.

See also methods:

•	AddTextNL, AddTextNLA, AddTextNLW;

•	AddNL;

•	AddTab;

•	Format;

•	FormatTail;

•	SetAddParagraphMode.

See also methods of TRichViewEdit:

•	InsertText, -A, -W.

See also properties of TRVStyle:

•	TextStyles;

•	SpacesInTab.

See also:

•	Other methods for appending items.


Undo of Assignment to Table Properties

Changing of value of this property can be automatically undone/redone by user if this changing was done after inserting this table into TRichViewEdit.

Undo/redo is not possible if changing was done before inserting, or if table was inserted in TRichView.

See also

•	Undo/redo in tables

•	Undo/redo in TRichViewEdit


Cell Inplace Editor

Inplace editor of table cell is a special editor (derived from TRichViewEdit) which is used for editing cell content.

This editor does not have borders and is located in place of cell, making an illusion of editing directly in the main RichViewEdit.

Inplace editor can be used only if the table is inserted in TRichViewEdit (not in TRichView)

Read more...


Cell Merging

Cell-merging is an operation on table cells. Several cells are merged in one (top left) cell.

After this operation all cells except for the top left one are destroyed (and the corresponding Cells[r,c] become equal to nil).

The top left cell has increased values of ColSpan and RowSpan properties and visually spans over the merged cells.

All rows of table have the same number of cells even after merging.

Read more...


Rules

Rules are lines between cells.

They cannot be saved to HTML and RTF.

By default rules are invisible.

Widths of rules are defined in HRuleWidth and VRuleWidth properties.

Unlike other table layout properties (BorderWidth,CellBorderWidth,BorderVSpacing, BorderHSpacing,CellVSpacing,CellHSpacing,CellPadding) rules do not affect size of the table.

It's recommended to set widths of rules to values lesser than spacing between cells.


Undo of Table Operations

This method can be automatically undone/redone by user if it was called after  inserting this table into TRichViewEdit.

Undo/redo is not possible if changing was done before inserting, or if table was inserted in TRichView.

This method does not update control view automatically, see Table operations.

See also

•	Undo/redo in tables

•	Undo/redo in TRichViewEdit


Methods for TRVListLevelCollection
TRVListLevelCollection Methods

Properties   Methods

In TRVListLevelCollection

Add

You can also use methods derived from TCollection


Legend

  viewer-style method;

  editing-style method.


Events for TCustomRVPrint
TCustomRVPrint Events

Properties   Methods   Events  |  Legend

In TCustomRVPrint

OnPrintComponent


Events for TCustomRVPrintPreview
TCustomRVPrintPreview Events

Properties   Methods   Events  |  Legend

In TCustomRVPrintPreview

OnZoomChanged

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnDblClick

OnKeyDown

OnKeyPress

OnKeyUp


Events for TDBRichView
 TDBRichView Events

Properties   Methods   Events  |  Legend

In TDBRichView

OnLoadCustomFormat

OnLoadDocument

OnNewDocument

Derived from TCustomRichView

OnAddStyle

OnCheckpointVisible

OnControlAction

OnCopy

OnGetItemCursor

OnHTMLSaveImage

OnImportPicture

OnItemAction

OnItemHint

OnJump

OnPaint

OnProgress

OnReadHyperlink

OnRVDblClick

OnRVFControlNeeded

OnRVFImageListNeeded

OnRVFPictureNeeded

OnRVMouseDown

OnRVMouseMove

OnRVMouseUp

OnRVRightClick

OnSaveComponentToFile

OnSaveHTMLExtra

OnSaveImage2

OnSaveItemToFile

OnSaveParaToHTML

OnSaveRTFExtra

OnSelect

OnSpellingCheck

OnWriteHyperlink

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnContextPopup (D5+)

OnDragDrop

OnDragOver

OnEndDrag

OnEnter

OnExit

OnKeyDown

OnKeyPress

OnKeyUp

OnMouseMove

OnMouseWheel (D4+)

OnMouseWheelDown (D4+)

OnMouseWheelUp (D4+)

OnResize (D4+)

OnStartDrag


Events for TDBRichViewEdit
 TDBRichViewEdit Events

Properties   Methods   Events  |  Legend

In TDBRichViewEdit

OnLoadCustomFormat

OnLoadDocument

OnNewDocument

OnSaveCustomFormat

Derived from TCustomRichViewEdit

OnCaretGetOut

OnCaretMove

OnChange

OnChanging

OnCurParaStyleChanged

OnCurTextStyleChanged

OnDrawCustomCaret

OnDropFiles

OnItemTextEdit

OnMeasureCustomCaret

OnOleDragEnter

OnOleDragLeave

OnOleDragOver

OnOleDrop

OnParaStyleConversion

OnPaste

OnSmartPopupClick

OnStyleConversion

Derived from TCustomRichView

OnAddStyle

OnCheckpointVisible (doesn't work in editor)

OnControlAction

OnCopy

OnGetItemCursor

OnHTMLSaveImage

OnImportPicture

OnItemAction

OnItemHint

OnJump

OnPaint

OnProgress

OnReadHyperlink

OnRVDblClick

OnRVFControlNeeded

OnRVFImageListNeeded

OnRVFPictureNeeded

OnRVMouseDown

OnRVMouseMove

OnRVMouseUp

OnRVRightClick

OnSaveComponentToFile

OnSaveHTMLExtra

OnSaveImage2

OnSaveItemToFile

OnSaveParaToHTML

OnSaveRTFExtra

OnSelect

OnSpellingCheck

OnWriteHyperlink

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnContextPopup (D5+)

OnDragDrop

OnDragOver

OnEndDrag

OnEnter

OnExit

OnKeyDown

OnKeyPress

OnKeyUp

OnMouseMove

OnMouseWheel (D4+)

OnMouseWheelDown (D4+)

OnMouseWheelUp (D4+)

OnResize (D4+)

OnStartDrag


Events for TRichView
 TRichView Events

Properties   Methods   Events  |  Legend

Derived from TCustomRichView

OnAddStyle

OnCheckpointVisible

OnControlAction

OnCopy

OnGetItemCursor

OnHTMLSaveImage

OnImportPicture

OnItemAction

OnItemHint

OnJump

OnPaint

OnProgress

OnReadHyperlink

OnRVDblClick

OnRVFControlNeeded

OnRVFImageListNeeded

OnRVFPictureNeeded

OnRVMouseDown

OnRVMouseMove

OnRVMouseUp

OnRVRightClick

OnSaveComponentToFile

OnSaveHTMLExtra

OnSaveImage2

OnSaveItemToFile

OnSaveParaToHTML

OnSaveRTFExtra

OnSelect

OnSpellingCheck

OnWriteHyperlink

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnContextPopup (D5+)

OnDragDrop

OnDragOver

OnEndDrag

OnEnter

OnExit

OnKeyDown

OnKeyPress

OnKeyUp

OnMouseMove

OnMouseWheel (D4+)

OnMouseWheelDown (D4+)

OnMouseWheelUp (D4+)

OnResize (D4+)

OnStartDrag


Events for TRichViewEdit
 TRichViewEdit Events

Properties   Methods   Events  |  Legend

Derived from TCustomRichViewEdit

OnCaretGetOut

OnCaretMove

OnChange

OnChanging

OnCurParaStyleChanged

OnCurTextStyleChanged

OnDrawCustomCaret

OnDropFiles

OnItemTextEdit

OnMeasureCustomCaret

OnOleDragEnter

OnOleDragLeave

OnOleDragOver

OnOleDrop

OnParaStyleConversion

OnPaste

OnSmartPopupClick

OnStyleConversion

Derived from TCustomRichView

OnAddStyle

OnCheckpointVisible (doesn't work in editor)

OnControlAction

OnCopy

OnGetItemCursor

OnHTMLSaveImage

OnImportPicture

OnItemAction

OnItemHint

OnJump

OnPaint

OnProgress

OnReadHyperlink

OnRVDblClick

OnRVFControlNeeded

OnRVFImageListNeeded

OnRVFPictureNeeded

OnRVMouseDown

OnRVMouseMove

OnRVMouseUp

OnRVRightClick

OnSaveComponentToFile

OnSaveHTMLExtra

OnSaveImage2

OnSaveItemToFile

OnSaveParaToHTML

OnSaveRTFExtra

OnSelect

OnSpellingCheck

OnWriteHyperlink

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnContextPopup (D5+)

OnDragDrop

OnDragOver

OnEndDrag

OnEnter

OnExit

OnKeyDown

OnKeyPress

OnKeyUp

OnMouseMove

OnMouseWheel (D4+)

OnMouseWheelDown (D4+)

OnMouseWheelUp (D4+)

OnResize (D4+)

OnStartDrag


Events for TRVOfficeConverter
 TRVOfficeConverter Events

Properties   Methods   Events  |  Legend

In TRVOfficeConverter

OnConverting


Events for TRVPrint
 TRVPrint Events

Properties   Methods   Events  |  Legend

In TRVPrint

OnFormatting

OnPagePostpaint

OnPagePrepaint

OnSendingToPrinter

Derived from TCustomRVPrint

OnPrintComponent


Events for TRVPrintPreview
 TRVPrintPreview Events

Properties   Methods   Events  |  Legend

Derived from TCustomRVPrintPreview

OnZoomChanged

Derived from TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnDblClick

OnKeyDown

OnKeyPress

OnKeyUp


Events for TRVReportHelper
 TRVReportHelper Events

Properties   Methods   Events  |  Legend

In TRVReportHelper

OnDrawCheckpoint

OnDrawHyperlink

Derived from TCustomRVPrint

OnPrintComponent


Events for TRVScroller
TRVScroller Events

Properties   Methods   Events  |  Legend

In TRVScroller

OnHScrolled

OnVScrolled

Derived from TCustomControl

OnClick

OnContextPopup (D5+)

OnDragDrop

OnDragOver

OnEndDrag

OnEnter

OnExit

OnKeyDown

OnKeyPress

OnKeyUp

OnMouseMove

OnMouseWheel (D4+)

OnMouseWheelDown (D4+)

OnMouseWheelUp (D4+)

OnResize (D4+)

OnStartDrag


Events for TRVStyle
 TRVStyle Events

Properties   Methods   Events  |  Legend

In TRVStyle

OnAfterApplyStyle

OnApplyStyle

OnApplyStyleColor

OnDrawCheckpoint

OnDrawPageBreak

OnDrawParaBack

OnDrawStyleText

OnDrawTextBack

OnStyleHoverSensitive


Events for TRVTableItemInfo
TRVTableItemInfo Events

Properties   Methods    Events  |  Legend

Since tables are not components, events cannot be assigned at design time in object inspector.

They must be assigned from code, when a table is created.

In TRVTableItemInfo

OnCellEditing

OnDrawBorder


Methods for TCustomRVFontInfo
TCustomRVFontInfo Methods

Properties   Methods

In TCustomRVFontInfo

Assign

AssignTo

Create

IsEqual


Methods for TCustomRVNoteItemInfo
TCustomRVNoteItemInfo Methods

Properties    Methods

In TCustomRVNoteItemInfo

ReplaceDocumentEd


Methods for TCustomRVParaInfo
TCustomRVParaInfo Methods

Properties   Methods

In TCustomRVParaInfo

Assign

Create

IsEqual


Methods for TCustomRVPrint
TCustomRVPrint Methods

Properties   Methods   Events

In TCustomRVPrint

Clear

GetFirstItemOnPage

UpdatePaletteInfo


Methods for TCustomRVPrintPreview
TCustomRVPrintPreview Methods

Properties   Methods   Events

In TCustomRVPrintPreview

Create

First

Last

Next

Prev

SetZoom

Derived from TRVScroller

ScrollTo (not used in this component)


Methods for TDBRichView
 TDBRichView Methods

Properties   Methods   Events  |  Legend

In TDBRichView

Create

Destroy

LoadField

Derived from TCustomRichView

AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag

AddBulletEx, AddBulletsExTag

AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag

AddControlEx, AddControlExTag

AddFmt

AddHotPicture, AddHotPictureTag

AddHotspotEx, AddHotspotExTag

AddItem

AddNLTag -A -W, AddTag, AddNL, Add

AddPictureEx, AddPictureExTag

AddTab

AddTextNL -A -W

AppendFrom

AppendRVFFromStream

AssignSoftPageBreaks

BeginOleDrag

Clear

ClearLiveSpellingResults

ClearSoftPageBreaks

ClientToDocument

Copy

CopyDef

CopyImage

CopyRTF

CopyRVF

CopyText -A -W

Create

DeleteItems

DeleteMarkedStyles

DeleteParas

DeleteSection

DeleteUnusedStyles

Deselect

Destroy

FindCheckPointByName

FindCheckPointByTag

FindControlItemNo

Format

FormatTail

GetBreakInfo

GetBulletInfo

GetCheckpointByNo

GetCheckpointInfo

GetCheckpointItemNo

GetCheckpointNo

GetCheckpointXY

GetCheckpointY

GetCheckpointYEx

GetControlInfo

GetFirstCheckpoint

GetFocusedItem

GetHotspotInfo

GetItem

GetItemAt

GetItemCheckpoint

GetItemClientCoords

GetItemCoords

GetItemExtraIntProperty

GetItemExtraStrProperty

GetItemNo

GetItemPara

GetItemStyle

GetItemTag

GetItemText -A -W

GetItemVAlign

GetJumpPointItemNo

GetJumpPointLocation

GetJumpPointY

GetLastCheckpoint

GetLineNo

GetListMarkerInfo

GetNextCheckpoint

GetOffsAfterItem

GetOffsBeforeItem

GetPictureInfo

GetPrevCheckpoint

GetSelectedImage

GetSelectionBounds

GetSelText -W

GetTextInfo

GetWordAt -A -W

InsertRVFFromStream

IsFromNewLine

IsParaStart

LiveSpellingValidateWord

LoadFromStream

LoadRTF

LoadRTFFromStream

LoadRVF

LoadRVFFromStream

LoadText -W

LoadTextFromStream -W

MarkStylesInUse

RefreshListMarkers

Reformat

RemoveCheckpoint

ResetAnimation

SaveHTML

SaveHTMLEx

SaveHTMLToStream

SaveHTMLToStreamEx

SavePicture

SaveRTF

SaveRTFToStream

SaveRVF

SaveRVFToStream

SaveText -W

SaveTextToStream -W

SearchText -A -W

SelectAll

SelectControl

SelectionExists

SelectWordAt

SetAddParagraphMode

SetBreakInfo

SetBulletInfo

SetCheckpointInfo

SetControlInfo

SetHotspotInfo

SetItemExtraIntProperty

SetItemExtraStrProperty

SetItemTag

SetItemText -A -W

SetItemVAlign

SetListMarkerInfo

SetPictureInfo

SetSelectionBounds

StartAnimation

StartLiveSpelling

StopAnimation

UpdatePaletteInfo

Derived from TRVScroller

ScrollTo


Methods for TDBRichViewEdit
 TDBRichViewEdit Methods

Properties   Methods   Events  |  Legend

In TDBRichViewEdit

Change

Create

Destroy

LoadField

Derived from TCustomRichViewEdit

AdjustControlPlacement

AdjustControlPlacement2

ApplyListStyle

ApplyParaStyle

ApplyParaStyleConversion

ApplyStyleConversion

ApplyTextStyle

BeginItemModify

BeginUndoCustomGroup

BeginUndoGroup

BeginUpdate

CanChange

CanPaste

CanPasteRTF

CanPasteRVF

Change

ChangeListLevels

Clear

ClearTextFlow

ClearUndo

ConvertToHotPicture

ConvertToPicture

Create

CutDef

DeleteSelection

Destroy

EndItemModify

EndUpdate

GetCheckpointAtCaret

GetCurrentBreakInfo

GetCurrentBulletInfo

GetCurrentCheckpoint

GetCurrentControlInfo

GetCurrentHotspotInfo

GetCurrentItemExtraIntProperty

GetCurrentItemExtraStrProperty

GetCurrentItem

GetCurrentItemEx

GetCurrentItemText -A -W

GetCurrentItemVAlign

GetCurrentLineCol

GetCurrentMisspelling

GetCurrentPictureInfo

GetCurrentTag

GetCurrentTextInfo

InsertBreak

InsertBullet

InsertCheckpoint

InsertControl

InsertHotPicture

InsertHotspot

InsertItem

InsertOEMTextFromFile

InsertPageBreak

InsertPicture

InsertRTFFromFileEd

InsertRTFFromStreamEd

InsertRVFFromFileEd

InsertRVFFromStreamEd

InsertStringTag -A -W

InsertTab

InsertText -A -W

InsertTextFromFile -W

Paste

PasteBitmap

PasteGraphicFile

PasteMetafile

PasteRTF

PasteRVF

PasteText -A -W

Redo

RedoAction

RedoName

RemoveCheckpointAtCaret

RemoveCheckpointEd

RemoveCurrentCheckpoint

RemoveCurrentPageBreak

RemoveLists

ResizeControl

ResizeCurrentControl

SearchText -A -W

SelectCurrentLine

SelectCurrentWord

SetBreakInfoEd

SetBulletInfoEd

SetCheckpointInfoEd

SetControlInfoEd

SetCurrentBreakInfo

SetCurrentBulletInfo

SetCurrentCheckpointInfo

SetCurrentControlInfo

SetCurrentHotspotInfo

SetCurrentItemExtraIntProperty

SetCurrentItemExtraStrProperty

SetCurrentItemText -A -W

SetCurrentItemVAlign

SetCurrentPictureInfo

SetCurrentTag

SetHotspotInfoEd

SetItemExtraIntPropertyEd

SetItemExtraStrPropertyEd

SetItemTagEd

SetItemTextEd -A -W

SetItemVAlignEd

SetPictureInfoEd

SetUndoGroupMode

Undo

UndoAction

UndoName

Derived from TCustomRichView

AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag

AddBulletEx, AddBulletsExTag

AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag

AddControlEx, AddControlExTag

AddFmt

AddHotPicture, AddHotPictureTag

AddHotspotEx, AddHotspotExTag

AddItem

AddNLTag -A -W, AddTag, AddNL, Add

AddPictureEx, AddPictureExTag

AddTab

AddTextNL -A -W

AppendFrom

AppendRVFFromStream

AssignSoftPageBreaks

BeginOleDrag

Clear

ClearLiveSpellingResults

ClearSoftPageBreaks

ClientToDocument

Copy

CopyDef

CopyImage

CopyRTF

CopyRVF

CopyText -A -W

Create

DeleteItems

DeleteMarkedStyles

DeleteParas

DeleteSection

DeleteUnusedStyles

Deselect

Destroy

FindCheckPointByName

FindCheckPointByTag

FindControlItemNo

Format

FormatTail

GetBreakInfo

GetBulletInfo

GetCheckpointByNo

GetCheckpointInfo

GetCheckpointItemNo

GetCheckpointNo

GetCheckpointXY

GetCheckpointY

GetCheckpointYEx

GetControlInfo

GetFirstCheckpoint

GetFocusedItem

GetHotspotInfo

GetItem

GetItemAt

GetItemCheckpoint

GetItemClientCoords

GetItemCoords

GetItemExtraIntProperty

GetItemExtraStrProperty

GetItemNo

GetItemPara

GetItemStyle

GetItemTag

GetItemText -A -W

GetItemVAlign

GetJumpPointItemNo

GetJumpPointLocation

GetJumpPointY

GetLastCheckpoint

GetLineNo

GetListMarkerInfo

GetNextCheckpoint

GetOffsAfterItem

GetOffsBeforeItem

GetPictureInfo

GetPrevCheckpoint

GetSelectedImage

GetSelectionBounds

GetSelText -W

GetTextInfo

GetWordAt -A -W

InsertRVFFromStream

IsFromNewLine

IsParaStart

LiveSpellingValidateWord

LoadFromStream

LoadRTF

LoadRTFFromStream

LoadRVF

LoadRVFFromStream

LoadText -W

LoadTextFromStream -W

MarkStylesInUse

RefreshListMarkers

Reformat

ResetAnimation

RemoveCheckpoint

SaveHTML

SaveHTMLEx

SaveHTMLToStream

SaveHTMLToStreamEx

SavePicture

SaveRTF

SaveRTFToStream

SaveRVF

SaveRVFToStream

SaveText -W

SaveTextToStream -W

SearchText -A -W

SelectAll

SelectControl

SelectionExists

SelectWordAt

SetAddParagraphMode

SetBreakInfo

SetBulletInfo

SetCheckpointInfo

SetControlInfo

SetHotspotInfo

SetItemExtraIntProperty

SetItemExtraStrProperty

SetItemTag

SetItemText -A -W

SetItemVAlign

SetListMarkerInfo

SetPictureInfo

SetSelectionBounds

StartAnimation

StartLiveSpelling

StopAnimation

UpdatePaletteInfo

Derived from TRVScroller

ScrollTo


Methods for TFontInfo
TFontInfo Methods

Properties   Methods

In TFontInfo

Assign

Create

IsEqual

Derived from TCustomRVFontInfo

AssignTo


Methods for TFontInfos
TFontInfos Methods

Properties   Methods

In TFontInfos

Add

Create

FindStyleWithCharset

FindStyleWithColor

FindStyleWithFont

FindStyleWithFontName

FindStyleWithFontSize

FindStyleWithFontStyle

FindSuchStyle

Derived from TCustomRVInfos

AssignTo

You can also use methods derived from TCollection


Methods for TParaInfo
TParaInfo Methods

Properties   Methods

In TParaInfo

Assign

Create

IsEqual


Methods for TParaInfos
TParaInfos Methods

Properties   Methods

In TParaInfos

Add

Create

FindStyleWithAlignment

FindSuchStyle

Derived from TCustomRVInfos

AssignTo

You can also use methods derived from TCollection


Methods for TRichView
 TRichView Methods

Properties   Methods   Events  |  Legend

Derived from TCustomRichView

AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag

AddBulletEx, AddBulletsExTag

AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag

AddControlEx, AddControlExTag

AddFmt

AddHotPicture, AddHotPictureTag

AddHotspotEx, AddHotspotExTag

AddItem

AddNLTag -A -W, AddTag, AddNL, Add

AddPictureEx, AddPictureExTag

AddTab

AddTextNL -A -W

AppendFrom

AppendRVFFromStream

AssignSoftPageBreaks

BeginOleDrag

Clear

ClearLiveSpellingResults

ClearSoftPageBreaks

ClientToDocument

Copy

CopyDef

CopyImage

CopyRTF

CopyRVF

CopyText -A -W

Create

DeleteItems

DeleteMarkedStyles

DeleteParas

DeleteSection

DeleteUnusedStyles

Deselect

Destroy

FindCheckPointByName

FindCheckPointByTag

FindControlItemNo

Format

FormatTail

GetBreakInfo

GetBulletInfo

GetCheckpointByNo

GetCheckpointInfo

GetCheckpointItemNo

GetCheckpointNo

GetCheckpointXY

GetCheckpointY

GetCheckpointYEx

GetControlInfo

GetFirstCheckpoint

GetFocusedItem

GetHotspotInfo

GetItem

GetItemAt

GetItemCheckpoint

GetItemClientCoords

GetItemCoords

GetItemExtraIntProperty

GetItemExtraStrProperty

GetItemNo

GetItemPara

GetItemStyle

GetItemTag

GetItemText -A -W

GetItemVAlign

GetJumpPointItemNo

GetJumpPointLocation

GetJumpPointY

GetLastCheckpoint

GetLineNo

GetListMarkerInfo

GetNextCheckpoint

GetOffsAfterItem

GetOffsBeforeItem

GetPictureInfo

GetPrevCheckpoint

GetSelectedImage

GetSelectionBounds

GetSelText -W

GetTextInfo

GetWordAt -A -W

InsertRVFFromStream

IsFromNewLine

IsParaStart

LiveSpellingValidateWord

LoadFromStream

LoadRTF

LoadRTFFromStream

LoadRVF

LoadRVFFromStream

LoadText -W

LoadTextFromStream -W

MarkStylesInUse

RefreshListMarkers

Reformat

RemoveCheckpoint

ResetAnimation

SaveHTML

SaveHTMLEx

SaveHTMLToStream

SaveHTMLToStreamEx

SavePicture

SaveRTF

SaveRTFToStream

SaveRVF

SaveRVFToStream

SaveText -W

SaveTextToStream -W

SearchText -A -W

SelectAll

SelectControl

SelectionExists

SelectWordAt

SetAddParagraphMode

SetBreakInfo

SetBulletInfo

SetCheckpointInfo

SetControlInfo

SetHotspotInfo

SetItemExtraIntProperty

SetItemExtraStrProperty

SetItemTag

SetItemText -A -W

SetItemVAlign

SetListMarkerInfo

SetPictureInfo

SetSelectionBounds

StartAnimation

StartLiveSpelling

StopAnimation

UpdatePaletteInfo

Derived from TRVScroller

ScrollTo


Methods for TRichViewEdit
 TRichViewEdit Methods

Properties   Methods   Events  |  Legend

Derived from TCustomRichViewEdit

AdjustControlPlacement

AdjustControlPlacement2

ApplyListStyle

ApplyParaStyle

ApplyParaStyleConversion

ApplyStyleConversion

ApplyTextStyle

BeginItemModify

BeginUndoCustomGroup

BeginUndoGroup

BeginUpdate

CanChange

CanPaste

CanPasteRTF

CanPasteRVF

Change

ChangeListLevels

Clear

ClearTextFlow

ClearUndo

ConvertToHotPicture

ConvertToPicture

Create

CutDef

DeleteSelection

Destroy

EndItemModify

EndUpdate

GetCheckpointAtCaret

GetCurrentBreakInfo

GetCurrentBulletInfo

GetCurrentCheckpoint

GetCurrentControlInfo

GetCurrentHotspotInfo

GetCurrentItemExtraIntProperty

GetCurrentItemExtraStrProperty

GetCurrentItem

GetCurrentItemEx

GetCurrentItemText -A -W

GetCurrentItemVAlign

GetCurrentLineCol

GetCurrentMisspelling

GetCurrentPictureInfo

GetCurrentTag

GetCurrentTextInfo

InsertBreak

InsertBullet

InsertCheckpoint

InsertControl

InsertHotPicture

InsertHotspot

InsertItem

InsertOEMTextFromFile

InsertPageBreak

InsertPicture

InsertRTFFromFileEd

InsertRTFFromStreamEd

InsertRVFFromFileEd

InsertRVFFromStreamEd

InsertStringTag -A -W

InsertTab

InsertText -A -W

InsertTextFromFile -W

Paste

PasteBitmap

PasteGraphicFile

PasteMetafile

PasteRTF

PasteRVF

PasteText -A -W

Redo

RedoAction

RedoName

RemoveCheckpointAtCaret

RemoveCheckpointEd

RemoveCurrentCheckpoint

RemoveCurrentPageBreak

RemoveLists

ResizeControl

ResizeCurrentControl

SearchText -A -W

SelectCurrentLine

SelectCurrentWord

SetBreakInfoEd

SetBulletInfoEd

SetCheckpointInfoEd

SetControlInfoEd

SetCurrentBreakInfo

SetCurrentBulletInfo

SetCurrentCheckpointInfo

SetCurrentControlInfo

SetCurrentHotspotInfo

SetCurrentItemExtraIntProperty

SetCurrentItemExtraStrProperty

SetCurrentItemText -A -W

SetCurrentItemVAlign

SetCurrentPictureInfo

SetCurrentTag

SetHotspotInfoEd

SetItemExtraIntPropertyEd

SetItemExtraStrPropertyEd

SetItemTagEd

SetItemTextEd -A -W

SetItemVAlignEd

SetPictureInfoEd

SetUndoGroupMode

Undo

UndoAction

UndoName

Derived from TCustomRichView

AddBreak, AddBreakEx, AddBreakExTag, AddBreakTag

AddBulletEx, AddBulletsExTag

AddCheckpoint, AddCheckpointTag, AddNamedCheckpoint, AddNamedCheckpointEx, AddNamedCheckpointExTag

AddControlEx, AddControlExTag

AddFmt

AddHotPicture, AddHotPictureTag

AddHotspotEx, AddHotspotExTag

AddItem

AddNLTag -A -W, AddTag, AddNL, Add

AddPictureEx, AddPictureExTag

AddTab

AddTextNL -A -W

AppendFrom

AppendRVFFromStream

AssignSoftPageBreaks

BeginOleDrag

Clear

ClearLiveSpellingResults

ClearSoftPageBreaks

ClientToDocument

Copy

CopyDef

CopyImage

CopyRTF

CopyRVF

CopyText -A -W

Create

DeleteItems

DeleteMarkedStyles

DeleteParas

DeleteSection

DeleteUnusedStyles

Deselect

Destroy

FindCheckPointByName

FindCheckPointByTag

FindControlItemNo

Format

FormatTail

GetBreakInfo

GetBulletInfo

GetCheckpointByNo

GetCheckpointInfo

GetCheckpointItemNo

GetCheckpointNo

GetCheckpointXY

GetCheckpointY

GetCheckpointYEx

GetControlInfo

GetFirstCheckpoint

GetFocusedItem

GetHotspotInfo

GetItem

GetItemAt

GetItemCheckpoint

GetItemClientCoords

GetItemCoords

GetItemExtraIntProperty

GetItemExtraStrProperty

GetItemNo

GetItemPara

GetItemStyle

GetItemTag

GetItemText -A -W

GetItemVAlign

GetJumpPointItemNo

GetJumpPointLocation

GetJumpPointY

GetLastCheckpoint

GetLineNo

GetListMarkerInfo

GetNextCheckpoint

GetOffsAfterItem

GetOffsBeforeItem

GetPictureInfo

GetPrevCheckpoint

GetSelectedImage

GetSelectionBounds

GetSelText -W

GetTextInfo

GetWordAt -A -W

InsertRVFFromStream

IsFromNewLine

IsParaStart

LiveSpellingValidateWord

LoadFromStream

LoadRTF

LoadRTFFromStream

LoadRVF

LoadRVFFromStream

LoadText -W

LoadTextFromStream -W

MarkStylesInUse

RefreshListMarkers

Reformat

RemoveCheckpoint

ResetAnimation

SaveHTML

SaveHTMLEx

SaveHTMLToStream

SaveHTMLToStreamEx

SavePicture

SaveRTF

SaveRTFToStream

SaveRVF

SaveRVFToStream

SaveText -W

SaveTextToStream -W

SearchText -A -W

SelectAll

SelectControl

SelectionExists

SelectWordAt

SetAddParagraphMode

SetBreakInfo

SetBulletInfo

SetCheckpointInfo

SetControlInfo

SetHotspotInfo

SetItemExtraIntProperty

SetItemExtraStrProperty

SetItemTag

SetItemText -A -W

SetItemVAlign

SetListMarkerInfo

SetPictureInfo

SetSelectionBounds

StartAnimation

StartLiveSpelling

StopAnimation

UpdatePaletteInfo

Derived from TRVScroller

ScrollTo


Methods for TRVDocParameters
TRVDocParameters Methods

Properties    Methods

In TRVDocParameters

ConvertToUnits

Reset

ResetLayout

UnitsPerInch


Methods for TRVEndnoteItemInfo
TRVEndnoteItemInfo Methods

Properties    Methods

In TRVEndnoteItemInfo

Create

CreateEx

Inherited from TCustomRVNoteItemInfo

ReplaceDocumentEd


Methods for TRVFootnoteItemInfo
TRVFootnoteItemInfo Methods

Properties    Methods

In TRVFootnoteItemInfo

Create

CreateEx

Inherited from TCustomRVNoteItemInfo

ReplaceDocumentEd


Methods for TRVLabelItemInfo
TRVLabelItemInfo Methods

Properties   Methods

In TRVLabelItemInfo

Create

CreateEx


Methods for TRVListInfo
TRVListInfo Methods

Properties   Methods

In TRVListInfo

AllNumbered

HasNumbering


Methods for TRVListInfos
TRVListInfos Methods

Properties   Methods

In TRVListInfos

Add

FindStyleWithLevels

FindSuchStyle

Derived from TCustomRVInfos

AssignTo

You can also use methods derived from TCollection


Methods for TRVListLevel
TRVListLevel Methods

Properties   Methods

In TRVListLevel

HasNumbering


Methods for TRVNoteReferenceItemInfo
TRVNoteReferenceItemInfo Methods

Properties    Methods

In TRVNoteReferenceItemInfo

Create

CreateEx


Methods for TRVOfficeConverter
 TRVOfficeConverter Methods

Properties   Methods   Events

In TRVOfficeConverter

Create

Destroy

ExportRTF

ExportRV

GetExportFilter

GetImportFilter

ImportRTF

ImportRV

IsValidImporter


Methods for TRVPrint
 TRVPrint Methods

Properties   Methods   Events

In TRVPrint

AssignDocParameters

AssignSource

ContinuousPrint

Create

DrawPreview

FormatPages

GetFooterRect

GetHeaderRect

MakePreview

MakeScaledPreview

Print

PrintPages

SetFooter

SetHeader

Derived from TCustomRVPrint

Clear

GetFirstItemOnPage

UpdatePaletteInfo


Methods for TRVPrintPreview
 TRVPrintPreview Methods

Properties   Methods   Events

Derived from TCustomRVPrintPreview

Create

First

Last

Next

Prev

SetZoom

Derived from TRVScroller

ScrollTo (not used in this component)


Methods for TRVReportHelper
 TRVReportHelper Methods

Properties   Methods   Events

In TRVReportHelper

DrawPage

DrawPageAt

Finished

FormatNextPage

GetLastPageHeight

Init

Derived from TCustomRVPrint

Clear

GetFirstItemOnPage

UpdatePaletteInfo


Methods for TRVRTFReaderProperties
TRVRTFReaderProperties Methods

Properties    Methods

In TRVRTFReaderProperties

SetFooter

SetHeader


Methods for TRVScroller
TRVScroller Methods

Properties   Methods   Events

In TRVScroller

Create

ScrollTo


Methods for TRVSeqItemInfo
TRVSeqItemInfo Methods

Properties   Methods

In TRVSeqItemInfo

Create

CreateEx


Methods for TRVSmartPopupProperties
TRVSmartPopupProperties Methods

Properties   Methods

In TRVSmartPopupProperties

SetButtonState


Methods for TRVStyle
 TRVStyle Methods

Properties   Methods   Events

In TRVStyle

AddTextStyle (deprecated)

Create

DeleteTextStyle (deprecated)

Destroy

GetListStyleClass

GetParaStyleClass

GetTextStyleClass

LoadINI

LoadReg (D4+)

SaveCSS

SaveCSSToStream

SaveINI

SaveReg (D4+)


Methods for TRVTabInfos
TRVTabInfos Methods

Properties   Methods

In TRVTabInfos

AddFrom

DeleteList

Find

Intersect

You can also use methods derived from TCollection


Methods for TRVTableCellData
TRVTableCellData Methods

Properties   Methods

Inherited from TRVItemFormattedData

Edit

GetOriginEx

GetSourceRVData

Also read here

In TRVTableCellData

GetRVData


Methods for TRVTableItemInfo
TRVTableItemInfo Methods

Properties   Methods    Events

In TRVTableItemInfo

AssignProperties

CanMergeCells

CanMergeSelectedCells

Changed

Create

CreateEx

DeleteCols

DeleteEmptyCols

DeleteEmptyRows

DeleteRows

DeleteSelectedRows

DeleteSelectedCols

Deselect

Destroy

EditCell

GetCellAt

GetEditedCell

GetNormalizedSelectionBounds

GetSelectionBounds

InsertCols

InsertColsLeft

InsertColsRight

InsertRows

InsertRowsAbove

InsertRowsBelow

IsCellSelected

LoadFromStream

MergeCells

MergeSelectedCells

SaveRowsToStream

SaveToStream

Select

SelectCols

SelectRows

SetCellBackgroundImage

SetCellBackgroundImageFileName

SetCellBackgroundStyle

SetCellBestHeight

SetCellBestWidth

SetCellBorderColor

SetCellBorderLightColor

SetCellColor

SetCellHint

SetCellVAlign

SetCellVisibleBorders

SetRowVAlign

SetTableVisibleBorders

SplitSelectedCellsHorizontally

SplitSelectedCellsVertically

UnmergeCells

UnmergeSelectedCells


Methods for TRVTableRow
TRVTableRow Methods

Properties   Methods

(please do not call methods of TRVTableRow directly)


Methods for TRVTableRows
TRVTableRows Methods

Properties   Methods

In TRVTableRows

GetMainCell

(please do not call other methods of TRVTableRows directly)


Properties for TCustomRVFontInfo
TCustomRVFontInfo Properties

Properties   Methods  |  Legend

In TCustomRVFontInfo

BackColor

BiDiMode

CharScale

Charset (D3+)

CharSpacing

Color

FontName

HoverBackColor

HoverColor

HoverEffects

HoverUnderlineColor

Jump

JumpCursor

Options

Protection

Size

Style

StyleEx

SubSuperScriptType

UnderlineColor

UnderlineType

VShift

Derived from TCustomRVInfo

Standard

StyleName


Properties for TCustomRVInfo
TCustomRVInfo Properties

Properties  |  Legend

In TCustomRVInfo

Standard

StyleName


Properties for TCustomRVNoteItemInfo
TCustomRVNoteItemInfo Properties

Properties    Methods  |  Legend

In TCustomRVNoteItemInfo

Document

Inherited from TRVSeqItemInfo

FormatString

NumberType

Reset

SeqName

StartFrom

Inherited from TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

Text

TextStyleNo


Properties for TCustomRVParaInfo
TCustomRVParaInfo Properties

Properties   Methods  |  Legend

In TCustomRVParaInfo

Alignment

Background

BiDiMode

Border

FirstIndent

LineSpacing

LineSpacingType

LeftIndent

Options

OutlineLevel

RightIndent

SpaceAfter

SpaceBefore

Tabs

Derived from TCustomRVInfo

Standard

StyleName


Properties for TCustomRVPrint
TCustomRVPrint Properties

Properties   Methods   Events  |  Legend

In TCustomRVPrint

ColorMode

EndAt

PagesCount

PreviewCorrection

StartAt

TransparentBackground


Properties for TCustomRVPrintPreview
TCustomRVPrintPreview Properties

Properties   Methods   Events  |  Legend

In TCustomRVPrintPreview

ClickMode

Color

MarginsPen

PageBorderColor

PageBorderWidth

PageNo

PrintableAreaPen

ShadowColor

ShadowWidth

ZoomInCursor

ZoomMode

ZoomOutCursor

ZoomPercent

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor (not used in this component)

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TDBRichView
 TDBRichView Properties

Properties   Methods   Events  |  Legend

In TDBRichView

AutoDisplay

DataField

DataSource

Field

Derived from TCustomRichView

AllowSelection (deprecated)

AnimationMode

BackgroundBitmap

BackgroundStyle

BiDiMode

BottomMargin

ClearLeft

ClearRight

Color

CPEventKind

Cursor

Delimiters

DocParameters

DocProperties

DocumentHeight

DoInPaletteMode

FirstItemVisible

FirstJumpNo

ItemCount

LastItemVisible

LeftMargin

MaxLength

MaxTextWidth

MinTextWidth

Options

PageBreaksBeforeItems

RightMargin

RTFOptions

RTFReadProperties

RVData

RVFOptions

RVFParaStylesReadMode

RVFTextStylesReadMode

RVFWarnings

SingleClick (deprecated)

Style

TabNavigation

TopMargin

VAlign

VSmallStep

WordWrap

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TDBRichViewEdit
 TDBRichViewEdit Properties

Properties   Methods   Events  |  Legend

In TDBRichViewEdit

AutoDeleteUnusedStyles

AutoDisplay

DataField

DataSource

Field

FieldFormat

IgnoreEscape

ReadOnly

Derived from TCustomRichViewEdit

AcceptDragDropFormats

ActualCurTextStyleNo

CurItemNo

CurItemStyle

CurParaStyleNo

CurTextStyleNo

CustomCaretInterval

EditorOptions

LiveSpellingMode

Modified

OffsetInCurItem

ReadOnly

SmartPopupProperties

SmartPopupVisible

TopLevelEditor

UndoLimit

Derived from TCustomRichView

AllowSelection (deprecated)

AnimationMode

BackgroundBitmap

BackgroundStyle

BiDiMode

BottomMargin

ClearLeft

ClearRight

Color

CPEventKind

Cursor

Delimiters

DocParameters

DocProperties

DocumentHeight

DoInPaletteMode

FirstItemVisible

FirstJumpNo

ItemCount

LastItemVisible

LeftMargin

MaxLength

MaxTextWidth

MinTextWidth

Options

PageBreaksBeforeItems

RightMargin

RTFOptions

RTFReadProperties

RVData

RVFOptions

RVFParaStylesReadMode

RVFTextStylesReadMode

RVFWarnings

SingleClick (deprecated)

Style

TabNavigation

TopMargin

VAlign

VSmallStep

WordWrap

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TFontInfo
TFontInfo Properties

Properties   Methods  |  Legend

In TFontInfo

NextStyleNo

Unicode

Derived from TCustomRVFontInfo

BackColor

BiDiMode

CharScale

Charset (D3+)

CharSpacing

Color

FontName

HoverBackColor

HoverColor

HoverEffects

HoverUnderlineColor

Jump

JumpCursor

Options

Protection

Size

Style

StyleEx

SubSuperScriptType

UnderlineColor

UnderlineType

VShift

Derived from TCustomRVInfo

Standard

StyleName


Properties for TFontInfos
TFontInfos Properties

Properties   Methods

In TFontInfos

InvalidItem

Items

Derived from TCollection

Count


Properties for TParaInfo
TParaInfo Properties

Properties   Methods  |  Legend

In TParaInfo

DefStyleNo

NextParaNo

Derived from TCustomRVParaInfo

Alignment

Background

BiDiMode

Border

FirstIndent

LineSpacing

LineSpacingType

LeftIndent

Options

RightIndent

SpaceAfter

SpaceBefore

Tabs

Derived from TCustomRVInfo

Standard

StyleName


Properties for TParaInfos
TParaInfos Properties

Properties   Methods

In TParaInfos

InvalidItem

Items

Derived from TCollection

Count


Properties for TRichView
 TRichView Properties

Properties   Methods   Events  |  Legend

Derived from TCustomRichView

AllowSelection (deprecated)

AnimationMode

BackgroundBitmap

BackgroundStyle

BiDiMode

BottomMargin

ClearLeft

ClearRight

Color

CPEventKind

Cursor

Delimiters

DocParameters

DocProperties

DocumentHeight

DoInPaletteMode

FirstItemVisible

FirstJumpNo

ItemCount

LastItemVisible

LeftMargin

MaxLength

MaxTextWidth

MinTextWidth

NoteText

Options

PageBreaksBeforeItems

RightMargin

RTFOptions

RTFReadProperties

RVData

RVFOptions

RVFParaStylesReadMode

RVFTextStylesReadMode

RVFWarnings

SingleClick (deprecated)

Style

TabNavigation

TopMargin

VAlign

VSmallStep

WordWrap

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TRichViewEdit
 TRichViewEdit Properties

Properties   Methods   Events  |  Legend

Derived from TCustomRichViewEdit

AcceptDragDropFormats

ActualCurTextStyleNo

CurItemNo

CurItemStyle

CurParaStyleNo

CurTextStyleNo

CustomCaretInterval

EditorOptions

LiveSpellingMode

Modified

OffsetInCurItem

ReadOnly

SmartPopupProperties

SmartPopupVisible

TopLevelEditor

UndoLimit

Derived from TCustomRichView

AllowSelection (deprecated)

AnimationMode

BackgroundBitmap

BackgroundStyle

BiDiMode

BottomMargin

ClearLeft

ClearRight

Color

CPEventKind

Cursor

Delimiters

DocParameters

DocProperties

DocumentHeight

DoInPaletteMode

FirstItemVisible

FirstJumpNo

ItemCount

LastItemVisible

LeftMargin

MaxLength

MaxTextWidth

MinTextWidth

Options

PageBreaksBeforeItems

RightMargin

RTFOptions

RTFReadProperties

RVData

RVFOptions

RVFParaStylesReadMode

RVFTextStylesReadMode

RVFWarnings

SingleClick (deprecated)

Style

TabNavigation

TopMargin

VAlign

VSmallStep

WordWrap

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TRVBackgroundRect
TRVBackgroundRect Properties

Properties  |  Legend

In TRVBackgroundRect

BorderOffsets

Color


Properties for TRVBorder
TRVBorder Properties

Properties  |  Legend

In TRVBorder

BorderOffsets

Color

InternalWidth

Style

VisibleBorders

Width


Properties for TRVDocParameters
TRVDocParameters Properties

Properties    Methods  |  Legend

In TRVDocParameters

BottomMargin

FooterY

HeaderY

LeftMargin

MirrorMargins

Orientation

PageHeight

PageWidth

Reset

ResetLayout

RightMargin

TopMargin

Units

UnitsPerInch

ZoomMode

ZoomPercent


Properties for TRVEndnoteItemInfo
TRVEndnoteItemInfo Properties

Properties    Methods  |  Legend

Inherited from TCustomRVNoteItemInfo

Document

Inherited from TRVSeqItemInfo

FormatString

NumberType

Reset

SeqName

StartFrom

Inherited from TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

Text

TextStyleNo


Properties for TRVFootnoteItemInfo
TRVFootnoteItemInfo Properties

Properties    Methods  |  Legend

Inherited from TCustomRVNoteItemInfo

Document

Inherited from TRVSeqItemInfo

FormatString

NumberType

Reset

SeqName

StartFrom

Inherited from TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

Text

TextStyleNo


Properties for TRVLabelItemInfo
TRVLabelItemInfo Properties

Properties   Methods

In TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

RemoveInternalLeading

Text

TextStyleNo


Properties for TRVListInfo
TRVListInfo Properties

Properties   Methods  |  Legend

In TRVListInfo

Levels

OneLevelPreview

Derived from TCustomRVInfo

Standard

StyleName


Properties for TRVListInfos
TRVListInfos Properties

Properties   Methods

In TRVListInfos

Items

Derived from TCollection

Count


Properties for TRVListLevel
TRVListLevel Properties

Properties   Methods  |  Legend

In TRVListLevel

FirstIndent

Font

FormatString

FormatStringW

ImageIndex

ImageList

LeftIndent

ListType

MarkerAlignment

MarkerIndent

Options

Picture

StartFrom


Properties for TRVListLevelCollection
TRVListLevelCollection Properties

Properties   Methods

In TRVListLevelCollection

Items

Derived from TCollection

Count


Properties for TRVNoteReferenceItemInfo
TRVNoteReferenceItemInfo Properties

Properties    Methods  |  Legend

Inherited from TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

Text

TextStyleNo


Properties for TRVOfficeConverter
 TRVOfficeConverter Properties

Properties   Methods   Events  |  Legend

In TRVOfficeConverter

ErrorCode

ExcludeHTMLExportConverter

ExcludeHTMLImportConverter

ExportConverters

ExtensionsInFilter

ImportConverters

PreviewMode

Stream


Properties for TRVPrint
 TRVPrint Properties

Properties   Methods   Events  |  Legend

In TRVPrint

BottomMarginMM

ClipMargins

FixMarginsMode

FooterYMM

HeaderYMM

LeftMarginMM

MirrorMargins

Preview100PercentHeight

Preview100PercentWidth

RightMarginMM

TopMarginMM

Derived from TCustomRVPrint

ColorMode

EndAt

PagesCount

PreviewCorrection

TransparentBackground


Properties for TRVPrintPreview
 TRVPrintPreview Properties

Properties   Methods   Events  |  Legend

In TRVPrintPreview

RVPrint

Derived from TCustomRVPrintPreview

ClickMode

Color

MarginsPen

PageBorderColor

PageBorderWidth

PageNo

PrintableAreaPen

ShadowColor

ShadowWidth

ZoomInCursor

ZoomMode

ZoomOutCursor

ZoomPercent

Derived from TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor (not used in this component)

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TRVReportHelper
 TRVReportHelper Properties

Properties   Methods   Events  |  Legend

In TRVReportHelper

RichView

Derived from TCustomRVPrint

ColorMode

EndAt

PagesCount

PreviewCorrection

TransparentBackground


Properties for TRVRTFReaderProperties
TRVRTFReaderProperties Properties

Properties    Methods  |  Legend

In TRVRTFReaderProperties

AutoHideTableGridLines

BasePathLinks

CharsetForUnicode

ConvertHighlight

ErrorCode

ExtractMetafileBitmaps

FooterYMM

HeaderYMM

IgnoreBookmarks

IgnoreNotes

IgnorePictures

IgnoreSequences

IgnoreTables

LineBreaksAsParagraphs

ParaStyleMode

ParaStyleNo

ReadDocParameters

SkipHiddenText

StoreImagesFileNames

TextStyleMode

TextStyleNo

UnicodeMode

UseCharsetForUnicode

UseHypertextStyles

UseSingleCellPadding


Properties for TRVScroller
TRVScroller Properties

Properties   Methods   Events  |  Legend

In TRVScroller

BorderStyle

HScrollMax

HScrollPos

HScrollVisible

InplaceEditor

NoVScroll

Tracking

UseXPThemes

VScrollMax

VScrollPos

VScrollVisible

WheelStep (D4+)

Derived from TCustomControl

Align

Anchors (D4+)

Constraints (D4+)

Ctl3D

DragMode

Enabled

Height

HelpContext

HelpKeyword (D6+)

HelpType (D6+)

Hint

Left

Name

ParentCtl3D

ParentShowHint

PopupMenu

ShowHint

TabOrder

TabStop

Tag

Top

Visible

Width


Properties for TRVSeqItemInfo
TRVSeqItemInfo Properties

Properties   Methods  |  Legend

In TRVSeqItemInfo

FormatString

NumberType

Reset

SeqName

StartFrom

Inherited from TRVLabelItemInfo

Alignment

Cursor

MinWidth

ProtectTextStyleNo

Text

TextStyleNo


Properties for TRVSmartPopupProperties
TRVSmartPopupProperties Properties

Properties   Methods  |  Legend

In TRVSmartPopupProperties

ButtonType

Color

Hint

HoverColor

HoverLineColor

ImageIndex

ImageList

LineColor

Menu

Position

ShortCut


Properties for TRVStyle
 TRVStyle Properties

Properties   Methods   Events  |  Legend

In TRVStyle

CheckpointColor

CheckpointEvColor

Color

CurrentItemColor

DefCodePage

DefTabWidth

DefUnicodeStyle

EndnoteNumbering

FieldHighlightColor

FieldHighlightType

FloatingLineColor

FootnoteNumbering

FootnotePageReset

FullRedraw

HoverColor

InactiveSelColor

InactiveSelTextColor

InvalidPicture

JumpCursor

LineSelectCursor

ListStyles

LiveSpellingColor

PageBreakColor

ParaStyles

SelColor

SelectionMode

SelectionStyle

SelTextColor

SoftPageBreakColor

SpacesInTab

TextStyles

UseSound


Properties for TRVTabInfo
TRVTabInfo Properties

Properties

In TRVTabInfo

Align

Leader

Position


Properties for TRVTabInfos
TRVTabInfos Properties

Properties   Methods  |  Legend

In TRVTabInfos

Items

Derived from TCollection

Count


Properties for TRVTableCellData
TRVTableCellData Properties

Properties   Methods  |  Legend

Inherited from TRVItemFormattedData

Read here

In TRVTableCellData

BackgroundImage

BackgroundImageFileName

BackgroundStyle

BestHeight

BestWidth

BorderColor

BorderLightColor

Color

ColSpan

Hint

RowSpan

VAlign

VisibleBorders


Properties for TRVTableItemInfo
TRVTableItemInfo Properties

Properties   Methods    Events  |  Legend

In TRVTableItemInfo

BackgroundImage

BackgroundImageFileName

BackgroundStyle

BestWidth

BorderColor

BorderLightColor

BorderHSpacing

BorderVSpacing

BorderStyle

BorderWidth

CellBorderColor

CellBorderLightColor

CellBorderStyle

CellBorderWidth

CellHPadding

CellHSpacing

CellPadding

Cells

CellVPadding

CellVSpacing

ColCount

Color

HeadingRowCount

HOutermostRule

HRuleColor

HRuleWidth

Options

PrintOptions

RowCount

Rows

TextColSeparator

TextRowSeparator

VisibleBorders

VOutermostRule

VRuleColor

VRuleWidth


Properties for TRVTableRow
TRVTableRow Properties

Properties   Methods

In TRVTableRow

Items

PageBreakBefore

VAlign

Derived from TList

Count


Properties for TRVTableRows
TRVTableRows Properties

Properties   Methods

In TRVTableRows

Items

Derived from TList

Count


Legend

  published;

  read-only;

  protected.


 Unicode: Not Recommended

This method is not recommended for use in Unicode applications.

If the text parameter is ANSI string and the text style is Unicode (or vice versa), results will be incorrect. Use other methods providing automatic conversion between ANSI and Unicode instead of this method.

For Unicode text styles, the string parameter of this method must contain string in "raw Unicode format".

See also: Unicode in TRichView


 "Unicode Raw Text":

It a string containing each Unicode character as two adjacent 1-byte characters.

This is an internal RichView representation of Unicode text.

These strings have TRVRawByteString type (equal to RawByteString in Delphi 2009, or String in the older versions of Delphi)

You can convert "raw unicode string" to WideString/UnicodeString with the function:

function RVU_RawUnicodeToWideString(const rawstring: TRVRawByteString): TRVUnicodeString;

You can convert WideString/UnicodeString to "raw unicode string" with the function:

function RVU_GetRawUnicode(const s: TRVUnicodeString):TRVRawByteString;

(defined in RVUni unit)

See also:

Unicode in RichView