Generating Report using Multiple Data Sources in Spreadsheet Document

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
In this article, we will use GroupDocs.Assembly to generate a report. This report will fetch data from multiple data sources.
Note
The code uses some of the objects defined in The Business Layer.

Generating Report in Microsoft Excel Document

Creating a Template

  1. Add a bullet list at the place where you want it to display clients’ names.
  2. Insert a table with two columns, that will show managers’ and their contact prices.
  3. Save your Document

Reporting Requirement

As a report developer, you are required to generate a report that fetches data from two different data sources (e:g custom object, excel data table). Report must show following information:

  • Bulleted list of clients
  • A table showing managers’ along with their contract prices and sum of contract prices

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

In-cell list

We provide support for the following clients:

<<foreach [in getClients()]>>
-          <<[getName()]>><</foreach>>

Multiple-cell list

We provide support for the following clients:

<<foreach [in getClients()]>>
-          <<[getName()]>> 
Total Contract Prices by Managers
«foreach [group in contracts
.groupBy(c => c.Manager)
.orderBy(g => g.key)]»
«[group.key]»
«[group.sum(
c => c.Contract_Price)]»
«/foreach»

Download Template

Get the template from here.

Generating the ReportGenerating Report using Custom Objects and Excel Data Source