<< Click to display table of contents >>


Occurs while executing ApplyParaStyleConversion method.


  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.


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.



procedure TMyForm.MyRichViewEditParaStyleConversion(Sender: TCustomRichViewEdit;

  StyleNo, UserData: Integer; AppliedToText: Boolean;

  var NewStyleNo: Integer);

var ParaInfo: TParaInfo;


  // creating paragraph style with the desired attributes

  ParaInfo := TParaInfo.Create(nil);



    case UserData of


        ParaInfo.Alignment := GetAlignment;



          ParaInfo.LeftIndent := ParaInfo.LeftIndent+20;

          if ParaInfo.LeftIndent>1000 then

            ParaInfo.LeftIndent := 1000;




          ParaInfo.LeftIndent := ParaInfo.LeftIndent-20;

          if ParaInfo.LeftIndent<0 then

            ParaInfo.LeftIndent := 0;



        ParaInfo.Background.Color := ColorDialog1.Color;

      // add your code here....


    // searching for the style (or adding it if necessary)

    NewStyleNo := RVStyle1.FindParaStyle(ParaInfo);





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\*\Editors\Editor 2\

See also:


See also methods: