How to add the contents of one RTF Blob fields to a second?

General TRichView support forum. Please post your questions here
Post Reply
Juergen
Posts: 9
Joined: Thu Nov 05, 2009 8:47 pm
Location: Germany

How to add the contents of one RTF Blob fields to a second?

Post by Juergen »

I have a Table with text (RTF formated) patterns in my Database. Now I want to add this text to an other text field of an other table. Both fields are of type Blob.

The destination filed can contains RTF formated text, plain ASCII Text or can be NULL.

What is the easiest way to fulfill this task? I want to encapsulate the code in one function without visual components from outside.

Thanks in advance.

Jürgen
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It is impossible to add one RTF text to another just by adding the content of one file to the end of another.

So the only possible way is to load all documents in one TRichView (appending them one after another) and save this TRichView.
You can use a hidden TRichView (Visible=False) or TRVReportHelper.RichView.

Since LoadRTFFromStream does not clear the existing document before loading, it is very simple:

Code: Select all

rv.Clear;
rv.DeleteUnusedStyles(True, True, True);
for i := 0 to DoCount-1 do begin
  ...
  rv.LoadRTFFromStream(...);
end;
// save rv here
Post Reply