Engee documentation
Notebook

Generating reports in DOCX format

Based on Engee scripts, you can create Word documents with a title page, which automatically contain all the output data of the document, as well as text, code, and script execution results.

Description of the example

In this project, we demonstrate how to organize the export of a limited list of information from the Engee script (interactive script .ngscript) to a file .docx. Since we will be broadcasting live from one format to another, our translator will have some limitations, in particular:

  • the entire text, headings, code, images and graphs get into the document from the script.,
  • formulas are partially translated - the translator supports special signs, ratio operators, degrees, subscripts and fractions,

As it runs, the script first loads the output information of the document from the config.toml file. This allows us not to overload the report generator startup command with an extended number of arguments, although they can also be specified as additional parameters.

  1. Set the following commands as arguments generate_report
  2. Store in the accompanying file config.toml
  3. Place the config.toml file in one of the cells (text, as an inset, or code, as a comment)

The translator creates a file template.docx (if it is not already in the current directory). You can download and edit it.

After loading the parameters and creating the initial template, our algorithm fills the template with lines from the specified file. .ngscript.

Running the report Generator script

The report can be generated with a single command:

In [ ]:
include("scripts/generate_report.jl")
generate_report("notebook_test.ngscript", output_path="Отчет.docx")
(+) The report has been created: Отчет.docx

Conclusion

This small project shows how you can create documentation generators from Engee scripts. After completing it, you can automate the workflow, including the generation of snapshots of models and the import of data from other related files.