RichTextItem Formatting Challenges

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:

  1. Apply new NotesRichTextParagraph styles based on using the NotesRichTextNavigator and NotesRichTextRange classes to find those tags I added and apply new formatting (alignment).

  2. 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:

  1. Is this a feasible approach & can it be done?

  2. Is there a better way to accomplish what I am trying to do?

  3. 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

Subject: RichTextItem Formatting Challenges

Hi

I think it is difficult to accomplish your plan with NoteRichText----- classes.

If you want to change alignment, you need to use

NotesRichTextParagraphStyle class, but this class has some restrictions,

How to use the NotesRichTextParagraphStyle class to modify paragraph styles

http://www-01.ibm.com/support/docview.wss?uid=swg27003455

the Example2 in the above url saids, the class is not designed to be applied to existing Rich Text data. and, cannot handle attachments or OLE objects.


by the way,

there is a great library to handle RichText

rtLib

http://www.rtlib.com/

im not sure if it will help you…