Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs







Recent posts

Wed 18 Sep 2019

Perils of PDF 5: Data Confusion



Mon 16 Sep 2019

About that email in Notes



Mon 9 Sep 2019

Perils of PDF 4: Missing and obscured data


November, 2019
SMTWTFS
     01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search the weblog





























Genii Weblog

Using image resources from another db with Midas

Wed 27 Apr 2005, 11:19 PM



by Ben Langhinrichs
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.

What has been said:

No documents found