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

2018-09-06

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:

  • Add the "Page title" band;
  • Add a BeforePrint event handler for this band;
  • In the event handler code, check the current page number, and if it's the second page, but change the height of the band to a suitable value.

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:

  • Add the "Page title" band;
  • Set the desired height in the properties;
  • Add a BeforePrint event handler to the "Page title" band;
  • In the event handler code, check the current page number, and if it's the second page, but display the band.

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.

.NET .NET FastReport FastReport
April 08, 2025

How to Set Up a Connection to Apache Ignite in FastReport .NET

In this article, we will explore how to configure a connection to Apache Ignite in FastReport .NET. You will learn the necessary steps to connect the plugin via code and the report designer.
April 08, 2025

Converter from Microsoft Word (.docx) format to FastReport .NET (.frx) file

A converter from Microsoft Word (.docx) format to a file FastReport .NET (.frx): description and instructions for using the tool.
March 25, 2025

How to Merge Multiple Reports into One in FastReport .NET

FastReport .NET is a powerful tool for creating and managing reports. In this article, we will look at how to combine multiple reports into one in FastReport .NET.
Fast Reports
  • 800-985-8986 (English, US)
  • +31 97 01025-8466 (English, EU)
  • +49 30 56837-3928 (German, DE)
  • +55 19 98147-8148 (Portuguese, BR)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2025 Fast Reports Inc.