Problem with Copying several RV together
Posted: Thu Feb 04, 2010 4:06 pm
I am attempting to concatenate the contents of several DBRichViewEdits into one RichView and saving the output in RTF.
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:
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;