GetItemValue and Multiple Body Fields

GetItemValue(“Body”)(0) with multiple Body (RichText) fields truncates the text.

According to Designer Help “If multiple items have the same name, this method returns the value of the first item.”

We have tried, in vain, to merge the multiple Body fields, by looping through all of them and deleting them step-wise:

While doc.HasItem(“Body”)

tempBody = tempBody & " " & doc.GetItemValue("Body")(0)

Call doc.RemoveItem("Body")

Wend

Other alternatives do not truncate, but instead destroys LF/CR halfway through the text, e.g.

  • GetUnformattedText

  • GetFormattedText

  • Text property of NotesItem class

  • Values property of NotesItem class

RichTextNavigator does not work either, not grabbing all paragraphs.

Compact method not working either.

Any suggestions?

Subject: Solution found in ND 4&5 Forum!

Here a nice solution:

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/63fecf0d2b91fe8f85256e2200620a1f?OpenDocument

Subject: RE: GetItemValue and Multiple Body Fields

Is the multiple “Body” fields a result of a coding error, or because the body field created mutliple versions due to the amount of information stored (I believe there is a limit just don’t recall it off the top of my head).

AFAIR, you cannot use GetItemValue to access the contents of a RichText field and certainly not append it to a string (tempbody). You could try the GetFormattedText method instead.

I believe you’re going to need to use the AppendRTItem. I would save the RT field each time you append something.

My quick thoughts. Good luck