Maybe the following will help with some ideas
Found the simple code I used to test written in 2005 :
*(TestRTF.rmd)
{Report TestRTF has one variable RTF control in the page header section
with a variable assigned vRTF as Varchar in the onBeforeGenerate EEP}
-- For the source of RichText markup
-- Go to http://www.biblioscape.com/rtf15_spec.htm#Heading30
-- The following is the Font Table synopsis:
-- ControlWord Font family Examples
--\fnil = Unknown or default fonts like: (the
default)
--\froman = Roman, proportionally spaced serif fonts like:
Times New Roman, Palatino
--\fswiss = Swiss, proportionally spaced sans serif fonts like:
Arial
--\fmodern = Fixed-pitch serif and sans serif fonts like: Courier
New, Pica
--\fscript = Script fonts like: Cursive
--\fdecor = Decorative fonts like: Old
English, ITC Zapf Chancery
--\ftech = Technical, symbol, and mathematical fonts like: Symbol
--\fbidi = Arabic, Hebrew, or other bidirectional font like: Miriam
Set var vCR = ((char(13))+(Char(10)))
Set var vF0Fam = '{\f0\fromans\fcharset0'
Set var vF0 = 'Times New Roman;}'
set var vf1Fam = '{\f1\fswiss\fcharset0 '
Set var vF1 = 'Arial;}'
set var vf2Fam = '{\f2\fmodern\fcharset0'
Set var vF2 = 'Courier New;}'
set var vf3Fam = '{\f3\fscript\fcharset0'
Set var vF3 = 'Comic Sans MS;}'
Set Var vRTF long Varchar = Null
set var vHeader = '{\rtf1\ansi\ansicpg1252\deff0\deflang1033'
-- Add the Font Table
set var vHeader = +
(.vHeader + '{\fonttbl' + .vf0Fam & .vF0 + .vf1Fam & .vF1 + +
.vf2Fam & .vF2 + .vf3Fam & .vF3 + '}' + .vcr)
*(
In the following, the "\pard\f0\fs28" portion set everything after that
as
the next paragraph until \par occurs subsequent. The \f0 is the first
font
in the font table [so f1 would be the second and so on] from the
previous
header segment and the \fs28 is the "FontSize" of 14, so the number
used
is 2X the actual fontsize to display.
)
set var vHeader = +
(.vHeader + +
'{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs28' +
.vcr)
set var vPar = '\par'
set var vRBrace = '}'
Set var vWrite text = null
set var vCR =((char(13))+(Char(10)))
out testRTF.RTF
wri .vHeader Continue
write 'This is Line One' Continue
wri .vPar Continue
wri .vcr Continue
-- Continue is used on the previous line to eliminate the RBase CRLF
--Write .vPar --Continue
-- The vPar variable contains the RTF New Paragraph markup
write '\f1\fs40' ' ' Continue
Write 'This is Line Two' Continue
wri .vpar Continue
wri .vcr Continue
-- Continue is used on the previous line to eliminate the RBase CRLF
--Write .vPar --Continue
-- The vPar variable contains the RTF New Paragraph markup
write '\f2\fs48' ' ' Continue
Write 'This is Line Three' Continue
wri .vpar Continue
wri .vcr Continue
-- Continue is used on the previous line to eliminate the RBase CRLF
--Write .vPar --Continue
-- The vPar variable contains the RTF New Paragraph markup
write '\f3\fs72' ' ' Continue
Write 'This is Line Four' Continue
wri .vpar Continue
wri .vcr Continue
-- Continue is used on the previous line to eliminate the RBase CRLF
--Write .vPar --Continue
-- The vPar variable contains the RTF New Paragraph markup
write .vrbrace Continue
wri .vcr Continue
out SCR
Print TestRTF
return
----- 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