Reputation: 211
For my project, every time I click on generate button, will run an LotusScript agent to create a ".pdf" file inside "attachment" rich text field.
Here is my script for inserting on one document:
' ...
Dim oitem As NotesRichTextItem, eo As NotesEmbeddedObject, path$, template
path = Environ$("TEMP") + "\"
template = ""
Set oitem = setdoc.Getfirstitem("AttachmentCert")
If oitem.Type = RICHTEXT Then
ForAll o In oitem.Embeddedobjects
Set eo = o
If eo.Type = EMBED_ATTACHMENT Then
template = path + eo.Source
If Dir$(template, 0) <> "" Then Kill template
Call eo.Extractfile(template)
Exit ForAll
End If
End ForAll
End If
' ...
result = path + "Certificate of Compentency for " + names + ".pdf"
Set rtitem = New NotesRichTextItem(doc, "License_Cert")
Call rtitem.Embedobject(EMBED_ATTACHMENT, "", result)
Problem facing: if I want to attach more document into a rich text field how can I do it?
I try this code, but it's not working:
If doc.hasItem("License_Cert") Then
Set rtItem = doc.getFirstItem("License_Cert")
' Add a couple of lines to the rich text field before re-attaching the file
Call rtItem.addNewLine(2)
Else
Set rtItem = New notesRichTextItem(doc, "License_Cert")
End If
Now it duplicates the same name field, is it ok?
Upvotes: 0
Views: 968
Reputation: 12060
To append more than one attachment to a richtext- item you simply do that. Your code would look like this
If doc.hasItem("License_Cert") Then
Set rtItem = doc.getFirstItem("License_Cert")
' Add a couple of lines to the rich text field before re-attaching the file
Call rtItem.addNewLine(2)
Else
Set rtItem = New notesRichTextItem(doc, "License_Cert")
End If
result = path + "Certificate of Compentency for " + names + ".pdf"
Call rtitem.Embedobject(EMBED_ATTACHMENT, "", result)
result = path + "Some other pdf.pdf"
Call rtitem.Embedobject(EMBED_ATTACHMENT, "", result)
It is totally normal for Notes to create multiple items with the same name, if the size of the content is larger than a specific value, just check the "Body" item in any bigger mail...
Upvotes: 2