Image As rtGraphic
Represents file attachment in rich text item. Does not deal with V2 type attachments directly in document (not contained in item).
Modified, Created and FileSize returns attached file properties.
rtAttachment differs from other rich text elements that it needs a background document to maintain the attachment.
The attachment may be created either by setting FilePath property (in this case it will be created during writting of rtAttachment to document) or using attachFile method - in this case it will be created at once.
Any other rich text element in rtLib after it has been retrieved using getRichTextItem method becomes independent from item and document it was located. The source document may be deleted in meantime it does not influence the objects already retrieved.
The container may be written back to any other document and no changes will appear in any document until item has been written using ReplaceItemValue or AppendItemValue methods and document saved.
In opposite rtAttachment controls just a link to the correct file information item - $FILE.
The document that contains the $FILE must be preserved (can not be deleted or unloaded using Delete keyword) in order to use extractFile method. The document containing $FILE is:
1) in case rtAttachment is retrieved from a document - this same document
2) in case the rtAttachment object is written to (other) document, this new document
3) in case attachFile (filepath, docTmp) method is used to create a new attachment, $FILE is stored in docTmp or in case instead of docTmp is provided Nothing, in document from either first of 2 cases.
4) in case the rtAttachment object has been created using new keyword and instead of using AttachFile method property FilePath has been set, the actual file will be attached only at the moment the rtAttachment object is being written to the document. Consequently the attachment exists only after calling ReplaceItemValue or ApendItemValue and the target document
becomes the document containing $FILE .