Appendix C. Typical Templates

This section contains examples of templates for typical scenarios. Every example is given using one of the following data source objects:

  • manager, an instance of the Manager class
  • managers, an enumeration of instances of the Manager class
  • contracts, an enumeration of instances of the Contract class
  • clients, an enumeration of instances of the Client class

The Manager, Contract, and Client classes are defined as follows.

public class Manager
{
	public String getName() { ... }
	public int getAge() { ... }
	public byte[] getPhoto() { ... }
	public Iterable<Contract> getContracts() { ... }
	...
}

public class Contract
{
	public Manager getManager() { ... }
	public Client getClient() { ... }
	public float getPrice() { ... }
	public Date getDate() { ... }
	...
}

public class Client
{
	public String getName() { ... }
	...
}

Single-Row Template

Template Example

Single_Row_Template_Example_aspose_words_java Name: «[manager.getName()]»
Age: «[manager.getAge()]»

Report Example

Single_Row_Report_Example_aspose_words_java Name: John Smith
Age: 37

In-Paragraph List Template

Template Example

We provide support for the following clients: «foreach [in clients]»«[indexOf() != 0 ? “, " : “"]»«[getName()]»«/foreach»

Report Example

We provide support for the following clients: A Company, B Ltd., C & D, E Corp., F & Partners, G & Co., H Group, I & Sons, J Ent.

Bulleted List Template

Template Example

We provide support for the following clients:
    * <<foreach [in clients]>><<[getName()]>>
<</foreach>>

Report Example

We provide support for the following clients:
    * A Company
    * B Ltd.
    * C & D
    * E Corp.
    * F & Partners
    * G & Co.
    * H Group
    * I & Sons
    * J Ent.

Numbered List Template

Template Example

We provide support for the following clients:
    1. <<foreach [in clients]>><<[getName()]>>
<</foreach>>

Report Example

We provide support for the following clients:
    1. A Company
    2. B Ltd.
    3. C & D
    4. E Corp.
    5. F & Partners
    6. G & Co.
    7. H Group
    8. I & Sons
    9. J Ent.

Multicolored Numbered List Template

Template Example

We provide support for the following clients:

1. <<foreach [in clients]>><<if [IndexOf() % 2 == 0]>><<[Name]>>
2. <<else>><<[Name]>>
<</if>><</foreach>>

Report Example

We provide support for the following clients:

1. A Company
2. B Ltd.
3. C & D
4. E Corp.
5. F & Partners
6. G & Co.
7. H Group
8. I & Sons
9. J Ent.

Common List Template

Template Example

«foreach [in managers]»
Common_List_Template_Example_aspose_words_java
«[getName()]»
<</foreach>>

Report Example

Single_Row_Report_Example_aspose_words_java
John Smith
Single_Row_Report_Example_aspose_words_java
Tony Anderson
Single_Row_Report_Example_aspose_words_java
July James

In-Table List Template

Template Example

Manager Contract Price
 <<foreach [in managers]>><<[getName()]>> 
 <<[getContracts().sum(c => c.getPrice())]>><</foreach>> 
 Total: 
 <<[sum(m => m.getContracts().sum(c => c.getPrice()))]>> 

Report Example

Manager Contract Price
 John Smith 
 2300000 
 Tony Anderson 
 1200000 
 July James 
 800000 
 Total: 
 4300000 

In-Table List Template with Running (Progressive) Total

Template Example

<<var [total = 0.0]>>

Client Total Contract Price
<<foreach [in contracts]>><<[getClient().getName()]>> <<var [total = total + getPrice()]>><<[total]>><</foreach>>

Report Example

Client Total Contract Price
A Company 1200000
B Ltd. 1950000
C & D 2300000
E Corp. 2950000
F & Partners 3500000
G & Co. 3850000
H Group 4100000
I & Sons 4200000
J Ent. 4300000

In-Table List Template with Highlighted Rows

Template Example

