ActiveReports 11
Columnar Reports
ActiveReports 11 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Section Report Walkthroughs > Layout > Columnar Reports

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, the ColumnGroupKeepTogether property 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.

Note: The ColumnGroupKeepTogether property only works when the GroupHeader's GroupKeepTogether property is set to All.

This walkthrough illustrates how to create a simple report using columns, and 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]\GrapeCity Samples\ActiveReports 11\Data\NWIND.mdb.

When you complete this walkthrough you get a layout that looks similar to the following at design time and at run time.

Design-Time Layout

Run-Time Layout

To add an ActiveReport to the Visual Studio project

  1. Create a new Visual Studio project.
  2. From the Project menu, select Add New Item.
  3. In the Add New Item dialog that appears, select ActiveReports 11 Section Report (code-based) and in the Name field, rename the file as rptColumnar.
  4. Click the Add button to open a new section report in the designer.

See Adding an ActiveReport to a Project for information on adding different report layouts.

To connect the report to a data source

  1. On the detail section band, click the Data Source Icon.
  2. In the Report Data Source dialog that appears, on the OLE DB tab, next to Connection String, click the Build button.
  3. In the Data Link Properties window that appears, select Microsoft Jet 4.0 OLE DB Provider and click the Next button to move to the Connection tab.
  4. Click the ellipsis (...) button to browse to your database, for example the NWind.mdb sample database. Click Open once you have selected the appropriate database path.
  5. Click the Test Connection button to see if you have successfully connected to the database.
  6. Click OK to close the Data Link Properties window and return to the Report Data Source dialog. Notice that the Connection String field gets filled automatically.
  7. In the Query field on the OLE DB tab, enter the following SQL query.
    SQL Query
    Copy Code
    SELECT Country, CompanyName, ContactName, Phone FROM Customers ORDER BY Country
  8. Click OK to save the data source and return to the report design surface.

To create a layout for the report

  1. Right-click the design surface of the report and select Insert, then Group Header/Footer to add a GroupHeader/Footer section.
  2. Select the group header and in the Properties Window, set the properties as follows.
    Property Name Property Value
    Name ghCountry
    BackColor Gold
    DataField Country
    ColumnGroupKeepTogether True
    GroupKeepTogether All
  3. Select the group footer and in the Properties window, set the BackColor property to Goldenrod.
  4. In the Report Explorer, drag the Country field onto the GroupHeader section and in the Properties window, set its properties as follows.
    Property Name Property Value
    Location 0, 0 in
    Size 3.25, 0.2 in
    Alignment Center
    Font > Size 12
    Font > Bold True
  5. Select the PageHeader section and in the Properties window, set the BackColor property to Linen.
  6. From the toolbox, drag a Label control onto the PageHeader section and in the Properties window, set the properties as follows:
    Property Name Property Value
    Location 0, 0 in
    Size 6.5, 0.25 in
    Alignment Center
    Font > Size 14
    Text Customer Telephone List by Country
  7. Select the Detail section and in the Properties window, set the properties as follows.
    Property Name Property Value
    CanShrink True
    ColumnCount 2
  8. 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.

    TextBox1

    Property Name Property Value
    DataField CompanyName
    Location 0, 0 in
    Size 1.15, 0.2 in
    Font > Size 8pt

    TextBox2

    Property Name Property Value
    DataField ContactName
    Location 1.15, 0 in
    Size 1.15, 0.2 in
    Font > Size 8pt

    TextBox3

    Property Name Property Value
    DataField Phone
    Location 2.3, 0 in
    Size 0.95, 0.2 in
    Font > Size 8pt

To view the report

OR