BeginInsert issue?

Need advice from this forums…Designer and Notes client versions is 8.5.2

I am extracting the section title of a RT field, then append it to the top of the section. Below code is almost working EXCEPT the first section in the RT field. In some cases, I have up to 40 sections in this RT field.

Since this field is always greater 32 kB, therefore, there are a lot of the same field name from the document properties. That’s perfectly normal for RT field property.

The title of first section always append at the end if the first field name. Then the second and beyond section title is appending correctly on top of each section title. I have even tried to append it at the end of the section and same issue is seen (first section is not appending correctly).

Below is the sample of the code… message box is displaying the first section title correctly.

Any advice is really appreciated.

Dim rti As NotesRichTextItem

Dim rtnav As NotesRichTextNavigator

Dim rtsec As NotesRichTextSection

While Not document Is Nothing

Set uiDocument = uiWorkspace.EditDocument(True, document)

Set rti = document.GetFirstItem(“fieldName”)

Set rtnav = rti.CreateNavigator

Set rtsec = rtnav.GetFirstElement(RTELEM_TYPE_SECTION)

If rtsec Is Nothing Then GoTo Exit Sub

Do

MessageBox("Section title - " & rtsec.Title)

Call rti.BeginInsert(rtsec)

Call rti.AddNewline(1)

Call rti.AppendText("Beginning of Section - " & rtsec.Title)

Call rti.AddNewline(1)

Call rti.EndInsert

Set rtsec = rtnav.GetNextElement(RTELEM_TYPE_SECTION)

Loop While Not rtsec Is Nothing

Call document.Save(True, True)

Call uidocument.Close(True)

Set document = collection.GetNextDocument(document)

Wend

Subject: Try the right forum…

You posted your problem in the Notes 6/7 forum and this forum. You should have posted it in the Notes 8.5 forum since you are using Notes 8.5.2.