In logic, a
Document object facilitates the storage of text or binary files. Unlike CSPro data files, or text files (accessed via
File), the contents of a Document cannot be directly edited.
Function | Description |
load | Reads a file and stores its contents in the Document object. |
save | Writes the contents of the Document object to a file. |
view | Displays the contents of the file held by the Document object. |
clear | Clears the Document object's contents. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns the symbol's value represented in JSON. |
updateValueFromJson | Modifies the symbol based on a JSON representation of the value. |
In addition to these object functions, Document objects can be used as arguments to the
filename and
view functions.
Document objects can be assigned to other Document objects, which will replace the Document's contents with the contents from the assigned Document object.
document_name = another_document_name;
It is also possible to assign
Audio,
Geometry, and
Image objects to a Document. These assignments will always succeed.
document_name = audio_name;
document_name = geometry_name;
document_name = image_name;
You can also make the reverse assignment, assigning a Document to an Audio, Geometry, or Image object. A runtime error will occur if the Document's data cannot be converted to those objects.
audio_name = document_name;
geometry_name = document_name;
image_name = document_name;
You can assign a string expression to a Document object, which will replace the Document's contents with the text, as if the contents had been read from a text file.
document_name = "string expression";