Using LotusScript, I have a view action that creates a mail doc from the original database doc. This works but the mailed doc, when viewed in the Notes Client "In Box", the fonts are changed to a monospaced type font and the table properties have changed as well. The same code used in a FORM action works perfectly. Here is the code (using Notes 4.6.7):
Dim s As New NotesSession Dim ws As New NotesUIWorkspace Dim dt As New NotesDateTime("01/01/60") Dim db As NotesDatabase Dim uidoc As NotesUIDocument Dim doc As NotesDocument Dim maildoc As NotesDocument Dim col As NotesDocumentCollection Dim rtitem As NotesRichTextItem Dim candidate As String Set db = s.currentdatabase Set col = db.UnProcessedDocuments dt.setnow For i = 1 To col.count Set doc = col.getnthdocument( i ) doc.replaceItemValue "DateMailed", dt.dateonly doc.replaceItemvalue "ShowSentDate" , dt.dateonly Doc.Save True , False Set maildoc = doc candidate = doc.compcandidate(0) maildoc.removeitem "Readers" maildoc.removeitem "Authors" maildoc.replaceitemvalue "Competency", doc.getfirstitem( "Competency" ).values maildoc.replaceitemvalue "compIntName", doc.compIntName(0) maildoc.replaceitemvalue "hidesubmit", "0" maildoc.replaceitemvalue "MailedPointer", 1 maildoc.replaceitemvalue "mailmode" , "1" mailDoc.replaceItemValue "Subject", "Interview Evaluation For " + candidate + " Enclosed" mailDoc.replaceItemValue "server_name", db.server mailDoc.replaceitemvalue "file_path", db.filePath MailDoc.replaceItemValue "doc_id", Cstr(doc.universalID) Set rtitem = New NotesRichTextItem( maildoc, "Body" ) rtItem.appendtext "ATTENTION OUTLOOK USERS! Follow this doc link to view the subject document" rtItem.Addnewline 1 rtitem.AppendDocLink doc, db.Title mailDoc.Send True Next
You might try a couple of things.
First, you can apply the NotesRichTextStyle class to your Rich Text object to make it appear with the size and fonts that you like. This is done by creating a new NotesRichTextStyle class and setting attributes like RichTextStyle.NotesFont = FONT_ARIAL and RichTextStyle.FontSize = 12. Once you have created and customized this NotesRichTextStyle object, you simply apply it to an existing NotesRichTextItem using the AppendStyle method of NotesRichTextItem like this; call NotesRichTextItem.AppendStyle(NotesRichTextStyle). Now, text you add to your NotesRichTextItem will have the style that you defined for it.
Second, you could make it a little more customizable by creating a profile-type document that stores a rich text value. This value could contain your static text "ATTENTION OUTLOOK USERS! Follow this doc link to view the subject document". It could be formatted however you like. You could then create a handle to that profile document's object and simply append the item into the "body" NotesRichTextItem in your new document. The advantage of this method is that you can later customized the rich text in your message without changing your code. Downside is that it's relation to the doclink cannot change. You could overcome this, however, by creating two rich text profile fields. One called before_link and one called after_link. You could then have rich text that you paste before and after the link, and it will be completely customizable. The other drawback to this method is that if you want any variables from your program (like the user name) to appear in the message body, you could not format it with this method.
You could combine the two methods I have outlined and useNotesRichTextStyle to format the header of the body (where you might use a variable), and then use stored profile fields to do the rest of the message body.
Hope this helps you.
Dig Deeper on Domino Resources - Part 7
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.