Valid TRichView Documents

<< Click to display table of contents >>

Valid TRichView 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 most cases, TRichView 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). The exception is empty text items formatted with style having EmptyWidth>0, they can be in any place of text.

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