ActiveReports for .NET 3 Online Help Request technical support
Walkthrough: Applying Page Templates
See Also
User Guide > Samples and Walkthroughs > Walkthroughs > Standard Edition Walkthroughs > Advanced > Modifying Report Documents Walkthroughs > Walkthrough: Applying Page Templates

Glossary Item Box

ActiveReports allows you to apply a page template to an existing report by using the Overlay method.

This walkthrough illustrates how to overlay an ActiveReport with a "letterhead" page template.

This walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\Data Dynamics\ActiveReports for .NET 3.0\Data\NWIND.MDB.

When you have completed this walkthrough, you will have a report that looks similar to the following.

Adding two ActiveReports to a Visual Studio project

To add two ActiveReports to a Visual Studio project

  1. Open a new project in Visual Studio.
  2. From the Project menu, select Add New Item.
  3. Select ActiveReports 3.0 File and rename the file rptReport.
  4. Click Open.
  5. From the Project menu, select Add New Item.
  6. Select ActiveReports 3.0 File and rename the file rptTemplate.
  7. Click Open.

Connecting the main report to a data source

To connect rptReport to a data source

  1. Click on the gray report DataSource icon in the Detail section of rptReport to open the report DataSource dialog.
  2. Select the "OLE DB" tab. 
  3. Click the Build button.
  4. Select Microsoft Jet 4.0 OLE DB Provider and click Next.
  5. Click the ellipsis button to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
  6. Click OK to continue.
  7. In the Query field, type "Select * from customers order by country".
  8. Click OK to return to the report design surface.

Adding controls to display the data

To add controls to rptReport

  1. Select the page header section, and set the Height property to 0.4. (This will match the height of the page header in the template.)
  2. Add a GroupHeader/Footer section by right-clicking the report and selecting Insert > GroupHeader/Footer.
  3. 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
  4. Add labels with the following properties to ghCustomers:
    Font Style Name Text Section Location
    Bold lblCustomerID Customer ID GroupHeader 0, 0
    Bold lblCompanyName Company Name GroupHeader 0.94, 0
    Bold lblAddress Address GroupHeader 2.44, 0
    Bold lblCity City GroupHeader 4.63, 0
    Bold lblCountry Country GroupHeader 5.69, 0
  5. Make the following changes to the detail section:
    • Change the BackColor property to LightGray
    • Change the CanShrink property to True
  6. In the Report Explorer, expand the Fields node, then the Bound node. Drag the following fields onto the detail section and set the following properties of each textbox as indicated.
    Field Text Size Location
    CustomerID Customer ID 0.88, 0.19 0, 0
    CompanyName CompanyName 1.44, 0.19 0.94, 0
    Address Address 2.13, 0.19 2.44, 0
    City City 1, 0.19 4.63, 0
    Country Country 0.8, 0.19 5.69, 0

To add controls to rptTemplate

  1. Make the following changes to the page header:
    • Change the BackColor property to DarkSlateBlue
    • Change the Height property to 0.4
  2. Add labels with the following properties to the page header:
    Font Name Text ForeColor Location

    Size = 18

    Style=Bold

    lblCompanyName Company Name White 0, 0

    Size = 16

    Style=Bold

    lblCompanyLogo (Company Logo) White 4.69, 0
  3. Make the following changes to the page header:
    • Change the BackColor property to DarkSlateBlue
  4. Add a label with the following properties to the page footer:
    Miscellaneous Name Text ForeColor Location

    Alignment = Center

    Style = Bold

    Size = 6.5, 0.2

    lblCompanyInfo Company Address, Phone Number, Fax Number, URL White 0, 0

Adding code to the Windows Form Load event

To write the code in Visual Basic or C#

Viewing the report

To view the report

You can quickly view your report at design time by clicking the Preview tab at the bottom of the designer.

See Also

©2009. All Rights Reserved.