In-Table List with Highlighted Rows in HTML Document

Note
In this article, we will use GroupDocs.Assembly to generate In-Table List with Highlighted Rows in HTML Document format.
Note
The example reads the shop data described in The Business Layer.

In-Table List with Highlighted Rows in HTML Document

Reporting Requirement

As a report developer, you are required to represent customers’ orders information with a specific filtering condition with the following key requirements:

  • The report must show each customer along with his orders.
  • Show single Customer and his single order price in a single row.
  • It must highlight the record with order price more than or equal to 400.
  • It must show sum of the order prices.
  • It must represent all the information in tabular form.
  • The report must be generated in the Word Processing Document.

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

Customer

Order Price

<<foreach [in orders]>><<if [Price >= 400]>><<[Customer.CustomerName]>>

<<[Price]>>

<<else>><<[Customer.CustomerName]>>

<<[Price]>><</if>><</foreach>>

Total:

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

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

In-Table List with Highlighted Rows Template

Please download the In-Table list with highlighted rows template document we created in this article:

Generating The Report

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-highlighted-rows.html", "in-table-list-with-highlighted-rows-report.html", DataSourceInfo(orders, "orders"))

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

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

<html>
<body>
<table>
<tr>
<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.