Working with attachments and embedded objects in Java™ classes
File attachments and embedded objects are represented through the EmbeddedObject class.
To access an attachment in a rich text item, do one of the following:
- Use the RichTextNavigator methods in conjunction with the type RichTextItem.RTELEM_TYPE_ATTACHMENT. An element obtained in this manner is an object of type EmbeddedObject whose Type property is EmbeddedObject.EMBED_ATTACHMENT.
- Use the EmbeddedObjects
property of RichTextItem. This property is a vector of objects
of type EmbeddedObject.
Use the vector elements whose Type property is EmbeddedObject.EMBED_ATTACHMENT.
To access an embedded object in a rich text item, do one of the following:
- Use the RichTextNavigator methods in conjunction with the type RichTextItem.RTELEM_TYPE_OLE. An element obtained in this manner is an object of type EmbeddedObject whose Type property is EmbeddedObject.EMBED_OBJECT or EmbeddedObject.EMBED_OBJECTLINK.
- Use the EmbeddedObjects
property of RichTextItem. This property is a vector of objects
of type EmbeddedObject.
Use the vector elements whose Type property is EmbeddedObject.
EMBED_OBJECT or EmbeddedObject.EMBED_OBJECTLINK.
To create an attachment or embedded object in a rich text item, use embedObject of RichTextItem.
The HasEmbedded property of Document indicates whether a document contains any attachments or embedded objects.
To get all the embedded objects in a document, including objects that were originally embedded in the form from which the document was created, use the EmbeddedObjects property of Document.
To locate pre-R4 file attachments not associated with a rich text item, get all the items in the document, for example, by using the Items property of Document. Test the Type property of each item for Item.ATTACHMENT. To get an attachment of this type, use the getAttachment method of Document.
The following methods of EmbeddedObject apply to both attachments and embedded objects:
- getName (String)
returns the reference name for the object.
- getParent (RichTextItem) returns the rich text item that contains the object.
- getSource (String) returns the file name for attachments and the ND internal name for embedded objects.
- getType (int) returns EmbeddedObject.EMBED_OBJECTLINK, EmbeddedObject.EMBED_ATTACHMENT, or EmbeddedObject.EMBED_OBJECT.
- remove removes the object from its rich text item.
The following methods of EmbeddedObject apply to attachments only:
- getFileSize (long) returns the byte size of the file.
- extractFile writes a file attachment to a file.
The following methods of EmbeddedObject apply to embedded objects only:
- getClassName (String) returns the name of the application that created the object.
- getObject (Variant) returns the OLE handle for the object, if it is in memory.
- getVerbs (Vector of type String) returns the verbs supported by the object.
- activate loads the object and returns a handle to it.
- doVerb executes an object verb.