Modern vs. Classic DOCX engine

We’re excited to introduce our new Modern Word DOCX templating engine in Plumsail Documents, a significant upgrade that builds upon the strengths of our Classic templating engine. This article explains the differences between the two.

Key differences

The Modern engine retains the data-driven approach of the Classic engine while allowing for easy data structure mapping and calculations directly within your templates. This eliminates the need to pre-process your data and simplifies integrations with third-party systems. It also features advanced conditional hiding logic, allowing you to conceal entire document blocks rather than collapsing individual pieces of data.

With calculated properties and an advanced expressions evaluator at its core, the Modern engine maximizes functionality while minimizing efforts. It’s everything you love about the Classic engine, only better—making complex scenarios easier to implement.

Note

Modern engine is currently only available in Processes. To enable it, navigate to template settings and select ‘Modern’ under the Template engine setting.

Data transformation

The primary difference is how each engine handles data preparation. In the Classic engine, data transformation was limited. You could create temporary names (aliases) for data already in your data source, but you couldn’t modify the source data itself.

The Modern engine lets you modify your original data before it’s used to generate the document. This is achieved through calculated properties. You can reorganize, recalculate, or reformat your data within the template.

Conditional content

In the Classic engine, conditional hiding often requires workarounds, such as using the map formatter, especially in complex scenarios.

The Modern engine offers direct control with logical operations like #hide-if and #if / #else blocks:

  • #hide-if is local, affecting only the closest repeatable object;

  • #if allows to conditionally include/exclude entire blocks of data.

Value manipulation

Beyond simply presenting data, you often need to format it or perform calculations. The Classic engine offers basic value formatters for this purpose.

The Modern engine uses value functions. These functions offer the same capabilities as the Classic engine’s formatters, along with the ability to perform calculations, manipulate text, and work with lists.

Operations

The Modern engine introduces object operations and logical operations. Object operations let you add Word-specific objects, while logical operations control how template markup is created based on your data.

Some value formatters such as picture, barcode, qrcode, and html migrated from the Classic engine to object operations in the Modern engine.

Syntax

Let’s look at some examples to understand the syntax differences between the Classic and Modern engines.

Classic

Modern

{{items}:sum()}

{{sales}:sum(value.quantity * value.price)}

{{value}:barcode(CODE128, 200, 100)}

{{count}:hide-block-if(value == 1)}

{{date}:offset(10.1\:5\:10)}

{{deliveryType}:map("1" = "Physical", "2" = "Digital")}
{{items|sum()}}

{{sales|sum(@value.quantity * @value.price)}}

{{#barcode value CODE128 200 100}}

{{#hide-if count == 1}}

{{date|offset(10.1:5:10)}}

{{deliveryType|map("1" => "Physical", "2" => "Digital")}}

Summary

The Modern engine provides the most up-to-date tools for creating complex and self-contained templates. It will streamline your template-building process by allowing you to transform data, insert objects, and control conditional content. We recommend using it in all your new projects.

Learn more

Check out the documentation for each templating engine at the following links: