Formatting in Word Template

While generating documents you may want to apply formatting to a dynamically populated result - like a resulting value of an expression. Using PDF4me, you can easily apply formatting to the results of your condition or expression.

Let us look at an example to see how these formatting can be applied-

Basic Syntax

The basic syntax for applying formatting -

<<[token]:"format">>

We can look at how we can format the date-time expression results.

Suppose we want an output result like -

Invoice Date: 12.09.2022 instead of 2022/09/12

We need to create the template like -

Invoice Date:  <<[invoiceDate]:"dd.MM.yyyy">>

and the Data can be -

{
  "vendorName": "Ynoox GmbH",
  "invoiceDate": "2022/09/12"
}

Types of Formatting

String Formatting

You can format strings or text to be populated in your document using the following formats.

<<[token]:upper>>

Converts a string to upper case

<<[token]:caps>>

Capitalizes the first letter of every word in a string

<<[token]:firstCap>>

Capitalizes the first letter of the first word in a string

Date Formatting

<<[token]:"dd MMM yy H:mm:ss">>

E.g 15 Dec 12 10:10:21

<<[token]:"dd-MM-yyyy">>

E.g 15-12-2022