Convert to HTML
The Convert to HTML task is designed to take an input file (such as a text document, an image, or a spreadsheet) and convert it into a standard web page document (.html), making it available for subsequent tasks.
Configuration
The task configuration allows you to specify the source file and, optionally, the destination for the generated HTML file.
- File to import: Enter the full path of the file to be converted in this field. It can be a static value or, more commonly, a dynamic parameter coming from a previous task or workflow parameters.
Customising the Output Path
The default behaviour of the Output Path depends on how the source file is provided:
- Case 1: Input via Dynamic Parameter When the source file is passed via a dynamic parameter from a previous task or workflow parameters, the converted HTML file is saved in a system-managed directory.
- Case 2: Input via Manually Written Path When you write the full path of an existing file directly in the "File to import" field (e.g., /data/input/report.txt), the converted HTML file is saved by default in the same directory as the source file (i.e., in /data/input/).
Alternatively, by selecting the File path checkbox, you can specify a custom destination. The following fields will be displayed:
- Output path: Enter the folder path where you wish to save the converted HTML file here. This field can also contain a static value or a dynamic parameter.
- Create path if not exists: If this option is enabled, the task will automatically create the folder structure specified in "Output path" if it does not exist. If disabled, the task will fail if the destination folder is not present.
Example: From Excel to Email Report
One of the most useful applications of this task is transforming tabular data, such as a spreadsheet Excel (.xlsx), into an HTML table. This is extremely useful for:
For example, starting from a simple Excel file:
name surname Luca Bianchi The "Convert to HTML" task will transform it into HTML code representing that table. The result will look like this:
<table cellspacing="0" border="0"><colgroup width="79"></colgroup><colgroup width="75"></colgroup><tr><td height="17" align="left" valign=bottom>nome</td><td align="left" valign=bottom>cognome</td></tr><tr><td height="17" align="left" valign=bottom>Luca</td><td align="left" valign=bottom>Bianchi</td></tr></table>This HTML code can be inserted into the "Content" field of an "E-Mail Out" task (with the "HTML Format" option enabled) to send a clear and professional report email.
Output Parameters
Once the task has completed the conversion, it exposes the following output parameters:
- file: Returns the full path of the newly created HTML file (e.g., /path/output/document.html). This parameter is ideal for passing the file to subsequent tasks, such as sending an email with an attachment.
- filename: Returns only the name of the generated HTML file (e.g., document.html).
- result: Indicates the outcome of the operation performed by the task (e.g., "Success" or an error message).
- resultJson: Represents the result of the task execution in JSON format, including general information, configurations, and execution details.