EXPORT DOCUMENT Action
The EXPORT DOCUMENT action exports the specified document into a file on disk. The action has two variations:
1. Export the document or picture contained in an attribute of the Document or Picture Type. Whatever document or picture is stored in the attribute will be exported – no document processing is performed (see Document Management). For example,
EXPORT DOCUMENT Statement.StatementDocument TO FOLDER 'c:/mydocuments'
2. Generate the document from a document template and export the result (see Document Generation). Consider the following rules as an example:
FIND Person WHERE Person.Name='John Smith'
EXPORT DOCUMENT AccountOpeningLetter TO FOLDER 'c:/mydocuments'
In this example AccountOpeningLetter is the name of the document template. If this template has the following line:
Dear <<Person.Name>>,
it will be replaced with the line
Dear John Smith
when the document is exported.
The FOLDER keyword specified after the TO keyword identifies the directory in the file system where the file will be written. If a directory doesn't exist it will be created. The name of the file that the document will be written to will be the name of the original file that the document was created from. Note that if the file with this name already exists in the specified folder, it will not be overwritten. Instead another file with the variation of the original name (for example, originalName0) will be created.
The FILE keyword can be specified instead of the FOLDER keyword. In this case the string after the FOLDER keyword must contain the full path of the file that the document will be exported to. If a file with the specified name already exists it will be overwritten. For example,
EXPORT DOCUMENT AccountOpeningLetter TO FILE 'c:/mydocuments/myfile.doc'
Report documents can be exported in the XLS format rather than the default PDF format:
EXPORT DOCUMENT AccountOpeningLetter TO FOLDER 'c:/mydocuments' AS XLS