Replace text with table in Rich-text field

Howdy! :wink:

I’m having a lot of problems with this ^*$%@^ NotesRichTextNavigator!!! Here’s what I want to do:

  1. search a string in a RT field, and return the position.

  2. use RT’s “.AppendTable” to replace the search string.

That’s it! Why is it so bloody confusing??? Here’s a snippet of code, although to be honest, I’ve tried many variations:

Set gnrti = doc.GetFirstItem(“Body”)

Set nrtn = gnrti.CreateNavigator

Set nrtr = gnrti.CreateRange

Call nrtn.FindFirstString(“[srchString]”)

Call nrtr.SetBegin(nrtn)

Call gnrti.AppendTable(4, 5,…)

Call nrtr.SetEnd(nrtn)

(defining values in table, etc…)

Does anyone have a good example of this? The table gets shown correctly, but always at the end of the Rich text field. I’ve done some tests, and I’d like it to show where “[srchString]” is.

Any help would be greatly appreciated!

Thanks, in advance,

Steve in Montreal!

“I don’t suffer from insanity. I’m enjoying every minute of it.”

Subject: Replace text with table in Rich-text field

You’re just missing one little detail – setting the BeginInsert location. You’ve marked the Range, but AppendWhatever will always append to the end of the field unless you set the insert point.

Subject: RE: Replace text with table in Rich-text field

Howdy!

Thanks, big guy! I knew it was something simple I was missing, but I was looking at it too long! =8O It seems to work fine now. I have a bit of cleaning to do, e.g. deleting the “[srchString]”.

Thanksabunch!

BTW, drop me a note to let me know how things are going for you in Montreal.

Ciao!

Steve in Montreal

“If at first you don’t succeed, skydiving is not for you.”