Hi all,
My ultimate goal here is to get the inline image stored in a rich text field named graphic, and have it displayed in a program written in VB. The program cycles through the documents in a database.
I’ve got an agent that basically copies the image from the field to the clipboard. It works. When I run it, I can click into another application and paste the image in. Here it is:
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
uidoc.EditMode = True
Call uidoc.Save()
Call uidoc.GoToField("graphic")
Call uidoc.SelectAll()
Call uidoc.Copy()
I want to be able to call this from VB. The relevant parts of the code I"m working with so far are:
Dim NotesSession As New NotesSession
Dim dbNotes As NotesDatabase
Dim doc As NotesDocument
Dim item As NotesItem
Dim view As NotesView
Dim agent As NotesAgent
NotesSession.Initialize("")
dbNotes = NotesSession.GetDatabase("TONNOTES1", "XPEOFFL.NSF")
view = dbNotes.GetView("Manufacturing or Quality Concerns")
agent = dbNotes.GetAgent("CopyToClipboard")
item = doc.GetFirstItem("graphic")
agent.Run()
Dim fileName As String
fileName = "c:\imageNotFound.bmp"
If Not System.Windows.Forms.Clipboard.GetDataObject() Is Nothing Then
Dim oDataObj As IDataObject = System.Windows.Forms.Clipboard.GetDataObject()
If oDataObj.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap) Then
Dim oImgObj As System.Drawing.Image = oDataObj.GetData(DataFormats.Bitmap, True)
'To Save as Bitmap
oImgObj.Save("c:\currentImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
'To Save as Jpeg
'oImgObj.Save("c:\Test.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
'To Save as Gif
'oImgObj.Save("c:\Test.gif", System.Drawing.Imaging.ImageFormat.Gif)
filename = "c:\currentImage.bmp"
End If
End If
ShowMyImage(fileName, 728, 684)
So basically, if this worked, it would run the agent on the document it was currently on, then save what was on the clipboard to a temporary file which it would display in another method.
When I run this code, I get the following exception:
"System.Runtime.InteropServices.COMException(0x80040FA0): Notes error: LotusScript Error - Cannot load resource string or resource file missing (nse* nsk*, etc). at Domino.NotesAgentClass.Run(String pNoteid) at Schedulina.OffLineIssue.DisplayDocument(Int32 docNumber,String fileToDisplay) in C:\blah blah blah. vb:line 112
So it’s saying that I’m getting a lotus script error, but I get no error when I run this from notes.
Any ideas?