Client Contract Price
<<foreach [in contracts]>><<if [getPrice() >= 1000000]>><<[getClient().getName()]>> <<[getPrice()]>>
<<else>><<[getClient().getName()]>> <<[getPrice()]>><</if>><</foreach>>
Total: <<[sum(c => c.getPrice())]>>

Report Example

Client Contract Price
A Company 1200000
B Ltd. 750000
C & D 350000
E Corp. 650000
F & Partners 550000
G & Co. 350000
H Group 250000
I & Sons 100000
J Ent. 100000
Total: 4300000

In-Table List Template with Alternate Content

Template Example

Client Contract Price
«if [!any()]»No data
«else»«foreach [in contracts]»«[getClient().getName()]» «[getPrice()]»«/foreach»
Total: «[sum(c => c.getPrice())]»«/if»

Report Example 1

Client Contract Price
No data

Report Example 2

Client Contract Price
A Company 1200000
B Ltd. 750000
C & D 350000
E Corp. 650000
F & Partners 550000
G & Co. 350000
H Group 250000
I & Sons 100000
J Ent. 100000
Total: 4300000

Common Master-Detail Template

Template Example

«foreach [in managers]»
Common_List_Template_Example_aspose_words_java
«[getName()]»
Clients: «foreach [in getContracts() ]»«[indexOf() != 0 ? “, " : “"]»«[getClient().getName()]»«/foreach»
<</foreach>>

Report Example

Single_Row_Report_Example_aspose_words_java
John Smith
Clients: A Company, B Ltd., C & D
Single_Row_Report_Example_aspose_words_java
Tony Anderson
Clients: E Corp., F & Partners
Single_Row_Report_Example_aspose_words_java
July James
Clients: G & Co., H Group, I & Sons, J Ent.

In-Table Master-Detail Template

Template Example

Manager/Client Contract Price
 <<foreach [in managers]>><<[getName()]>> 
 <<[getContracts().sum(c => c.getPrice())]>> 
 <<foreach [in getContracts()]>> <<[getClient().getName()]>> 
 <<[getPrice()]>><</foreach>><</foreach>> 
 Total: 
 <<[sum(m => m.getContracts().sum(c => c.getPrice()))]>> 

Report Example

Manager/Client Contract Price
 John Smith 
 2300000 
 A Company 
 1200000 
 B Ltd. 
 750000</p><p>
 C & D 
 350000</p><p>
 Tony Anderson 
 1200000</p><p>
 E Corp. 
 650000</p><p>
 F & Partners 
 550000</p><p>
 July James 
 800000</p><p>
 G & Co. 
 350000</p><p>
 H Group 
 250000</p><p>
 I & Sons 
 100000</p><p>
 J Ent. 
 100000</p><p>
 Total: 
 4300000</p><p>

Pie Chart Template

Template Example

Pie_Chart_Template_Example_aspose_words_java

Initial Chart Series Data

Pie_Chart_Series_Data_aspose_words_java

Report Example

Pie_Chart_Report_Example_aspose_words_java

Scatter Chart Template

Template Example

Scatter_Chart_Template_Example_aspose_words_java

Initial Chart Series Data

Scatter_Chart_Series_Data_aspose_words_java

Report Example

Scatter_Chart_Report_Example_aspose_words_java

Bubble Chart Template

Template Example

Bubble_Chart_Template_Example_aspose_words_java

Initial Chart Series Data

Bubble_Chart_Series_Data_aspose_words_java

Report Example

Bubble_Chart_Report_Example_aspose_words_java

In-Table Template with Filtering, Grouping, and Ordering

Template Example

Manager Contract Price
 <<foreach [in contracts
.where(c => c.getDate().getYear() == 115)
.groupBy(c => c.getManager())
.orderBy(g => g.key.getName())]>>
<<[key.getName()]>> 
 <<[sum(c => c.getPrice())]>><</foreach>> 

Report Example

Manager Contract Price
John Smith 2300000
July James 800000
Tony Anderson 1200000

Chart Template with Filtering, Grouping, and Ordering

Template Example

Chart_Template_Example_aspose_words_java

Report Example

Chart_Report_Example_aspose_words_java