trichview.com

trichview.support




Re: load stream to richview


Return to index


Author

Message

Sergey Tkachenko

Posted: 12/06/2002 14:32:21


> Problem 1)

> It won't work if I create rv dynamically. I have to add rv onto my form

and

> reference that one in Paste_and_convert() instead.


add:


rv.Visible := False;

rv.Parent := in_rv.Parent;


>

> Problem 2)

> It doesn't work anyway. mem gets populated with something (ie. mem.size

changes)

> but InsertRTFFromStreamed() won't insert the mem stream into my original

> in_rv.

>

> mem contains plain acsii text (html), will InsertRTFFromStreamed() fail if

> it's not RTF format?


Yes, of course.


> How can I insert plain text?


procedure Paste_and_convert(in_rv:TRichViewEdit);

var rv:TRichViewEdit; mem:TMemoryStream;

  s: String;

begin

  mem:=TMemoryStream.create;

  rv:=TRichViewEdit.create(nil);

  rv.Visible := False;

  rv.Parent := in_rv.Parent;

  rv.PasteRTF;

  rv.SaveHTMLToStream(mem,'','stream','',[]);

  rv.free;

  SetLength(s, mem.Size);

  mem.Position:=0;

  mem.ReadBuffer(PChar(s)^, mem.Size);

  mem.Free;

  in_rv.InsertText(s);

end;









Powered by ABC Amber Outlook Express Converter