NormalizeRichView Procedure

<< Click to display table of contents >>

NormalizeRichView Procedure

Fixes possible problems in TCustomRichView component.

Unit RVNormalize.

procedure NormalizeRichViewNormalizeRichView(RVData: TCustomRVData;

  FirstItemNo: Integer=0; Recursive: Boolean=True);

This procedure does not update undo/redo buffer in editor, so it must be called before the first editing operations after clearing and creating/loading document.

This procedure:

fixes incorrect "new line" flags

fixes paragraphs consisting only of list markers without items

fixes incorrect ParaNo assignment

removes empty text items (from places where they should not be)

combines adjacent text items of the same text style and tag

This procedure fixes issues 1-3 and 5-7 listed in the TRichView help topic "Valid Documents"

Example:

    NormalizeRichView(rv.RVData);

    rv.Format;

Optional parameters:

FirstItemNo defines the first item to check. The procedure checks items from FirstItemNo to RVData.ItemCount-1. By default, all items are checked.

If Recursive=True, the procedure checks subdocuments of RVData (table cells).