1 (edited by hichame 2019-01-20 14:18:04)

Topic: Richedit stream

Hello
I want to know How to use the fonctions insertfromstream and save to stream.

Thanks

Re: Richedit stream

Hello
I mean that i want to insert rtf from database to.a richedit.by script.
Is it possible?
I used stream but an error message was appeared.
Thanks

Re: Richedit stream

hichame wrote:

Hello
I mean that i want to insert rtf from database to.a richedit.by script.
Is it possible?
I used stream but an error message was appeared.
Thanks

Hello.


In this case no need to use stream, example:

Form1.RichEdit1.TextRTF := SQLExecute('SELECT text FROM test WHERE id=1');
Dmitry.

4 (edited by hichame 2019-01-22 18:39:24)

Re: Richedit stream

Thank you for replay
But i want to add or insrt other RTFs from data base to the same richedit.

Re: Richedit stream

Please download latest beta version
https://www.dropbox.com/s/mb8hyuevvu8x5 … a.zip?dl=0


Example:

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
    Stream: TStringStream;
begin
    Stream := TStringStream.Create;
    try
        if SaveFileFromDataBaseToStream('tablename', 'fieldname', Form1.TableGrid1.dbItemID, Stream) then
        begin
            Stream.Position := 0;
            Form1.RichEdit1.AppendRTFFromStream(Stream);
            //Form1.RichEdit1.InsertRTFFromStreamEd(Stream);
        end;
    finally
        Stream.Free;
    end;
end;
Dmitry.

Re: Richedit stream

Thank you very much smile