Saved RichViewEdit Content Causes Endless Loop

General TRichView support forum. Please post your questions here
Post Reply
fchintc
Posts: 47
Joined: Thu Oct 25, 2007 2:49 pm

Saved RichViewEdit Content Causes Endless Loop

Post by fchintc »

Hi.

I used the following code to insert the contents of a blob field from 2 records of a DBISAM query into a RichViewEdit and then store the content of the RichViewEdit back into another table.

Code: Select all

// oQry is a DBISAM query
// oTb is a DBISAM table
// rvGen is a TRichViewEdit
// rvSrc is a TDBRichViewEdit linked to oQry
               oQry.first;
               rvGen.Clear;
               while ( not oQry.eof ) do begin
                  stream := TMemoryStream.Create;
                  try
                     rvSrc.SaveRTFToStream(stream, false);
                     stream.Position := 0;
                     rvGen.InsertRTFFromStreamEd(stream);
                     rvGen.InsertText(#13#10);
                  finally
                     stream.Free;
                  end;
                  oQry.next;
               end;
               rvGen.AddBreak;
               rvGen.Format;
               oTb.edit;
               oTb.fieldbyname('body').Clear;
               Stream2 := oTb.CreateBlobStream(oTb.fieldbyname('body'), bmWrite);
               try
                   rvGen.SaveRTFToStream(Stream2, False);
               finally
                    Stream2.Free;
               end;
               oTb.post;

When I use TppDBRichView in ReportBuilder 7 against the single BODY field in the table, the 2 combined blob fields are printed over and over again.

Am I missing a statement somewhere?

Thanks.

Frederick
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Can you send me a project to reproduce?
(very preferrably with BDE instead of DBISAM)
fchintc
Posts: 47
Joined: Thu Oct 25, 2007 2:49 pm

Post by fchintc »

I have found the problem and it is not with TRichView. The data source for the ReportBuilder report was from a query with multiple records while the body section was pointing to only one record (with the RTF blob) from a table.

As the report was generated, the body section was repeatedly generated based on the number of records from the query.

I took a bit of time getting back here because I was on a deadline and I am not familiar with the BDE.

Thanks for your help.


Frederick
Post Reply