Append an image resource or a picture programmatically in a rich text field

Is it possible to append an image resource or a picture programmatically in a rich text field?

Subject: If a third-party solution is an option, take a look at “Import Image 2 Lotus Notes” …

It is programable via LotusScript and let you import all kinds of images into Notes.

http://www.vcode.no/ii2ln

Subject: Append an image resource or a picture programmatically in a rich text field

These are two different issues, assuming that when you say “append an image resource”, you mean append a reference to an existing image resource. Appending a picture in a rich text field is possible in a few different ways with native methods. If the image exists as a file, you can use the front end NotesUIDocument.Import method. If it exists in another rich text field, or if you have to do this from a back end agent, you can try extracting it from that rich text using the NotesRichTextNavigator and then copying it in, but the methods are a bit rough. Appending the image resource reference is trickier, and probably means that you would need to use DXL, as otherwise there are no native methods for working with image resources programmatically. Since DXL is also a way to work with images, you could create the DXL you need and import it for either task. If the image already exists, you could export it with DXL first and re-import just that part of the DXL. It may mean some fairly tricky DOM programming with the DXL.

By the way, I just noticed the other post you made, where you indicate that the image must come from the database and must be mailed. That would also indicate either DXL or…

If you want to do both things more easily, a third party product may be a better answer. Our Midas Rich Text LSX will let you copy an image from another rich text field, import the image from a back end agent, create references to image resources the way Create - Image Resource… does, all using simple methods, in this case the AppendRTChunk method, AppendGraphic method and AppendResource method. The target for any of these can also be almost anywhere in a rich text field, including inside a table cell or even nested table cell, whereas you cannot easily access such targets from the Notes classes. Also, please note that an image from an image resource can be appended as either a reference or as a true image, and you would want the latter if you were mailing the image to someone who did not have access to that database.