RichTextItem, doclink and text string

I have an old database holding lots of doclinks. Unfortunately at some point the database was COPIED and as a result the documents all have new UNIDs and the doclinks are failing.

The documents seem to follow a pattern of :

document title unique-document-number

similar to below

  1. Water Pore Volume( SPM 237A) WIBR-0076

Many of the documents have dozens of these doclinks and their descriptive text in the body field.

I have not spent much time working with RichTextItems so I am unfamiliar with its capabilities. Is it possible to get a doclink and then get the text which immediately follows?

If so, then I could go to the view which organizes by unique-document-number and get the UniversalID and then update the doclink.

I considered using FindFirstString in conjunction with FindFirstElement(RTELEM_TYPE_DOCLINK) and then FindNextString and FindNextElement, but this would rely on a coincidence and could get off-track if a doclink was missing.

My preference is to find the doclink, then look at the next 10 characters to see if it matches my pattern (they all will be “WIBR-” followed by 4 numerals). If no match, then I get the next doclink.

Before I spend much time on this I wanted to ask for opinions on whether it is possible.

Another option is to stick with FindFirstString and each time I found a matching string, create a Hotspot around it. Is this possible?

Thanks,

Marc

Subject: RichTextItem, doclink and text string

Give it a try, but you have to realize that one apparent text run may actually be several, depending on how exactly they were added, whether the document was ever modified, whether there are any changes to text attributes (e.g., “13. Water Pore Volume( SPM 237A)” may be one text run, but “13. Water Pore Volume( SPM 237A)” is a minum of four).

As a somewhat different approach, have you thought about looking at the DisplayComment property for the doclink from the NotesRichTextDoclink class? This is generated automatically when the doclink is created manually, and may have the unique number in it, depending on how it appears in the view.

Another possible approach is to dump the documents with DXL, then traverse the tree with a bit more control.

If none of these approaches works, and if a third party product is a possibility at all, our Midas Rich Text LSX will let you cycle through the doclinks and get the text immeditately after them, or pretty much anything else you need, and it will also easily allow you to modify the doclink or make the the unique names into links.