dbrichview TDBRichView [VCL and LCL]

Properties   Methods   Events

<< Click to display table of contents >>

dbrichview TDBRichView [VCL and LCL]

Properties   Methods   Events

Use TDBRichView to display hypertext documents stored in a 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 IDE, right click a TDBRichView object on a 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.

In Delphi XE2 or newer, there is another solution for data awareness: LiveBindings (see TRichView.Document property).

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) or DocX, 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 and DocX format in them. However, you can use memo fields to display text, HTML, or RTF (Rich Text Format) fields.

Starting from Delphi 2006, Unicode memo fields (Field.DataType=ftWideMemo) are supported specially. TDBRichView does not attempt loading RVF and DocX from these fields. It tries to load Unicode RTF (RTF code converted from AnsiString to WideString), HTML or Unicode text from them.

If rvfoLoadBack is in RVFOptions, the component clears BackgroundBitmap before loading data from the field.

Supported Data Formats

The supported field formats are:

RVF (RichView Format),

RTF (Rich Text Format),

DocX (Microsoft Word document)

HTML

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 (either normal RTF or RTF stored as WideString).

4.If the field does not contain RTF, it tries to load HTML (including HTML in UTF-16 encoding).

5.If the field does not contain HTML, it tries to load DocX.

6.If the field does not contain DocX:

a.If AllowMarkdown, it loads Markdown

b.Otherwise, it loads a plain text

For Unicode memos:

The sequence is the same, but

the component does not attempt to load RVF and DocX

at the final step, it loads Unicode (UTF-16) text or Markdown.

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.