Adding NEXT Field into Template Syntax

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Assembly MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-assembly -- dnx GroupDocs.Assembly.Mcp --yes
Folders, licensing and more →
Note
The example reads the shop data described in The Business Layer.

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

Template Syntax

We provide support for the following products:
. <<foreach [in products]>><<next>><<[ProductName]>>
<</foreach>>

The Recipe

  • Set up the source document template path
  • Set up destination report path
  • Instantiate DocumentAssembler class
  • Generate report

Download Template

Get the template from here.

The Code

import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler

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

assembler = DocumentAssembler()
assembler.assemble_document("next-field.docx", "next-field-report.docx", DataSourceInfo(products, "product"))

The following sample file is used in this example: next-field.docx

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

Binary file (DOCX, 11 KB)

Download full output