I need some help thinking about how to accomplish something. I have a function that allows people to generate a document that has multiple richtext fields to present specific and very detailed information about their specific situation. The users desire that the resulting document is formatted in ‘outline’ format, (basically affecting alignment of richtext elements).
So, on my form I have fields of:
RTHeading1 - text
RTContent1 - richtext
RT Heading2 - text
RTContent2 - richtext
(there are more, but just to keep it simple)
The RTHeadings are at the roman numeral level - no problem, these are formatted at the form level.
Within the ‘Content’ RT fields, there may be one to many (but not more than 20) titles (the A, B, C… outline level) and under each title there is additional information stored in documents that the users maintain (as the content changes occasionally). The documents that they maintain have the content in richtext fields because they use things like Italics, and bulleted lists which also need to transfer to the resulting document that the script creates.
Through some dialogs, the users are able to create the customized documents that they want by selecting items from their predefined lists of documents. This all works great and the documents are created with their content as they desire. However, it is NOT formatted as an outline as they would like.
Here was my theory…I thought if I wrapped the various types of content when I was building the new richtext fields with component tags like “”, “”, “” and “”, then I could:
-
Apply new NotesRichTextParagraph styles based on using the NotesRichTextNavigator and NotesRichTextRange classes to find those tags I added and apply new formatting (alignment).
-
Remove the extraneous tags again using the NotesRichTextNavigator & NotesRichTextRange classes after applying the formatting.
So, then (always trying to accomplish the easiest first), I tried to use Nav & Range to remove the tags. So, far, I have not had much luck accomplishing it. The best I have done is to replace the first occurrence of a tag in each RTContent field. So, if I can’t even do the easy part, I began to rethink the approach…leading to my questions:
Questions:
-
Is this a feasible approach & can it be done?
-
Is there a better way to accomplish what I am trying to do?
-
Any ideas on why I’m not able to replace multiple tags (see one version of the code below, I have tried at least 8 different ways to do this to no avail)
When I put this code in, the net effect is that is DOES replace the FIRST & ONLY the first occurrence of “” in each new RTContent field, where there are really more than 1 of those tags!
Set rtRange = rtitem.CreateRange
Set rtNav = rtitem.CreateNavigator
If rtNav.FindFirstElement( 4) Then
Call rtRange.SetBegin( rtNav )
If rtNav.FindLastElement( 4) Then
Call rtRange.SetEnd( rtNav )
x = rtRange.FindandReplace( "<begintitle>", " ", 16)
End if
End if
Any & all ideas are most welcome!
Thank you so much for any suggestions/advice that you might offer.
Have a great day!
Amy