ActiveReports 9 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Section Report Walkthroughs > Layout > Overlaying Reports (Letterhead) |
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:
Note: This walkthrough uses the Northwind database. By default, in ActiveReports, the Northwind.mdb file is located at [User Documents folder]\ComponentOne Samples\ActiveReports 9\Data\NWIND.mdb. |
When you complete this walkthrough you get a layout that looks similar to the following at design time and at runtime.
To add an ActiveReport to the Visual Studio project
See Adding an ActiveReport to a Project for information on adding different report layouts.
To connect the rptData to a data source
SQL Query |
Copy Code
|
---|---|
SELECT * FROM Customers ORDER BY Country |
To create a layout for the rptData
Property Name | Property Value |
---|---|
Name | ghCustomers |
BackColor | MediumSlateBlue |
CanShrink | True |
DataField | Country |
GroupKeepTogether | FirstDetail |
KeepTogether | True |
TextBox1
Property Name | Property Value |
---|---|
DataField | ="Customers in " + Country (DataField) |
Size | 2, 0.2 in |
Location | 0, 0 in |
Font Bold | True |
ForeColor | White |
Font Size | 12 |
Label1
Property Name | Property Value |
---|---|
Text | ID |
Size | 0.6, 0.2 in |
Location | 0, 0.2 in |
Font Bold | True |
ForeColor | DarkSlateBlue |
Label2
Property Name | Property Value |
---|---|
Text | Company Name |
Size | 1.1, 0.2 in |
Location | 0.7, 0.2 in |
Font Bold | True |
ForeColor | DarkSlateBlue |
Label3
Property Name | Property Value |
---|---|
Text | Address |
Size | 1, 0.2 in |
Location | 2.7, 0.2 in |
Font Bold | True |
ForeColor | DarkSlateBlue |
Label4
Property Name | Property Value |
---|---|
Text | City |
Size | 1, 0.2 in |
Location | 5.5, 0.2 in |
Font Bold | True |
ForeColor | DarkSlateBlue |
Property Name | Property Value |
---|---|
BackColor | LightGray |
CanShrink | True |
TextBox1
Property Name | Property Value |
---|---|
DataField | CustomerID |
Size | 0.6, 0.2 in |
Location | 0, 0 in |
TextBox2
Property Name | Property Value |
---|---|
DataField | CompanyName |
Size | 2, 0.2 in |
Location | 0.7, 0 in |
TextBox3
Property Name | Property Value |
---|---|
DataField | Address |
Size | 2.8, 0.2 in |
Location | 2.7, 0 in |
TextBox4
Property Name | Property Value |
---|---|
DataField | City |
Size | 1, 0.2 in |
Location | 5.5, 0.2 in |
To create a layout for the rptLetterhead
Property Name | Property Value |
---|---|
BackColor | DarkSlateBlue |
Height | 0.65 |
Label1
Property Name | Property Value |
---|---|
Size | 6.5, 0.65 in |
Location | 0, 0 in |
Font Size | 36 |
Font Bold | True |
ForeColor | White |
Text | ComponentOne |
Property Name | Property Value |
---|---|
Size | 6.5, 0.2 in |
Location | 0, 0 in |
Alignment | Center |
Font Bold | True |
ForeColor | White |
Text | (919) 460-4551, http://www.grapecity.com, powersales@grapecity.com |
To add code to overlay the data report pages with the letterhead report
To write the code in Visual Basic.NET
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() 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 Viewer1.Document = rpt.Document |
To write the code in C#
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(); 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]); } viewer1.Document = rpt.Document; |
To view the report
Open the report in the Viewer. See Using the Viewer for further information.