Inserting tekst and loadFromStream

General TRichView support forum. Please post your questions here
Post Reply
Rkloeg
Posts: 2
Joined: Mon Jul 27, 2015 2:50 pm

Inserting tekst and loadFromStream

Post by Rkloeg »

Hi Sergey,

I've been trying to insert a line at the start of a document and loading a document from stream,
But the line at the start doesn’t show in de editor?

Code: Select all

  stream:=TMemoryStream.Create;

  //nu de tekst inlezen...
  if QTekst['tekst']<>'' then
    begin
      stream.Clear;
      TBlobField(QTekst.FieldByName('Tekst')).SaveToStream(stream);
      Stream.Position:=0;

      RichViewEdit1.clear;
      RichViewEdit1.Add('Hello World',0);
      RichViewEdit1.LoadFromStream(stream, rvynaAuto);

      //nu de handtekening nog...
      LoadSig(false);
    end;
  Stream.Free;
Am I doing something wrong?

I hope someone can point me in the right direction

Thanks in advance,

Robert
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

LoadFromStream clears document before loading.

Unfortunately, there is no method for appending content that autodetects
stream format.
If the stream contains RVF, use RichViewEdit1.InsertRVFFromStream(Stream,
RichViewEdit1.ItemCount);
If the stream contains RTF, use RichViewEdit1.LoadRTF(Stream)
If the stream contains a plain text, load a string from the stream and use
RichViewEdit1.AddTextNL(Str, 0, 0, 0);

When document is created, call RichViewEdit1.Format.
Post Reply