How to get attachement from a rich text field

I have a form X in that I have to get image and text from another form. For this what I am doing is I have created form y and place two rich text fields .In one richtext I am keeing image and in second one I am placing text . I am using one view and for these fields through abstract function I am getting the value of text value but I am not able to get image.In form X I have place two fields and using dbcolumn getting form y values but text only coming image is not coming in the form.Can you please help me out regarding this.It’s urgent.

Subject: How to get attachement from a rich text field

probably you have embedded image not attachment. you will not be able to display image in a Notes view, unless you use the image resource, but then that limits the possible applications.

Other than that - if you want to keep your images and text in source document and you need to get them when you for example create a new doc, then the only sure way to do this is to use a lotusScript and to do a lookup by some key, then get rich text items with image and text and use CopyItemToDocument and/or AppendRTItem to merge them in place.

And yes, if it is really an attachment not imported/pasted image other posts may already have the answer.

You can have limited success with @Dblookup, but it depends on size of your image, so it’s better not to spend time to try to make this approach work…

Subject: How to get attachement from a rich text field

Your question is a little strange.

Forms are just representations of data in documents.

Views are also representations of data in documents.

So your dbcolumn is getting information from a view.

You need to get the attachment from a document.

Is Form X opening the document with the attachment?

Or is the attachment on another document?

Is Form Y required or is this just something you have tried to use to solve the problem?

Also, do you just want to just show the attachment to the user rather than actually copy it from another document into the existing document the user is working on?

There are a number of options to get the attachment once you have the document. The ease depends on if you know the attachment name or if you know the RichTextField name.

If you know the name of the file then…

Set notesEmbeddedObject = notesDocument.GetAttachment( fileName$ )

If not…

Use the NotesRichTextNavigator methods in conjunction with the type RTELEM_TYPE_ATTACHMENT

Or use the EmbeddedObjects property of NotesRichTextItem

Subject: How to get attachement from a rich text field

Define the rt-field (in the example=“body”) as NotesRichtextitem.This example takes the Body and copies it to a new document.

You don’t have to handle the attachment image and the attachment name separately!


Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim doc2 As NotesDocument

Dim item As NotesItem

Dim nrit As NotesRichTextItem 'DECLARED for BODY

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

Set db = session.CurrentDatabase

Set doc2 = New NotesDocument(db)

Set item = doc.GetFirstItem(“Title”)

Call item.CopyItemToDocument(doc2, “Subject”)

’ Set item = doc.GetFirstItem(“Reviewers”)

’ Call item.CopyItemToDocument(doc2, “SendTo”)

Set nrit = doc.GetFirstItem(“Body”)

Call nrit.CopyItemToDocument(doc2, “Body”)

call doc2.save(true,false,true)


Regarding your other post I think that you try to do strange things in a complicated way…

Why do you need to copy the attachment? Is it still to make it ‘readonly’?

A hint for testing: copy your form (let’s say ‘FORMX’) and name it ‘FORMX_Read’

Edit the design and make the attachment field ‘Computed’ (Fieldname as value)

Now you can open a document and click ‘View’ ‘Switch Form’ to FORMX_Read → the attachment field is read-only

For future use:

You create 2 subforms (Sub1 and Sub1Read) with the the desired Field: in Sub1 the field is editable and in Sub1Read it’s computed.

In your form you insert a subform based on formula. The formula would look like this: “Sub1”+@if(@IsMember(@UserRoles;“[Admin]”);“”;“Read”)

→ This uses the SubFrom ‘Sub1’ if a user with the 'Admin-Roles opens the Form. All others get ‘Sub1Read’