Attachments

Attachments are files saved in the UniPlot document similar to attachments in e-mails. Only IPZ files can save attachments. The files can be embedded or linked.

Attachments can be used to display image files (png, jpg, bmp, …) in text objects. Script files, text, Excel or PDF documents or data files can be added to a ipz document. The Edit=>Attachments command can add or remove attachments.

att_open

att_open opens the document attachments or external attachment files.

atts = att_open(hDoc)
atts = att_open(ssAttachmentFilename)

Example

a = att_open("d:/test.ipz");
att_dir(a, "*.jpg");
att_close(a)
a = att_open("d:/test.ipz");
a.dir("*.jpg");
a.close()
// att_close(a)

att_close

att_close closes the attachments. Before a document is saved, the attachments must be closed.

If the atts pointer is set to 0 (atts = 0) or atts is a local variable, att_close will be invoked automatically.

bool = att_close(atts)

att_add_file

att_add_file copies a file from the hard drive into the attachments. If bLink is TRUE (1) only a link will be created. ret is TRUE (1) or an error object (see error_create).

ret = att_add_file(atts, ssFile, name)
ret = att_add_file(atts, ssFile, name, bLink)

att_add_data

att_add_data

bool = att_add_data(atts, ssData, name)

att_get_data

att_get_data

ssData = att_get_data(atts, name)

att_get_props

att_get_props returns the name/value pairs of the file by the name name.

The following four values should be included in the returned object:

Name Value
Path The complete file name with path, for example "C:\\Images\\Test.png".
Link "0": File is embedded. "1": File is linked.
FileSize Number of bytes (as a string).
FileTime String in the form: "%Y-%m-%d %H:%M:%S", see DT_Format. Example: "2017-04-27 10:43:13,45".
oProps = att_get_props(atts, name)

att_set_props

att_set_props

bool = att_set_props(atts, name, oProps)

att_dir

att_dir

svDir = att_dir(atts)
svDir = att_dir(atts, ssPattern)

att_rename

att_rename renames an attachment.

bool = att_rename(atts, name, new_name)

att_move

att_move moves an attachment into a different directory.

bool = att_move(atts, name, path)

att_delete

att_delete removes an attachment.

bool = att_delete(atts, name)

att_export

att_export saves the given attachments in a specified path on the hard drive.

bool = att_export(atts, svNames, ssPath [, options])
options = [. flat = 1, bFailIfExists = 1, bWriteEvent = 1]

att_save

att_save saves a file in an attachment file or IPZ document.

bool = att_save(atts, svNames, ssAttachFile, bOverwrite)

att_load

att_load copies an attachment from the attachment file attsSource into the open file. If bOverwrite is TRUE (1) (default value is FALSE (0)) attachments with identical names are overwritten. Otherwise they will be ignored.

bool = att_load(atts, svNames, attsSource)
bool = att_load(atts, svNames, attsSource, bOverwrite)

Example

a = att_open(hDoc);
aSrc = att_open("d:/test.ipz");
svNames = aSrc.dir("*.jpg");
a.load(svNames, aSrc);
a = aSrc = 0; // close

att_dialog

att_dialog displays the attachment dialog box.

bool = att_dialog(atts)
bool = att_dialog(atts, ssPattern)

Beispiel

def test_attachments()
{
}

Comment

History

Version Description
R2017 New.

id-686295