How can I add a picture from a file to a rich-text item using LotusScript?
Posted on 2004-07-30
I have a form with a hotspot action. When clicked, it will show an OpenFileDialog, so the user can select a picture file. When the user made his selection, I want the content of the file to be put into a hidden rich-text item with the name Logo. Is there a method to Import the file into the rich-text item? The existing Import method needs an open NotesUIDocument with the focus in the rich-text field, but I want to get the picture myself. In fact, the document is shown using a form in a DialogBox, hence rich-text fields cannot be used.
Here's what I tried:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim files As Variant
Dim doc As NotesDocument
Dim rtitem As Variant
Dim eo As notesEmbeddedObject
files= ws.openfiledialog(False, "Select picture file", "All pictures|*.jpg;*.jpeg;*.gif|JPEG|*.jpg;*.jpeg|GIF|*.gif|Bitmap (not recommended)|*.bmp|All files|*.*|")
If Isempty(files) Then Exit Sub
Set doc= ws.CurrentDocument.Document
Set rtitem= New NotesRichTextItem(doc,"Logo")
Set eo= rtitem.EmbedObject( 1453, "", files(0))
How to do this?