Genii Software's Search & Replace!

The Midas Rich Text LSX gives you the power to search and replace in rich text fields, not only with specific strings but also using wildcards. Specify a word or phrase to search for in the rich text field below, and another word or phrase to replace it.

Search for: 
 
Replace with: 
 
Options: 
 

TECHNOTE - Midas Rich Text LSX 2.10+
Creating an Image Resource programmatically

Image Resources have proven to be a powerful, versatile feature in Notes/Domino R5, but one critical issue for many companies has been the inability of regular Notes client users to create Image Resources without using the Designer. This technote describes how to create an Image Resource using the Midas Rich Text LSX, given nothing more than an image file. This allows a developer to give anyone, even a web browser client, the ability to create Image Resources.

Image Resource

An Image Resource is stored as a special design note that is similar to a form or page except that it may only contain a single graphic image. This image may then be used on pages, forms and documents by creating an Image Resource link. The Midas Rich Text LSX gives a developer the ability to connect to an Image Resource that exists using LotusScript, and the ability to clone the Image Resource and modify the graphic. Therefore, there must be at least one Image Resource available in a database in order to use this script.

Installing / Using this Sample:
In this sample, we will show how a background agent could be used to create an Image Resource from an graphic file. This same logic could be used from a web client pulling in a document loaded through a File Upload control, with only minor changes. Additional information and samples are available from Genii Software either on our website at http://GeniiSoft.com or by request at Support@GeniiSoft.com. Free evaluation licenses are also available from our website or by filling out our on-line request form at http://GeniiSoft.com/showcase.nsf/WebEvalRequest.

Submitted by:
Ben Langhinrichs of Genii Software
Show details for Example (full agent code)Example (full agent code)
Hide details for Example (full agent code)Example (full agent code)

'5.0 - Create Image Resource from an agent

Option Public
Option Declare
Uselsx "*lsxrtc"  


Sub Initialize
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim collection As NotesDocumentCollection
 Dim doc As NotesDocument
 Dim noteid As String
 
 Dim rtitem As New GeniiRTItem
 Dim rtchunk As GeniiRTChunk
 
 Set db = session.CurrentDatabase
 
 ' *** Connect to a cloned copy of the Image Resource with the specified name
 Call rtitem.ConnectImageResource(db.Server, db.FilePath, "index.gif", "garfield.gif")
 Set rtchunk = rtitem.DefineChunk("Graphic 1")
 
 ' *** Append a graphic after the current graphic
 Call rtchunk.AppendImportFile("c:\temp\garfield.gif")
 
 ' *** Remove the original graphic (which is still Graphic 1, as is this chunk)
 rtchunk.Remove
 
 rtitem.Save
 
 ' *** Grab the documentby NoteID and change other fields as desired
 noteid = rtitem.NoteID
 Delete rtitem
 Set doc = db.GetDocumentByID(noteid)
 doc.~$ImagesHigh = 2
 doc.~$ImagesWide = 1
 Call doc.Save(True, False)
End Sub






Anonymous
44.206.248.122