<<
The VarChar doesn't know crap from shinola as far as what it contains.  It 
contains VARying length of CHARacters and that's all.  So SRPL and other 
text manipulation functions work just fine.
>>


Unfortunately, they will not work reliably on RTF encoded text.  The reason is 
that the text that you may THINK is written as "[FNAME]" (because that's what 
it looks like) is not represented that way in the encode text:

1. It could have RTF encoding in the middle of it.  

2. It could have escaped characters that don't look like what you think they 
look like.  For instance, I'm not sure if the square brackets are escaped in 
RTF text, but plenty of characters are.

In otherwords, the RTF encoded text for "[FNAME]" could read "\[FN{rtf blah 
blah}AME\]".  It's impossible to predict what will appear in the text in 
advance because it can depend on editing decisions made by the user in the RTF 
control (applying and removing styles, for instance).

If the RTF text you want to operate on is fixed (entered by you, once, and 
stored in a table without change) and if you take the time to examine the 
resulting text and specifically code your SRPLs to whatever you find in the 
text, you could make this work.  But if you later change that text using an RTF 
control or allow the user to edit it, you'd have to recode your SRPLs.

To check how hacked up your text is, simply BROWSE the VARCHAR column that 
contains the RTF encoded text.  You will be shocked at what's going on in there.

The only reliable way I know of performing these kinds of RTF replacements is 
to instantiate an RTF control and use the API of that control to search and 
replace.  This is not directly supported by R:Base (at least, not at this time) 
although I imagine it can be done using Windows messaging.

The takeaway?  Programmatic operation on RTF text is not something for the 
faint of heart.  Any solution relying on operating on the encoded text is 
likely to be a hack that will come apart at the first opportunity for failure.  
If you need to do it, you'll want to find a way to use the API.
--
Larry


Reply via email to