Page 1 of 1

Inserting tekst and loadFromStream

Posted: Mon Jul 27, 2015 2:54 pm
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

Posted: Mon Jul 27, 2015 4:30 pm
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.