Wonder whether any of you have any idea or solution to this problem i am currently facing. I have a couple of fields in my form which are richtextitem,text. But there are 2 richtextitem fields whereby the users save pictures onto this fields. So now i need to extract these pictures or values out from this richtextitem fields. Unlike the other text fields i notice there are no data present in these richtextitem fields even though the picture can be seen when you open the form. Wonder whether any of you have an idea on how to extract these values from these richtextfields out using Java or Lotus Notes Script (personally prefer Java). I tried to you embeddedobject but it always prompt for empty vector or no value inside this field. Hope you can reply soon cheers.
The images don’t appear in the Text property because they are not text.The other NotesRichText… classes unfortunately don’t include one to handle images.
I’m not sure what you mean by “extract” the images. What are you going to do with them?
Check that they are there?
Add them to some other rich text item somewhere else?
Store them as a file?
You can get the image data out of the note using DXL, but then you have to use an XML parser to extract out the relevant data and convert the image from base64 to the original binary data. Also note that some images are encoded in a Notes-specific format, so you may have to use the ConvertNotesBitmapsToGIF property.
For converting the base64 to binary, you can use the NotesMIMEEntity class (even though the rich text is not MIME – you just leverage the base64 conversion by creating a temporary document in memory).
A little more information about what you’re doing, would be helpful.
If the pictures are inline -that is, they are pasted into the field and not attached, then you can get the image properties using DXL, the Notes XML DTD. you need to export the XML using the DXLexporter class.
Here is an example:
Dim session As New NotesSession
Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim imgwidth As String
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set exporter = session.CreateDXLExporter
'Get the XML for the Inline image so we can anaylise the image data...
out = exporter.Export(doc)
find1="<item name='conImage'"
find2="</item>"
findpic1="<picture"
findpic2="</picture>"
rtstart=Instr(out, find1)
rtstart2=Instr(rtstart, out, findpic1)
If rtstart2 = 0 Then
'There is no image in the conImageField, so skip
Exit Sub
End If
rtfinish2=Instr(rtstart2, out, findpic2)
xmltag = Mid(out, rtstart2, rtfinish2-rtstart2+Len(findpic2))
If Instr(xmltag,Chr$(10)) Then
'Remove Line Feeds
xmltag = Replace(xmltag,Chr$(10),"")
End If
But if the images are ATTACHED, then use the EmbeddedObjects Property of the NotesDocument Class. Here’s another Tip… attachments are stored in the a hidden $File field in the document.
Thanks you guys for your response, basically to answer your query Andre,The main point is able to extract these images from these richtextitem fields to be inserted into Sql Server 2005 field with
a data type of binary or image. DXL sorry relatively new to lOtus notes, but is it possible to be able to write in Java as it seems it requires LotusScript. And yeap Steven, your code is for pictures that are inline but what if the pictures are
attached is it still possible to be extracted out as binary to be inserted into Sql Server? thanks for all the advice so fast. Cheers.
All the classes you might use for this in LotusScript, are also available in Java, except NotesUIDocument. If this is a back-end process, there’s no reason you couldn’t use Java.
Thanks you guys, i manage to extract that data but wondered how to decipher the data and insert into sql server 2005 image data type. And if it is base64 data, how do i change to bytearray in Java or LotusScript?