What is more interesting is that error appears only if I use AddPictureEx... When adding text and replacing with InsertPicture - everything works fine...
to be more specific I'll illustrate it with that code:
Code: Select all
First.Clear;
First.Format;
for I := 0 to 99 do//the cycle is absurde, but this is only a demostration
if I mod 2 = 0 then
First.AddTextNLW(CRLF + 'text', 0, -1, 1, True)
else
begin
FindPicture(I, gr);//gr: TGraphic
if gr <> nil then
begin
gr1 := RV_CreateGraphics(TGraphicClass(gr.ClassType));
gr1.Assign(gr);
First.AddPictureEx('img', gr, -1, rvvaMiddle);
end;
end;
First.FormatTail;
mem := TMemoryStream.Create;
First.SaveRVFToStream(mem, False);
mem.Position := 0;
First.Clear; //<----- Fails here
First.Format;
Second.AppendRVFFromStream(mem, -1);
FreeAndNil(mem);
Code: Select all
First.Clear;
First.Format;
for I := 0 to 99 do
begin
First.AddTextNLW(CRLF + 'text', 0, -1, 1, True);
First.AddTextNLW('img' + IntToStr(I), 0, -1, 1, True);
end;
for I := 0 to 99 do
begin
FindPicture(I, gr);
while First.SearchTextW('img' + IntToStr(I), []) do
begin
gr1 := RV_CreateGraphics(TGraphicClass(gr.ClassType));
gr1.Assign(gr);
First.InsertPicture('img' + IntToStr(I), gr1, rvvaAbsMiddle);
end;
end;
First.FormatTail;
mem := TMemoryStream.Create;
First.SaveRVFToStream(mem, False);
mem.Position := 0;
First.Clear;
First.Format;
Second.AppendRVFFromStream(mem, -1);
FreeAndNil(mem);