Marc,
Now that I've refreshed my memory a bit on RTF, it seems like there is
likely an all RBase way of concatenating RTF with at least a couple of major
hurdles. Now it is true this could be an all RBase solution, but as you
will read below, it could become cumbersome to the point that it should be
done in a DLL for speeds sake.
One biggie would be that the originating RTF isn't from a recent version
of Word. I looked at the difference in the RTF from WordPad and the same
document saved in Word and word has over a hundred lines of crap after the
"legal RTF" document description that relates to the Theme (meta) data from
Word.
The second, is you have to be prepared to programatically manipulate the
Font Table. The font table "{\fonttbl" is created with the documents
default font as "\f0" and with the first change after that "\f1" and so on
in that fashion, so if the merged document has the same fonts, but were
created in a different order, the lookup for the font to apply for the text
in the font table will display an incorrect font, so merged RTF has to have
any disparate (non existing) font added to the base document's Font Table,
and the sequencing of the font markup changed to match the order of the Font
Table
Now for the structure of the RTF.
It appears that when there is a complete "file" or document description,
the document header line ends in a CRLF, so to determine if the VarChar data
is just a snippet or a complete document, you need to test for the presence
of expected text in the header, the most obvious is the first 5 characters
of the file "{\rtf", with the 6th character being the version of the RTF (1
through 4).
So if you test for the headers presence and it is TRUE, then to add another
snippet to it, we need to remove the LAST character of the file, which is
the last closing brace "}" , then you can concantenate your snippet to it,
ADD back the closing brace "}" and you have a complete file.
If you are merging TWO Files together, you would remove the header from the
second file (after removing the closing brace from the first) and simply
concantenate the remainder of the second file to the first (observing what
has to happen to the font table as described before).
HTH,
Mike