Adding RT items to email but over 32K

I am trying to generate an email that contains a rich text field that is comprised of a rich text field (text and potentially attachments) taken from a series of documents ie RichTextField1 = Doc 1 (body) + Doc 2 (body) etc.

The application is being accessed via a browser.

I can’t use appendrtitem as I exceed the 32K limit and I believe the CopyItemToDocument method will simply overwrite the field contents of the resulting RichTextField1.

The user is currently copying and pasting the documents’ rich text fields manually and I am trying to automate this for them (by providing a checkbox list of documents that are to be incorporated into the email).

Does anyone have any ideas?

Thank you in advance.

Subject: Solution: Adding RT items to email but over 32K

When I tried this, I noticed in the Document properties that a large Body field is stored in multiple fields. This inspired me to try the following code, which

solved the problem form me:

Set Rtitem = New notesrichtextitem(Maildoc,“Body”)

Call rtitem.appendtext(“Hello World”) ''if you need to add text

Call rtitem.addnewline(1)

Call rtitem.appenddoclink(Doc,“”) 'if you need to add a doc link

Call rtitem.addnewline(1)

Dim bodyitem As NotesRichTextItem

Set bodyitem = Document.getfirstitem(“Body”)

While Not bodyitem Is Nothing

Call rtitem.AppendRTItem ( bodyitem)

Call bodyitem.remove

Set bodyitem = Document.getfirstitem("Body")

Wend

A bit late for Lily Collins, but it may help others, struggling with rich text

field duplication.

Subject: What 32K field limit are you referring to? There is no such limit to RT items.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

Stan’s absolutely right as per the appendrichtextitem example in the Domino help “Also note that the AppendRichTextItem method appends only the first 32K of a RichTextItem; the remainder is truncated.”.

So it’s not the rich text field that has the limit it’s the LotusScript method used to append the rich text item.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

AppendRTItem has no such documentation in my copy of Designer R5 Help or Designer 6.5 help.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

The comment is in the Notes section that accompanies the example of AddRTItem in the R6 Designer help.

This course of events initiated my enquiry. When running an agent I had an error in the Notes Log that referred to a 32K limit in a rich text field or column in a view. I read the AddRTItem documentation and saw the Notes paragraph referring to a 32K limit.

I put two and two together (ie the log message and the Notes section in the example for AddRTItem), so I thought, and assumed it was the AddRTItem that was causing me the problem and the error in the log.

It wasn’t. There was a view that exceeded 64K that was being referenced in my agent. Once I’d reduced the number of documents being returned the agent worked.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

Lily, I am using 6.5.1 and have noticed that the AppendRTItem indeed only appends the first 32K of the rich text has the documentation states. I am working with just text, no attachments or images. I have been banging my head on the desk for sometime now trying to work around this.

Here is a snippet of my code:

Set rtitem = currentDoc.GetFirstItem( “AdditionalComments” )

Set rtitem_1 = New NotesRichTextItem( currentDoc , “AdditionalComments_1” )

Set richStyle = session.CreateRichTextStyle

richStyle.FontSize = 8

richStyle.Bold = True

richStyle.NotesColor = COLOR_DARK_RED

Call rtitem_1.AppendStyle(richStyle)

Call rtitem_1.AppendText ("Overflow created on by " & dialogBoxDoc.CommentAuthor(0))

Call rtitem_1.AddNewLine(1)

richStyle.Bold = False

richStyle.NotesColor = COLOR_BLACK

Call rtitem_1.AppendStyle(richStyle)

Call rtitem_1.AppendText( prevText )

Call rtitem_1.AddNewLine(1)

Call rtitem_1.AppendRTItem( rtitem )

Call currentDoc.RemoveItem( “AdditionalComments” )

Set rtitem = New NotesRichTextItem( currentDoc , “AdditionalComments” )

Call rtitem.AppendRTItem( rtitem_1 )

Call currentDoc.RemoveItem( “AdditionalComments_1” )

Call currentDoc.Save(True,True)

Call currentDoc.ReplaceItemValue(“SaveOptions”, “0”)

Call uidoc.Close(True)

Call currentDoc.RemoveItem(“SaveOptions”)

Call workspace.editdocument(True, currentDoc)

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

Dear Carl

I don’t know really what to advise you.

I don’t really do any coding for the Notes client as all my work is for users with a web client (I noticed that you’re using front end objects in your code).

In the past when I’ve done what I think you’re doing (ie appending additional comments) I have used text fields not rich text fields and have done the movement from one field to another as a formula in input translation eg FIELD Notes := @If(@Trim(txtNotes)=“”;Notes; @Name([CN];@UserName) + " - " + @Text(@Now) + linebreak html + @Implode(txtNotes;linebreak html ) + linebreak html + Notes);

“”);

With Notes being a computed field with itself as the formula. But of course you may well come across the text field limit doing it this way.

My own preference too is to have fields on a form eg SaveOptions and then perhaps change the value of a field in an agent but without all the RemoveItems that you’ve included - I just find it simpler and easier to follow if I have to go back to my code at any time in the future. But that’s just a personal preference.

The rich text fields in my application all have attachments but not very much text so I haven’t come across the 32K issue I originally thought my problem was about. I have come across other issues (eg needing to submit a document twice for the attachment to go into a rich text field) but not the one you face.

Sorry I can’t offer you a magic wand.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

If the field that the value is going to is computed, whether it’s text or rich text, it is subject to the return limit of a Notes formula – 64KB. If it’s text, it’s further restricted by the maximum content of a summary field. If it’s rich text, then you have to take into account all of the CD record overhead, so you still won’t get 32K characters. It’s the formula that has the limit, not AppendRTItem.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

Thank you for your explanation and assistance.

Subject: Actually looking at the Example for AppendRTItem does say:

Note The changes are not visible until the document (after the script has completed) is closed and reopened. Also note that the AppendRichTextItem method appends only the first 32K of a RichTextItem; the remainder is truncated.Note the misspelling of the Method though. I know for a fact that the “RenderToRTItem” method of the NotesDocument Class can put way more than 32K into the field. I assume that this must be a mistake.

Subject: RE: What 32K field limit are you referring to? There is no such limit to RT items.

There is a 64KB-per-paragraph (approximating 32K characters) limit, though, which can easily be reached in the back-end by using AppendStuff without ever using AddNewLine(num,True). Perhaps that’s what she was thinking of.

Subject: But importing a body item i.e. AppendRTItem does force a paragraph update.