I have a situation nearly identical to the one reported by "computech" on July 21, 2009. I have paragraphs of RTF Text stored in tables that I need to merge with my main RTF document.
I know from that prior post I have the option of using LoadFromStream or SelectionAsString to insert my text. Since I need to keep the formatting, I plan to use LoadFromStream.
I under I can set CPPosition to indicate where the text should be inserted. This is where my problem comes in. I don't know how to determine the correct location for insertion. The location where the RTF paragraphs need to go is set by the user when they define a document template - essentially, they create a merge field in the document and point it at a table containing RTF paragraphs.
Thus, it is the location of this merge field where I need to insert the RTF paragraph. Originally, I tried using your Finder object to locate my RTF paragraph merge field but this did not work for me. Then I tried using the OnMailMergeGetText event. This allows me to trap my RTF paragraph tags but I cannot see how to determine their location. Or is the CPPosition value automatically set when a merge tag is found?
Also, assuming I can determine the proper location to insert my RTF paragraph, I need for the inserted paragraph to replace the existing mailmerge tab. What is the best way to hide the tag once the merge occurs?