How to manage the indentation on top of the second page of the report

Often, when the report is displayed, you can observe how the data that does not fit on the first page is transferred to the second one. This is typical for the band "Data" and "Group header", and associated with them.

The Data band can contain data fields, or other objects, such as a table or matrix.

To make the first page completely filled with data, without spaces, you need to set the CanBreak property for the Data band. But what if you want the "rest" of the table on the second page to place below the top edge? For example at the level of the beginning of the table. At the same time, if you view two sheets of the report at the same time, it will look harmonious. There are no regular settings for this. However, we can always use the report script, and do everything.

Therefore, there are two ways to do this, and they are both very similar.

The first way:

Picking up the height of the "Page Title" band, we can achieve printing the table on the second page at the same level as on the first page.

The second method is almost identical to the first:

Just choose what you like, because both methods are equivalent,.

Now consider the code of the BeforePrint event handler for the "Page header" band.

The first way:

1
2
3
4
5
6
7
private void PageHeader1_BeforePrint(object sender, EventArgs e)
{
 if (Engine.CurPage > 0)
 PageHeader1.Height = 50; // Set top margin
 else
 PageHeader1.Height = 0;
}

 The second way:

1
2
3
4
5
6
7
private void PageHeader1_BeforePrint(object sender, EventArgs e) 
{ 
 if (Engine.CurPage > 0) 
 PageHeader1.Visible = true; 
 else 
 PageHeader1.Visible = false; 
} 

 As you can see, in the first case, we change the height of the band in the code, and in the second case, we display the band with a predetermined height.

As a result, we get an upper margin for the table on the second page of the report:

Thus you can adjust the margins for each subsequent page of the report.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot