Question about using RTF2 control with merge

  • Thread starter Thread starter Max Moor
  • Start date Start date
M

Max Moor

Hi All,
I'm trying to use the RTF2 control (Lebans Holdings) for writing
letters. The letters include "keys," which are field names of an
underlying recordset. I want to run the letter against the record set,
creating a merge.

Once the letter is written, I want to parse it for the keys, running
it against the recordset, breating a merge. The data in RTFField in the
table looks like a path to something, but not the actual letter data. I
don't know much about the RTF format, and less about how RTF2 stores it,
but I sure like how this control can make a letter look.

How can I parse the RTF data in code, relacing the field names with
the actual data?

- Max
 
I have not worked with doing a Mail Merge from Access to Word so my
ability to help is limited.

I don't quite understand at what point in the process you need to
perform your search and replace.
There are two methods I can see that you could take to parse the data in
the control.

1)
Programmatically parse the RTF encoded string data directly which is
available via the RTFText property.
Dim s as String
s = Me.NameofRTFcontrol.Object.RTFText
' Do your parsing(search and replace here)
Me.NameofRTFcontrol.Object.RTFText = s


2) This would require the use of the latest BETA version as it now
contains a FIND method. Unfortunately I cannot reccomend this as this
version contains a BACKSPACE bug(backs up 2 spaces instead of one). I am
in the middle of a new project and probably will not have time to finish
testing Version 1.8 until early next week. Anyhow, with the new FIND
method in Beta 1.7 you could do something like:

FIND the desired "key"
Use the SelText property to replace this key with the relevant field
data.
Loop

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
1)
Programmatically parse the RTF encoded string data directly which is
available via the RTFText property.
Dim s as String
s = Me.NameofRTFcontrol.Object.RTFText
' Do your parsing(search and replace here)
Me.NameofRTFcontrol.Object.RTFText = s


Hi Stephen,
Thank you, Stephan! This was just what I needed. I parse the
RTFText, then save it away. I am curious... The saved text has the proper
info in it. I know this because it's there when I print it out. In the
table where I store it, however, it still just looks like some weird path.
I assume this is either because of how an rtf document is stored, or how
it's displayed in a grid view (maybe both). Is there a quick answer to why
it looks so differnt in the two places?

- Max
 
You are seeing the raw RTF encoded text. It's plain text with RTF
formatting control codes. An object, such as an RTF ActiveX control,
parses this incoming RTF encoded text to produce the formatted display
you see in the control.
:-)
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top