TCustomRichView.OnSaveParaToHTML

<< Click to display table of contents >>

TCustomRichView.OnSaveParaToHTML

Allows adding your HTML code when saving paragraphs to HTML.

property OnSaveParaToHTML: TRVSaveParaToHTMLEvent

 

TRVSaveParaToHTMLEvent = 

  procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer;

    ParaStart, CSSVersion: Boolean;

    var HTMLCode: TRVUnicodeStringof object;

(introduced in v1.8; changed in version 18)

Input parameters:

ParaStart:

True, if the returned text will be inserted in the beginning of paragraph (before <p>, <div> or <li>),

False, if it will be inserted in the end (after </p>, </div> or </li>).

RVData, ItemNo define the location. if ParaStart=True, ItemNo is an index of the first paragraph item (in RVData). If False, it is an index of the first item of the next paragraph (or RVData.ItemCount for the last paragraph).

RVData can be Sender.RVData, or table cell, or cell inplace editor's RVData.

Output parameters:

HTMLCode output string.

 

Example: each paragraph in its own table

procedure TMyForm.MyRichViewSaveParaToHTML(Sender: TCustomRichView; 

  RVData: TCustomRVData; ItemNo: Integer; ParaStart,

  CSSVersion: Boolean; var HTMLCode: TRVUnicodeString);

begin

  if ParaStart then

    HTMLCode := '<table border=1 width=100%><tr><td>'

  else

    HTMLCode := '</td></tr></table>'  

end;

This event is public, so you need to assign its handler in code at run time.

 

See also:

OnSaveHTMLExtra;

Export to HTML.