POJO Data Attachment Nested

My POJO Datasource basically contains the following structure.
// Company .java

public class Company implements Serializable { private static final long serialVersionUID = 3130918429913376956L; private String name; private String address; private String contactPerson; private String mobile; private String fax; private String bankDetails; private String email; private List<Employee> emps; //getter and setter. } 

// Employee.java

 public class Employee implements Serializable{ /** * */ private static final long serialVersionUID = -4473328670062370497L; private String name; private int age; private String designation; //getter and setter } 

My script is like the following

  • A single PDF report may be larger than one company (i.e. List <Company))
  • In the case of more than one Company, it should begin on a new page.
  • If the Employee list goes to the next page, then it should repeat the title on the next page.

Layout - enter image description here Xml source layout
Exit Page 1

enter image description here
Page 2
enter image description here

There are two problems with this design.

  • Employee Name header is repeated for each employee.
  • The company title ( Comp Name -> Company A ) should be displayed only once.

Can someone suggest me the right approach? Thanks in advance.

+5
source share
1 answer

Move the "company name" to the title bar and set the title property to not be repeated on new pages. Move the "Employee name" from the group with "Employee", therefore to the level at which the "company name" is now.

I think you know everything to solve this, you just need to play a little with the groups.

0
source

Source: https://habr.com/ru/post/1271478/


All Articles