Numbered List in Text Document

Note
In this article, we will use GroupDocs.Assembly to generate a Numbered List report in Text Document format.
Note
The example reads the shop data described in The Business Layer.

Numbered List in Text Document

Reporting Requirement

As a report developer, you are required to describe the services you are providing with the following key requirements:

  • The report must show the products in the numbered list.
  • The report must be generated in the Text Document.

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

We provide support for the following products:
<<foreach [in products]>><<[NumberOf()]>>. <<[ProductName]>>
<</foreach>>
Tip
For detailed technical information about syntax, expressions and report generation by the engine, please visit: Working with GroupDocs.Assembly Engine.

Download Numbered List Template

Please download the sample Numbered List document we created in this article:

Generating The Report

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("numbered-list.txt", "numbered-list-report.txt", DataSourceInfo(products, "products"))

The following sample file is used in this example: numbered-list.txt

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

We provide support for the following products:
1. Harbor Blend whole bean coffee
2. Lighthouse Espresso beans
3. Aged harbour cheddar
4. Chestnut honey
5. Oat and honey biscuits
6. Cold-pressed olive oil
7. Smoked sea salt
8. Smoked gouda
9. Autumn Harvest apple butter
[TRUNCATED]

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.