I made a very simple Report a few years ago for Karen that manipulated RTF or rather converted regular text to formatted text by adding the formatting info to the regular text and then concantenating the whole mess by adding the file header info and closures. You will find a whole bunch of info about this subject and you're correct, it's non-trivial, but making a plugin to do it is OK, but it is still a kludge. The right approach is to expose the methods and properties of the RichEdit to allow direct manipulation at the developers descretion.

----- Original Message ----- From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, July 15, 2009 9:59 AM
Subject: [RBASE-L] - Re: combine two blocks of RTF formatted VARCHAR data


Here is some info I got off the web:

-------------------------------------------------------------------------
When merging two RTF strings, the different fonts used in string 2 must be added to the font table for string 1 and assigned a different ID. Then the text in string 2 must be changed to use this new ID. A RTF string can only have one font table. There is also a color table defined in a similar manner if different colors are used. Coding this will be quite a task.
------------------------------------------------------------------------

This is something which can be done in a language like c++ or vb, creating an RBASE plugin which will do the work, taking two varchars containing RTF strings and merging them, returning the result.

It is certainly not a trivial task, although not impossible by any means.

Ideally, in the RBASE environment, it would be pretty slick if the RTF control itself had an append property, and could do all the work itself.

A MergeRTF function would also be pretty slick.

In any case, this does give you an idea how this could be solved.
I wouldn't even attempt to do this kind of processing in raw RBASE code.

Dennis McGrath






-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence Lustig
Sent: Tuesday, July 14, 2009 5:18 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: combine two blocks of RTF formatted VARCHAR data


<<
Worth exploring as long as I can do SRPL it may work.



You cannot reliably operate on RTF text this way.

Instead, you must rely on two RTF controls (they can be hidden) and an API that allows you to set the select position and select length, then cut or copy the selection, then position the select position in the target RTF field, then paste the text.

This API is not (currently) supported from R:Base, but I imagine you can do it with Windows messages with some research.
--
Larry


Reply via email to