Page 1 of 1

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

Posted: Tue Jul 13, 2010 3:44 pm
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

Posted: Tue Jul 13, 2010 4:44 pm
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