Property Name Description Editable Formula Control Data Type General ClassType Display the class type: GroupHeaderPanel. N N _ Geometry Width The width of the section. N N _ Height The height of the section. Y N Float Color Background The background color. Use a string like "0xff00ff" to control or select a color in the palette. Y Y String Others Style Apply predefined styles like background color, width, invisible, underlay etc. properties to another Group Header section. Y N String Invisible If true, not displayed both in the View and the Design mode. Y Y Boolean Suppressed If true, not displayed in the View mode. Y Y Boolean ExportToCSV* If set to false, the section will not be exported when exporting the report to a csv file. Y Y Boolean ExportToXLS* If set to False, the section will not be exported when exporting the report to Excel file. (Make sure to check Excel2000 on the Export to XLS dialog.) Y Y Boolean Label Display the section name in the design mode. Y N String OnNewPage* If set to true, the section will start on a new page. Y Y (before page break) Boolean Underlay The section will go to the next section’s underground on a group basis if set true. Y Y (before page break) Boolean CanCrossPage* If the current page can’t hold the whole section contents, the contents will cross the page if set true or start from a new page if set false. Y Y (before page break) Boolean SuppressBlankSection If set to true, and the section is blank (no child), then it will be suppressed in the View mode. Y Y (before page break) Boolean FillWholePage* The next section will start from a new page if set true. Y Y (before page break) Boolean Repeat* The group headers are duplicated in every new page if set true. Y Y(before page break) Boolean
If you want each group to start on a new page, you have two approaches. One is to configure with Group Header section as below, the other is to set the FillWholePage property for the Group Footer section.
There is a problem when you only set OnNewPage to be true for the GroupHeader section. You will find that the first page has no details. JREngine starts the detail section from the second page. To solve the issue, use a formula to control this property. The formula will judge that for the first group, the property is set to false, and later groups, the property is set to true to display on a new page. We need to write three formulas and you will also learn how to control property value with a formula. However, if you feel this is too complicated, go to the Group Footer section for the second approach.
global:
global integer i=0;groupHD:
i=i+1;FormulaControl:
@groupHD;
if (i>1)
return true
else
return falseInsert formula global into the Report Header section to assign it an initial value 0. Insert formula groupHD into the Group Header section so that for each group i will be calculated as i+1. Select the Group Header section and let formula FormulaControl to control its OnNewPage property. This formula will only return true for the property if i>1.
Now, let us see the first page of the report. Pay attention to the values for the first two formulas. Suppress the two formulas if you do not want them to be shown.
The default value for CanCrossPage is false. For one detail section which spans a large space vertically to be shown in the first page, then the default false value will make it shown in the second page. Therefore, set it to true so as to avoid the empty first page.
The default value for FillWholePage is false. You set it to false for a section to make it extend until the bottom of the page so that the section below it will start from a new page. It is often used for the Group Footer section to start a group in a new page. Please go to Group Footer section for details.
The default value for Repeat is false. For one detail section which spans a large space vertically to be shown in several pages, we support the Repeat property if you want to see the group header information in each page. When the Repeat property is set true and group headers are visible, the group headers are duplicated in every new page. The Repeat property is a Boolean variable and can be changed by a formula.
Notes:
- One circumstance may appear. When the page split happens just in the bottom blank part of the detail section (or margins in the detail section) and the CanCrossPage property in the Detail section is set true, the output will be: Repeated group header + a slice of blank detail section + Group footer (shown as below). It looks like that the repeated group headers are followed only by group footers without any detail section. In order to solve this problem, you can resize the detail section.
- If the Repeat property is set true in both outer group header and inner group header, JReport will treat the two group headers as a completely repeated object.
- If the outer and inner group headers are set to be one completely repeated object, then when the page can only hold the group headers or has no enough space for the group headers, both outer and inner group headers will not be duplicated.
- The Repeat property does not work in Subreport.