Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Wed 27 Apr 2005, 11:19 PM
A question came up tonight about using the AppendResource method from the Midas Rich Text LSX  to include an image resource from a different database into the rich text.  It so happens that this is available, although not documented, because we added it to Midas before Domino Designer allowed this, when the remote db was only identified in the API and was not documented.  I didn't know whether support for this would make it into the final product (this was during ND6 betas), so I didn't document the properties, but ND6 has been out, and has allowed remote image resources, for a long time, so here goes.  I will adjust the documentation, but in case you ever wondered, here is how you do it.  The script in this case adds the connectionwizard.gif image resource from the local address book.  Let me know if you have any questions.

Sub Initialize
   Const IMAGE_RESOURCE_DB = "names.nsf"
   Const REMOTE_IMAGE_RESOURCE = "connectionwizard.gif"
 
   ' *** Domino back-end class objects
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim remote_db As NotesDatabase
 
   ' *** Midas Rich Text LSX back-end class objects
   Dim rtitem As New GeniiRTItem
   Dim rtchunk  As GeniiRTChunk
   Dim remote_rtitem As New GeniiRTItem
   Dim remote_graphic As GeniiRTChunk
 
   ' *** Miscellaneous processing variables
   Dim fileName As String
   Dim pathName As String
   Dim pos As Integer
   Dim text As String
   Dim image_name As String
 
   Set db = session.CurrentDatabase
   Set doc = session.DocumentContext
 
   Set remote_db = New NotesDatabase("", "")
   Call remote_db.Open("", IMAGE_RESOURCE_DB)
   Call remote_rtitem.ConnectImageResource("", IMAGE_RESOURCE_DB, REMOTE_IMAGE_RESOURCE)
   Set remote_graphic = remote_rtitem.DefineChunk("Graphic 1")
 
   Call rtitem.ConnectBackend(doc.Handle, "Body")
   ' *** Follow model of "imagename" image:
   Set rtchunk = rtitem.DefineChunk("Everything")
   Call rtchunk.AppendResource("Image", REMOTE_IMAGE_RESOURCE, |ReplicaID="|+remote_db.ReplicaID+|" FilePath="|+IMAGE_RESOURCE_DB+|" ImageWidth="|+Cstr(remote_graphic.GraphicWidth)+|"  ImageHeight="|+Cstr(remote_graphic.GraphicHeight)+|"|)
   rtitem.Save
End Sub

Copyright © 2005 Genii Software Ltd.