rvico TRichView Reference | TRichView

TCustomRichView.OnSaveParaToHTML

Top  Previous  Next

Allows to add your HTML code when saving paragraphs to HTML.

property OnSaveParaToHTML: TRVSaveParaToHTMLEvent

 

TRVSaveParaToHTMLEvent = 

  procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer;

    ParaStart, CSSVersion: Boolean;

    var HTMLCode: Stringof object;

(introduced in v1.8)

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. This is a Unicode string for Delphi/C++Builder 2009 or newer, and ANSI string for the older versions of Delphi/C++Builder.

 

Example: each paragraph in its own table

procedure TMyForm.MyRichViewSaveParaToHTML(Sender: TCustomRichView; 

  RVData: TCustomRVData; ItemNo: Integer; ParaStart,

  CSSVersion: Boolean; var HTMLCode: String);

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.


TRichView © trichview.com