ActiveReports allows you to overlay static report formats over data reports. This walkthrough illustrates how to overlay an ActiveReport with a static letterhead report.
This walkthrough is split up into the following activities:
- Connecting the data report to a data source
- Adding controls to the letterhead and data reports
- Adding code to overlay the data report pages with the letterhead report
![]() |
Tip: For basic steps like adding a report to a Visual Studio project and viewing a report, please see the Basic Data Bound Reports walkthrough. |
To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\GrapeCity\ActiveReports 6\Data\NWIND.MDB (on a 64-bit Windows operating system, a copy is located in C:\Program Files (x86)\GrapeCity\ActiveReports 6\Data\NWIND.MDB).
When you have completed this walkthrough, you will have a report that looks similar to the following.

To connect rptData to a data source
- Add two reports to a Visual Studio project, naming them rptLetterhead and rptData.
- Click the gray report DataSource icon on the Detail section band to open the Report Data Source dialog.
- On the OLE DB tab, next to Connection String, click the Build button.
- In the Data Link Properties window that appears, select Microsoft Jet 4.0 OLE DB Provider and click the Next button.
- Click the ellipsis (...) button to browse to the Northwind database. Click Open once you have selected the appropriate access path.
- Click OK to close the window and fill in the Connection String field.
- In the Query field, enter the following SQL query
SQL Query
Copy CodeSELECT * FROM Customers ORDER BY Country - Click OK to save the data source and return to the report design surface.
To add controls to rptData
- Select the PageHeader section, and in the Properties Window, set the Height property to 0.65. (This will match the height of the page header in the template.)
- Right-click the report and select Insert > GroupHeader/Footer to add group header and group footer sections.
- Make the following changes to the group header:
- Change the Name property to ghCustomers
- Change the BackColor property to MediumSlateBlue
- Change the CanShrink property to True
- Change the DataField property to Country
- Change the GroupKeepTogether property to FirstDetail
- Change the KeepTogether property to True
- Add the following controls to ghCustomers with properties set as indicated:
Control Miscellaneous Text (or DataField) Size Location TextBox Bold
ForeColor = White
Font Size = 12="Customers in " + Country
(DataField)2, 0.2 in 0, 0 in Label Bold
ForeColor = DarkSlateBlueID 0.6, 0.198 in 0, 0.2 in Label Bold
ForeColor = DarkSlateBlueCompany Name 1.1, 0.198 in 0.7, 0.2 in Label Bold
ForeColor = DarkSlateBlueAddress 1, 0.198 in 2.7, 0.2 in Label Bold
ForeColor = DarkSlateBlueCity 1, 0.198 in 5.5, 0.2 in - Make the following changes to the detail section:
- Change the BackColor property to LightGray
- Change the CanShrink property to True
- In the Report Explorer, expand the Fields node, then the Bound node. Drag the following fields onto the detail section and set the properties of each textbox as indicated.
Field Size Location CustomerID 0.6, 0.2 in 0, 0 in CompanyName 2, 0.2 in 0.7, 0 in Address 2.8, 0.2 in 2.7, 0 in City 1, 0.2 in 5.5, 0 in - Change the group footer's Height property to 0.
To add static controls to rptLetterhead
- Make the following changes to the page header:
- Change the BackColor property to DarkSlateBlue
- Change the Height property to 0.65
- Add the following controls to the page header with properties set as indicated:
Control Miscellaneous Size Location Label Size = 36
Style = Bold
ForeColor = White
Text = GrapeCity3.7, 0.65 in 0, 0 in Picture PictureAlignment = TopLeft
Image (click ellipsis, navigate to C:\Program Files\GrapeCity\ActiveReports 6\Introduction (on a 64-bit Windows operating system, navigate to C:\Program Files (x86)\GrapeCity\ActiveReports 6\Introduction) and select itopimage1.gif)3, 0.65 in 3.5, 0 in - Make the following changes to the page footer:
- Change the BackColor property to DarkSlateBlue
- Add a label with the following properties to the page footer:
Miscellaneous ForeColor Text Size Location Alignment = Center
Style = BoldWhite (919) 460-4551, http://www.grapecity.com, powersales@grapecity.com 6.5, 0.2 in 0, 0 in
Adding code to overlay the data report pages with the letterhead report
To write the code in Visual Basic.NET
- Add the ActiveReports viewer control to the Windows Form. Then, double-click the top of the Windows Form to create an event-handling method for the form's Load event. Add code to the handler to:
- Set the viewer to display the rptData report document
- Overlay rptLetterhead on rptData
The following example shows what the code for the method looks like.
| Visual Basic.NET code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
Dim rpt As New rptData()
rpt.Run()
Viewer1.Document = rpt.Document
Dim rpt2 As New rptLetterhead()
rpt2.Run()
Dim i As Integer
For i = 0 To rpt.Document.Pages.Count - 1
rpt.Document.Pages(i).Overlay(rpt2.Document.Pages(0))
Next
| |
- Add the ActiveReports viewer control to the Windows Form. Then, double-click the top of the Windows Form to create an event-handling method for the form's Load event. Add code to the handler to:
- Set the viewer to display the rptData report document
- Overlay rptLetterhead on rptData
The following example shows what the code for the method looks like.
| C# code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
rptData rpt = new rptData();
rpt.Run();
viewer1.Document = rpt.Document;
rptLetterhead rpt2 = new rptLetterhead();
rpt2.Run();
for(int i = 0; i < rpt.Document.Pages.Count; i++)
{
rpt.Document.Pages[i].Overlay(rpt2.Document.Pages[0]);
}
| |
Hide All