Adding content to Rich Text field in a document using QOA
I have found an interesting challenge last week. For some reason, I had to have a document on web that would show a computed table of products and there would be some content before and after. The trick however is, that we use some sort of CRM database for our web content and documents use one rich text item to store document content.
Now, I didn’t want to create another form or change the existing one and there was way to complicated to do a computed value in rich text for table display. And we already had a web QOA for this type of document.So what did I do? I added following custom code to rich text field:
<$$myTable>
But how would that do you any good?
Now all I had to do is add the following code to QOA:
Dim rti As NotesRichTextItem dim rtr As NotesRichTextRange ... Set rti = docWeb.GetFirstItem ("Body") Set rtr = rti.CreateRange Call rtr.FindAndReplace ({<$$myTable>}, strHtml) Call rti.Compact (); ...
First I obtain a Rich Text field where my identifier is. Then, I created a range and used FindAndReplace method to replace identifier with HTML (stored in strHtml variable), that will display required table.
That is all?
Yes. Mind you, there is a catch. All in-line images in Rich Text field will not display on web. Image resources will display normally.
Leave a Reply