rtLib — Notes Rich Text Management Library Documentation of rtLib — Notes Rich Text Management Library Download rtLib — Notes Rich Text Management Library FAQ of rtLib — Notes Rich Text Management Library Purchase rtLib — Notes Rich Text Management Library Feedback about rtLib — Notes Rich Text Management Library

Building and managing rich text

Managing rich text items

Start search Mail feedback Back to Description

Along with classes that are specific for the rich text usage, the library includes also some that facilitates access to the content of the item, namely rtCollection and and rtEnumeration. rtCollection may be used to store, order and retrieve any kind of objects, provided they implement a unique ID string property; rtEnumeration provides a concise way to access a rtCollection object and consequently parse and access inner structure of rich text item (or content of rtContainer element).

Editing, copying and deleting rich text objects may be effected on two levels. The highest level allows the manipulation through specific classes (as we saw it in above samples); the lowest level allows access to rich text records on CD-record (Composite data record) level - in the way they are stored in rich text item. Although throughout this text we assume the use of high level that does not require the knowledge of inner structure of rich text item, chapter on low level access contains information and samples for handling generic elements.

As an example of editing of rich text content, let us replace hotspot pop-up text:

Dim enum as rtEnumeration, coll as rtCollection
Set coll = ctx.Collection(PARSE_GROUP_HOTSPOT)

The method collection returns rtCollection of objects corresponding to keyword provided as an argument. Using property Collection, one may provide several keywords like a line of code:


Returns a collection of all hotspots AND tables. Technically (according to the inner structure of the rich text field) Hotspots refer to a very large group of objects, including, buttons, sections, computed text and hotlinks, so after this call we may a get a large variety of objects.

Roughly equivalent way is to retrieve directly appropriate rtEnumeration; this way is available for the most popular object types.

Set enum = ctx.Hotspots ' it retrieves the rtEnumeration object that can be easily used to loop through the data set

As we are interested at the moment in pop-up text, let us loop through the returned collection and deal with the particular objects:

Dim o as Variant ' do not specify a definite type - returned collection may contain different objects
Dim txt as String ' temporary variable for popup text

Set enum = new
Do While enum.hasMoreElements
' the enumeration is used in the same way as it's counterpart in java.util package
set o = enum.nextElement
if o isA "
rtPopup" then
' is it a pop-up
txt = o.Text
if instr(txt, "IBM")>1 then
' for the sake of simplicity assume the IBM is somewhere in the middle
o.Text = left(txt, instr(txt, "IBM")-1) &"Lotus" &right(txt, len(txt) - instr(txt, "IBM") - 3)
End if
End if

Done - every occurrence of "IBM" in pop-up texts has been replaced by "Lotus". Note that it does not apply to computed pop-ups (with formula to compute the content) or other hotspot types. For other types procedure is similar. It is described in reference section of corresponding classes. A number of samples also are available.