Skip to main content

Fill Template (HTML)

Overview​

The Fill Template (HTML) node generates a dynamic HTML document by populating an uploaded HTML template (.html or .htm) with values from workflow properties and tabular data from an incoming DataFrame.

It performs two automated replacement phases:

  1. Table Injection: Replaces the ${TABLE} placeholder with a styled HTML table built from the incoming dataset.
  2. Variable Replacement: Replaces all workflow property placeholders (e.g., ${CUSTOMER_NAME}, ${ORDER_DATE}) with their runtime property values.

The resulting output is emitted as a NodeFile, ready to be attached to emails, converted to PDF, or published to external systems.

Purpose​

Use this node when:

  • Creating personalized HTML email bodies or report layouts (such as invoices, delivery notes, or status alerts).
  • Embedding dynamic database query results or data preparation tables into a branded HTML template.
  • Generating lightweight, styled HTML documents without writing custom server-side scripts.
  • Feeding rendered HTML into downstream PDF nodes (such as PDF conversion or signing) for document publishing.

Configuration​

Double-click the node on the canvas to open its configuration dialog:

FieldRequiredDefaultDescription
HTML-Template fileYesNoneThe base HTML template file (.html or .htm). Click BROWSE... or drag-and-drop a file from your local machine.
Table StyleNoTableGridThe visual style applied when generating the HTML table for ${TABLE}.

Table Styles​

When injecting tabular data into ${TABLE}, B2Win Suite formats the table using inline CSS according to the chosen Table Style:

Style NameValueDescriptionStyling Details
Standard grid table with borders (default)TableGridClassic data grid with distinct bordersSolid 1px black border (#000000) on table, header cells, and data cells.
Simple table without bordersTableNormalClean, borderless tableBorderless layout with padded cells and bold headers.
Light shading table styleLightShadingSubtle light-gray shaded tableLight-gray border (#CCCCCC), #F2F2F2 header background, bordered data cells.
Light grid table styleLightGridFine gray grid lines#CCCCCC grid borders on all cells with #F2F2F2 headers.
Medium shading table styleMediumShading1Higher contrast shaded headersBlack cell borders (#000000) with darker gray header background (#D9D9D9).
Colorful grid table styleColorfulGridBranded blue grid layoutVibrant blue border (#4A90D9), blue header background with white text (#FFFFFF).
Professional table styleTableProfessionalExecutive report presentationCharcoal border (#666666), #E8E8E8 header background with 2px bottom border, subtle row dividers.

Inputs​

Port NameTitleData TypeDescription
inputDataFrameinputNodeFileDataFrameThe tabular dataset (from Query, Visual Query, Data Prep, CSV Import, etc.) that will populate ${TABLE}.

Outputs​

Port NameTitleData TypeDescription
outputNodeFileoutputNodeFileNodeFileA NodeFile containing the generated .html document with all variables and tables filled in.

Processing Logic​

The node executes the following pipeline at runtime:

1. Template Validation & Ingestion​

  • Confirms the uploaded file exists and has a .html or .htm extension.
  • Reads the template content using UTF-8 character encoding.

2. Table Injection (${TABLE})​

  • If the template contains the token ${TABLE}, the node queries the incoming DataFrame via DuckDB (SELECT * FROM read_parquet(...)).
  • Column headers are resolved from the node schema descriptions (or default column names if descriptions are not set).
  • An HTML table (<table class="html-builder-table">) is constructed with the selected Table Style.
  • All cell text and header values are automatically HTML-escaped to prevent formatting errors and XSS vulnerabilities.
  • If ${TABLE} is present in the template but no table data is supplied to the input port, the placeholder remains untouched.

3. Property & Variable Replacement​

  • Collects all available iteration properties and node properties from the workflow context (input.getIterationAndNodeProperties).
  • Placeholders must follow the ${VARIABLE_NAME} format, where names contain alphanumeric characters and underscores ([A-Za-z0-9_]+).
  • Sorts variable keys by length in descending order to prevent partial keyword collisions (for example, ensuring ${CUSTOMER_ID} is evaluated before ${CUSTOMER}).
  • Replaces each ${PROPERTY_NAME} token with its HTML-escaped string value:
    • If a matched property has a null value, the placeholder is replaced with an empty string ("").
    • If a placeholder has no corresponding property defined in the workflow, it is left unchanged in the document (e.g., ${UNKNOWN_FIELD}), and a warning is recorded in the execution log.

4. Output Generation​

  • The generated HTML file retains the exact filename of the uploaded template file (e.g. order-summary.html) and is saved in the execution's working directory. Use a Rename File node downstream if you need a dynamic, timestamped, or customer-specific filename.
  • Emits the output as a NodeFile on the output port.

Template Syntax & Example​

Template File (order-summary.html)​

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Order Confirmation</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; color: #333; }
h1 { color: #0056b3; }
.header-box { background: #f8f9fa; padding: 15px; border-radius: 4px; margin-bottom: 20px; }
</style>
</head>
<body>
<h1>Order Summary</h1>

<div class="header-box">
<p><strong>Customer:</strong> ${CUSTOMER_NAME}</p>
<p><strong>Order ID:</strong> ${ORDER_ID}</p>
<p><strong>Date:</strong> ${ORDER_DATE}</p>
</div>

<h2>Purchased Items</h2>
${TABLE}

<p><strong>Total Amount:</strong> $${TOTAL_AMOUNT}</p>
<p>Thank you for your business!</p>
</body>
</html>

Workflow Configuration​

  1. Connect a source node (such as a database query returning line items) to the Fill Template input port.
  2. In the node dialog, upload order-summary.html.
  3. Choose a Table Style (e.g. ColorfulGrid or Standard grid table with borders).
  4. Ensure upstream nodes or workflow properties define CUSTOMER_NAME, ORDER_ID, ORDER_DATE, and TOTAL_AMOUNT.
  5. Connect the output port to an email node (e.g., Send Email (SMTP) or Send Email (Outlook)) or a PDF conversion node.

Notes & Limitations​

  • Supported File Types: Only .html and .htm template files are supported. For Word documents, see Fill Properties (Word); for Excel workbooks, see Fill Template (Excel).
  • Single Table Injection: The ${TABLE} token injects the entire incoming DataFrame. If multiple separate tables are needed, split them into separate workflow steps or pre-aggregate the data.
  • HTML Escaping: Variable values and table cell contents are automatically HTML-escaped (e.g. < becomes &lt;), preventing accidental tag injection or malformed document structures.