Delphi. TRichView. Идентификаторы итемов

Если, например, выделить таблицу и написать вот такой код,

то получим следующий результат

11

А всё дело в том, что каждый итем в TrichView обладает своим идентификатором. Код, который был написан выше позволяет определить этот идентификатор и сказать, например, таблица это или нет.

Приведу  информацию с официального сайта.


 

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
rvsSidenote -206 sidenotes RVSidenote
rvsTextBox -207 text boxes RVSidenote
rvsNoteReference -205 reference to the parent note RVNote
rvsPageNumber -208 “page number” field RVFieldItems
rvsPageCount -209 “page count” field RVFieldItems

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” (deprecated!)

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 entry was posted in Delphi, TRichView. Bookmark the permalink.

Leave a Reply