{{tag>Index Action Action_List Process Documents Files}} ====== EXPORT DOCUMENT ====== This action exports the specified document into a file on disk. The action has two variations: ''EXPORT DOCUMENT'' AttributeIdentifier() ''TO'' ( ''FILE'' or ''FOLDER'' ) ArithmeticOperation() The action written in this format exports the contents of the attribute of the specified business object, provided that this attribute is of the Document or Picture type. Whatever document is stored in the attribute will be exported – no document processing is performed. For example, EXPORT DOCUMENT Statement.StatementDocument TO FOLDER 'c:/mydocuments' * ''EXPORT DOCUMENT'' (Id() | StringLiteral())''TO'' ( ''FILE'' or ''FOLDER'' )ArithmeticOperation() where Id() or StringLiteral() is the name of the document template to be exported. Before the document template is displayed the action will calculate and fill in attribute values used inside tags in the template (see also the “[[docs:2000_concepts:0900_prod_feats:0200_working_with_docs_reports:0200_doc_gen|Document Generation]]” section. Consider the following rules: FIND Person WHERE Person.Name='John Smith' EXPORT DOCUMENT AccountOpeningLetter TO FOLDER 'c:/mydocuments' where ''AccountOpeningLetter'' is the name of the document template. If this template has the following line: Dear <>, it will be replaced with the line Dear John Smith when the template is exported. The ''FOLDER'' keyword specified in the arithmetic operation after the ''TO'' keyword identifies the directory in the file system where the file will be written. If the directory doesn’t exist it will be created. The result of the arithmetic operation must be a string. 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. If the ''FILE'' keyword is specified, then the arithmetic operation must contain the full path of the file that the document will be exported into. If a file with the specified name already exists it will be overwritten. AS XLS keyword can be used to export reports in the XLS format rather than the default PDF format