Page 1 of 1

TRichViewEdit.Format gives 'list index out of bound'

Posted: Wed Sep 17, 2008 12:25 pm
by chys
Hello!

Have a question about TRichViewEdit (using v1.9.47).

RVE1,RVE2,RVE3: TRichViewEdit;

I need to save data from RVE1 & RVE2 into a stream and then load data from this stream into another RVE3. I get a "list index out of bound" when I format RVE3.

<<source is below>>

RVE1.SaveRVFToStream(stream,false);
RVE2.SaveRVFToStream(stream,false);
...
stream.position := 0
RVE3.LoadRVFFromStream(stream);
RVE3.Format;

Posted: Wed Sep 17, 2008 4:40 pm
by Sergey Tkachenko
You cannot concatenate to RVF files that simple, by saving two RichViews in the same stream. The resulting stream content is invalid.

Posted: Wed Sep 17, 2008 4:54 pm
by Sergey Tkachenko
Use the following code to copy RVE1+RVE2 in RVE3:

Code: Select all

Stream := TMemoryStream.Create;
RVE1.SaveRVFToStream(Stream,False); 
Stream.Position := 0;
RVE3.LoadRVFFromStream(Stream); 

Stream.Clear;
RVE2.SaveRVFToStream(Stream,False); 
Stream.Position := 0;
RVE3.InsertRVFFromStream(Stream, RVE3.ItemCount);

RVE3.Format;
Stream.Free;

Posted: Thu Sep 18, 2008 8:23 am
by chys
Sergey Tkachenko wrote:Use the following code to copy RVE1+RVE2 in RVE3:
...
Thanks!