How to Create Reports using MS Word Document with Merge Fields

This document explains how users can design and use MS Word (.docx) templates in Axanta ERP.

1. Overview

This feature allows you to:

  • Design DOCX templates in Microsoft Word
  • Insert merge fields (dynamic data/placeholders) linked to DB fields
  • Generate reports in DOCX or PDF format
  • Support:
    • Normal fields (order, partner, company, etc.)
    • One2many table lines (order lines, invoice lines, etc.)
    • Images & barcodes
    • Dates with formatting
    • Numbers with decimal precision and Number to words
    • HTML fields (Notes, Terms & Conditions, etc.)

The system replaces placeholders in the Word template with real data at print time.


2. Template Setup in Axanta ERP

  1. Go to Settings → Technical → Actions → Reports
  2. Open the required report
  3. Enable “Populating MS Word Template”
  4. Upload a .docx file in File Template
  5. Select Export Type:
    • Docx → downloads Word file
    • PDF → converts Word to PDF

3.  Common Data Fields

These fields are used for single values from the main record or related many2one records.

Field Type

Syntax Example

Description

Record Field

«name»

Fetches the value of the current record field.

Related Field

«partner_id.name»

Uses dot-notation to reach related data.

User Info

«print_by_user»

Returns the name of the user printing the report.

System Date

«print_date»

Today's date in the user's local format.

System Time

«print_datetime»

Current date and time adjusted to User Timezone.


4. Managing One2Many Fields for Tabular Representation

The system automatically detects if a field is a One2Many (like order_line or invoice_line). When these fields are placed inside a table, the row will repeat for every record found.

Feature

Syntax Example

Description

Table Column

«order_line.product_id.name»

Automatically loops through all lines in the table.

Row Counter

«order_line.numerical_order»

Generates an incrementing number (1, 2, 3...) for each row.


5. Data Formatting & Useful Tools

You can append specialized keywords to fields to format numbers, dates, or convert amounts to text.

Tool

Syntax Example

Result

Date Format

«date_order.format_date»

Forces the date to follow the user's language settings.

Custom Rounding

«amount.float_round.3»

Rounds the number to 3 decimal places. If not given the decimal precision will be fetched based on the currency id or default precision will be applied.

Line Count

«order_line.count»

Displays the total number of lines in the set.

Total Sum

«order_line.price_subtotal.sum»

Calculates the mathematical sum of the specified column.

Amount to Text

«amount_total.num2word»

Converts numbers to words (e.g., "One Hundred").

If the field is monetary, it uses currency-specific wording.


6. Images & Barcodes

Images and Barcodes are handled by specifying the path and the desired size. 

Units Supported: px (Pixels), mm (Millimeters), cm (Centimeters).

Type

Syntax Example

Dimensions

Record Image

«partner_id.image_1920.100.px.width»

100 pixels wide.

Table Image

«order_line.product_id.image_128.2.cm.width»

2 centimeters wide.

Barcode

«name.print_barcode»

Generates a Code128 barcode image.

Sized Barcode

«name.print_barcode.50.mm.width»

Barcode sized to 50 millimeters.



7. HTML Content (Notes & Terms)

When a placeholder points to an HTML field (like note or narration), the system performs a special "Insert Below" operation.

  • Rendering: The HTML content (Bold, Italic, Lists) is rendered as native Word elements immediately underneath the original paragraph.
  • Lists: Ordered and unordered lists will display as new lines within the document.