In-Table List With Alternate Content in HTML Document

Note
In this article, we will use GroupDocs.Assembly to generate In-Table Master-Detail report in HTML Document format.

In-Table List With Alternate Content in HTML Document

Reporting Requirement

As a report developer, you are required to represent your products and their prices with the following key requirements:

  • Report must show each product along with its price.
  • It must show sum of all the prices.
  • It must represent all the information in tabular form.
  • Report must be generated in the HTML Document.

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

Products

Order Price

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

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

<<[Price]>><</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 In-Table List With Alternate Content Template

Please download the sample In-Table list with alternate content document we created in this article:

Generating The Report

Note
The example reads the shop data described in The Business Layer.
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("in-table-list-with-alternate-content.html", "in-table-list-with-alternate-content-report.html", DataSourceInfo(orders, "orders"))

The following sample file is used in this example: in-table-list-with-alternate-content.html

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

<html>
<body>
<table>
Regular text. <span style="background-color:orange">Highlighted text.</span>
<th>
Customer
</th>
<th>
Order Price
</th>
[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.