Changing a NotesRichTextItem text colour

I currently have some code which takes a richtext field from a document, in the form of a notesitem, called “body”. I then want to put the contents of “body”, into a richtext field on a new document, called “body2”.

I can do this by using doc.copyitem(body, “body2”), however the text formatting in “body2” is being dicated by the formatting in “body”. I have tried setting the font and font colour in designer for the “body2” field, but it is overwritten when I use copyitem.

All I want to do is take the formatted text (and attachments if present) from “body”, and paste these into “body2”, with all text being red.

I have appended a notesstyle to Body2 with no luck

Thanks

Subject: Changing a NotesRichTextItem text colour

use AppendRTItem method to copy the content from one rich text field to another.

Subject: Not Working

Unless I’m not doing it correctly, this isn’t working.

Set RStyle = sess.CreateRichTextStyle

RStyle.NotesColor = COLOR_RED

Call body22.AppendStyle(RStyle)

Call body2.AppendRTItem(body)

Call body2.Update

I’m still getting the text colour of whatever the text was in the body rtitem.

Subject: RE: Not Working

See the SetStyle method. This might require iterating through the text runs, or you could set the endpoints of the range to the first and last text run.