Working with attachments and embedded objects in Java classes

File attachments and embedded objects are represented through the EmbeddedObject class.

Note: Embedded objects and object links are not supported for OS/2, UNIX, and the Macintosh. File attachments are.

To access an attachment in a rich text item, do one of the following:

To access an embedded object in a rich text item, do one of the following:

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:

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.