Template Engine Reference
Comprehensive documentation for the LogicPaper formatting engine. Learn how to transform raw Excel data using Jinja2 Pipes directly inside your Word, PowerPoint, Markdown or Plain Text templates.
Default Behavior
What happens if I don't use a formatter?
If you use {{ variable }} without a pipe (|), LogicPaper inserts the Raw Data exactly as it appears in the Excel cell.
Examples:
- Dates may appear as
2023-12-25 00:00:00. - Money may appear as
1500.5(no symbol, no comma). - Empty cells will appear as empty strings.
Chaining & Composition
You can apply multiple operations in a single filter by listing them as arguments. Operations are executed sequentially from left to right.
" john doe "
"MR. JOHN DOE"
String Strategy
Filter Name: format_string
| Operation | Full Template Syntax (Click to Copy) | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
| Upper |
{{ val | format_string('upper') }}
|
text "hello" | "HELLO" | Converts entire string to uppercase. |
| Lower |
{{ val | format_string('lower') }}
|
text "HELLO" | "hello" | Converts entire string to lowercase. |
| Title Case |
{{ val | format_string('title') }}
|
text "mr john doe" | "Mr John Doe" | Capitalizes the first letter of every word. |
| Trim |
{{ val | format_string('trim') }}
|
text " data " | "data" | Removes leading and trailing whitespace. |
| Prefix |
{{ val | format_string('prefix', 'Dr. ') }}
|
text "House" | "Dr. House" | Prepends text. 2nd Argument is the prefix string. |
| Suffix |
{{ val | format_string('suffix', ' Esq.') }}
|
text "John" | "John Esq." | Appends text. 2nd Argument is the suffix string. |
| Chained |
{{ val | format_string('trim', 'upper', 'prefix', 'ID: ') }}
|
text " abc " | "ID: ABC" | Composition: Trim → Upper → Prefix. |
Number & Currency
Filter Name: format_number
| Operation | Full Template Syntax | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
| Integer |
{{ val | format_int }}
|
float 15.99 | "15" | Truncates decimals (does not round up). |
| Float |
{{ val | format_number('float', '2') }}
|
num 1500 | "1500.00" | Forces N decimal places (Standard dot notation). |
| Currency (US) |
{{ val | format_currency('USD') }}
|
num 1500.5 | "$1,500.50" | Locale aware formatting for US Dollar. |
| Currency (BR) |
{{ val | format_currency('BRL') }}
|
num 1500.5 | "R$ 1.500,50" | Locale aware formatting for Brazilian Real. |
| Spell Out (EN) |
{{ val | format_number('spell_out', 'en') }}
|
int 42 | "forty-two" | Converts numbers to words. Supports 'en', 'pt', 'es'. |
| Spell Out (PT) |
{{ val | format_number('spell_out', 'pt') }}
|
int 1050 | "mil e cinquenta" | Portuguese text conversion. |
| Humanize |
{{ val | format_number('humanize') }}
|
num 1500000 | "1.5M" | Short scale notation (K, M, B). |
Date Strategy
Filter Name: format_date
| Operation | Full Template Syntax | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
| ISO Standard |
{{ val | format_date('iso') }}
|
date 2025-12-25 | "2025-12-25" | Universal ISO 8601 format. |
| Short (Locale) |
{{ val | format_date('short') }}
|
date 2025-12-25 | "25/12/2025" | Depends on system locale (default pt_BR). |
| Long Text |
{{ val | format_date('long') }}
|
date 2025-12-25 | "25 de dezembro de 2025" | Fully expanded localized date. |
| Custom Pattern |
{{ val | format_date('fmt', '%d/%m') }}
|
date 2025-12-25 | "25/12" | Uses Python strftime syntax. |
| Add Days |
{{ val | format_date('add_days', '7') }}
|
date 2025-01-01 | "2025-01-08" | Arithmetic. Returns an ISO string by default. |
| Complex Chain |
{{ val | format_date('add_days', '1', 'long') }}
|
date 2025-01-01 | "02 de janeiro de 2025" | Adds 1 day first, THEN formats as Long text. |
Logic & Defaults
Filter Name: format_logic
| Operation | Full Template Syntax | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
| Default Value |
{{ val | format_logic('default', 'N/A') }}
|
null (empty) | "N/A" | Used when Excel cell is empty. |
| Status Mapping |
{{ val | format_logic('1=Draft', '2=Final') }}
|
int 2 | "Final" | Maps Keys to Values. Great for Status Codes. |
| Empty If |
{{ val | format_logic('empty_if', '0') }}
|
int 0 | "" | Hides the value if it matches the argument. |
| Fallback Map |
{{ val | format_logic('1=A', 'default', 'Unknown') }}
|
int 5 | "Unknown" | Combines mapping with a default fallback. |
Boolean Strategy
Filter Name: format_bool
| Operation | Full Template Syntax | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
| Yes/No |
{{ val | format_bool('bool', 'Yes', 'No') }}
|
bool TRUE | "Yes" | Arg 1 is True value, Arg 2 is False value. |
| Visual Checkbox |
{{ val | format_bool('check') }}
|
bool TRUE | "☑" | Outputs Wingdings-compatible checkbox characters. |
| Visual Checkbox |
{{ val | format_bool('check') }}
|
bool FALSE | "☐" | Empty box for false values. |
Privacy & Masking
Filter Name: format_mask
| Operation | Full Template Syntax | Input Data | Output Result | Technical Details |
|---|---|---|---|---|
|
{{ val | format_mask('email') }}
|
text "admin@corp.com" | "a***@corp.com" | Obfuscates user part, keeps domain. | |
| Credit Card |
{{ val | format_mask('credit_card') }}
|
text "1234567812345678" | "**** 5678" | Keeps only last 4 digits (PCI Compliant). |
| Custom Pattern |
{{ val | format_mask('mask', '###.###') }}
|
text "123456" | "123.456" | Hashtags (#) are replaced by characters. |
Dynamic Images
Filter Name: format_image
Requirement
The Excel cell must contain the exact filename (e.g., photo.jpg). This file must exist inside the assets.zip uploaded during generation.
Word vs PowerPoint
Fully supported in Word (.docx).
Note: PowerPoint support is limited to text-replacement only in this version.
| Syntax (Click to Copy) | Description |
|---|---|
|
{{ val | format_image('5', '3') }}
|
Resizes image to 5cm Width x 3cm Height. |
|
{{ val | format_image('5', 'auto') }}
|
Fixes Width to 5cm, calculates Height automatically. |
|
{{ val | format_image('auto', '4') }}
|
Fixes Height to 4cm, calculates Width automatically. |