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:
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.
SQL Query |
Copy Code |
---|---|
SELECT * FROM Customers ORDER BY Country |
Group header labels
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 = DarkSlateBlue |
ID | 0.6, 0.198 in | 0, 0.2 in |
Label | Bold ForeColor = DarkSlateBlue |
Company Name | 1.1, 0.198 in | 0.7, 0.2 in |
Label | Bold ForeColor = DarkSlateBlue |
Address | 1, 0.198 in | 2.7, 0.2 in |
Label | Bold ForeColor = DarkSlateBlue |
City | 1, 0.198 in | 5.5, 0.2 in |
Detail fields
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 |
Page header labels
Control | Miscellaneous | Size | Location |
---|---|---|---|
Label | Size = 36 Style = Bold ForeColor = White Text = GrapeCity |
3.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 |
Page footer label
Miscellaneous | ForeColor | Text | Size | Location |
---|---|---|---|---|
Alignment = Center Style = Bold |
White | (919) 460-4551, http://www.grapecity.com, powersales@grapecity.com | 6.5, 0.2 in | 0, 0 in |
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() 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 |
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(); 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]); } |