Each document is correctly formatted in the DBRichViewEdit, but at the end of the process of copying each one, the 1st document copied (in the RV) is incorrectly formatted (most everything is bold and font sizes range throughout the document), 2nd and subsequent documents copied are correctly formatted.
Can you tell me what I should set the Options and RVOptions to for both the DBRichViewEdit and the RichView.
Also, here my code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
function RVCopy (RVSource, RVDest: TCustomRichView): Boolean;
var
MyStream: TMemoryStream;
begin
try
try
RVSource.SaveRVFToStream(MyStream, False);
MyStream.Position := 0;
Result := RVDest.InsertRVFFromStream(MyStream, RVDest.ItemCount);
RVDest.FormatTail;
except
result := False;
end;
finally
MyStream.Free;
end;
Query1.First;
while not Query1.EOF do
begin
if not RVCopy(DBRichViewEdit1, RichView1) then
messagedlg ('Error', mtError, [mbok], 0)
Query1.Next;
end;
RichView1.Format;
if SaveDialog1.Execute then
Richview1.SaveRTF(SaveDialog1.Filename, False)
end;