ActiveReports for .NET 3 Online Help Request technical support
Columnar Reports
See Also
User Guide > Samples and Walkthroughs > Walkthroughs > Standard Edition Walkthroughs > Basic > Columnar Reports

Glossary Item Box

ActiveReports supports newspaper column layouts in both the Detail and Group sections. You can render the columns either horizontally or vertically in the section with options to break the column on the Group section (i.e. start a new column on the change of a group).  There is also a Boolean ColumnGroupKeepTogether property on the GroupHeader. When set to True, ColumnGroupKeepTogether attempts to prevent a group from splitting across columns.  If a group cannot fit in the current column, it tries the next.  If the group is too large for a single column, the property is ignored.

The ColumnGroupKeepTogether property is only implemented when the GroupHeader's GroupKeepTogether property is set to All. This walkthrough illustrates how to create a simple report using columns.

The 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 finished this walkthrough, you will have a report that looks similar to the following.

Adding an ActiveReport to a Visual Studio project

To add an ActiveReport to your 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 rptColumnar.
  4. Click Open.

Connecting the data source to a database

To connect the data source to a database

  1. Click on the gray report DataSource icon in the Detail section to open the report DataSource dialog.
  2. Select the "OLE DB" tab.
  3. Click on Build.
  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 Country, CompanyName, ContactName, Phone FROM Customers ORDER BY Country".
  8. Click OK to return to the report design surface.

Adding controls to contain data

To add controls to the report

  1. Add a GroupHeader/Footer section to rptColumnar by right-clicking on the design surface of the report and selecting Insert > Report Header/Footer.
  2. Make the following changes to the group header:
    • Change the Name property to ghCountry
    • Change the BackColor property to Gold
    • Change the DataField property to Country
    • Change the ColumnGroupKeepTogether property to True
    • Change the GroupKeepTogether property to All
  3. Change the BackColor property of the group footer to Goldenrod.
  4. Drag the Country field from the Report Explorer into the GroupHeader section with the indicated properties:

    DataField Font Name Text Location
    Country Arial, 12pt, style=Bold txtCountry Country 0, 0
  5. Change the BackColor property of the PageHeader section to Linen and add the following control with the indicated properties:

    Control Font Name Text Location
    Label Arial, 14pt

    lblPhone

    Customer Telephone List by Country 0, 0
  6. Make the following changes to the Detail section:
    • Change the ColumnCount property to 2
    • Change the CanShrink property to True
  7. Drag the following fields from the Report Explorer to the Detail section:

    DataField Name Text Location
    CompanyName txtCompanyName Company Name 0, 0
    ContactName txtContactName Contact Name 1.188, 0
    Phone txtPhone Telephone Number 2.25, 0

Viewing the report

To view the report

  1. Add the ActiveReports viewer control to a Windows Form.
  2. Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports Windows Form Viewer for help.
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.