Working with Template Syntax Formatting

Note
The example reads the shop data described in The Business Layer.

Template Syntax Formats

Specifying String and Numeric Formats

Learn more about string and numeric formats here.

Template Syntax

 

Products

Order Price

<<if [!Any()]>>No data

<<else>><<foreach [in orders]>><<[Product.ProductName] : upper>>

<<[Price] : arabicDash>><</foreach>>

Total:

<<[Sum(c => c.Price)]>><</if>>

 

 

Tip
For detailed technical information about syntax, expressions and report generation by the engine, please visit: Working with GroupDocs.Assembly Engine

Download Template

Get the template from here.

The Code

import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler

with open("orders.json", encoding="utf-8") as f:
    orders = json.load(f)

assembler = DocumentAssembler()
assembler.assemble_document("numeric-format.odt", "numeric-format-report.odt", DataSourceInfo(orders, "orders"))

The following sample file is used in this example: numeric-format.odt

The following sample file is used in this example: orders.json

Binary file (ODT, 6 KB)

Download full output

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.