trichview.com

trichview.support




Re: Inserting HTML into TRichViewEdit


Return to index


Author

Message

Sergey Tkachenko

Posted: 08/22/2002 20:44:47


If you use do not use a predefined set of styles, use a code like this:


var fs: TFontInfo;

    StyleNo: Integer;

begin

  if InputQuery('Insert HTML code', 'HTML code', InputString) then begin

     fs := TFontInfo.Create(nil);

     fs.Options := [rvteoHTMLCode];

     fs.BackColor := clYellow; // to make HTML code visually different

     StyleNo := RVStyle1.TextStyles.FindSuchStyle(0, fs,

RVAllFontInfoProperties);

     if StyleNo<0 then begin

       RVStyle1.TextStyles.Add;

       StyleNo := RVStyle1.TextStyles.Count-1;

       RVStyle1.TextStyles[StyleNo].Assign(fs);

     end;

     fs.Free;

     RichViewEdit1.CurTextStyleNo := StyleNo;

     rve.InsertText(InputString);

   end;

end;




"Todd Cary" <[email protected]> wrote in message

news:[email protected]...

> Sergey -

>

> Now I am getting close to what I need.  In the code below, once I set the

> Options to rvteoHTMLCode, it stays that way for all of the Text.  Is is

possible

> to have the Option apply to just the Inserted text; not all of the text?

>

> Todd

>

>

> procedure TFormSimpleEdit.SpeedButtonInsertHTMLClick(Sender: TObject);

> var

>   InputString: String;

> begin

>   If InputQuery('Insert HTML code', 'HTML code', InputString) Then

>   Begin

>     rvs.TextStyles[rve.CurTextStyleNo].Options := [rvteoHTMLCode];

>     rve.InsertText(InputString);

>     //rvs.TextStyles[rve.CurTextStyleNo].Options := [rvteoRTFCode];

>   End;

> end;

>

>

> --

> Todd Cary

> Ariste Software

> 2200 D Street Extension

> Petaluma, CA 94952

> 707-773-4523

> [email protected]

>

>





Powered by ABC Amber Outlook Express Converter