The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Create a Report with Cross-Band Content and Populated Empty Space

  • 5 min to read

This tutorial describes how to create an invoice report with the following layout options:

  • Print part of the content across bands (the blue panel);
  • Populate the empty space between the detail and footer information with blank rows.
Tip

The report created below is based on the Cross-Band Content Demo.
See the Cross-Band Content Demo in the Demo Center if you have DevExpress Reporting installation.

preview-6

Bind to Data

  1. Add a new blank report to your application.

  2. Bind the report to the OrderDetailsExtended view from the sample Northwind SQLite database that is shipped with the XtraReports installation. The database file is available at C:\Users\Public\Documents\DevExpress Demos 19.2\Components\Data\nwind.db. Join the following tables/views:

    • The OrderDetailsExtended view to the Orders table by the OrderID field;
    • The Orders table to the Customers table by the CustomerID field.
  3. Set the report's DataMember to OrderDetailsExtended.

    set-data-member

Add a Data Table

  1. Expand the OrderDetailsExtended query in the Field List and select the ProductName, UnitPrice, Quantity, and ExtendedPrice fields. Hold CTRL or SHIFT and click the fields to select multiple fields and drop them onto the Detail band.

    drop-fields

    This creates an XRTable with each cell bound to a data field.

  2. Add line numbers. Right-click the ProductName cell and select Insert / Column to Left from the context menu.

    add-cell

  3. Select the new cell and specify the following property values:

    • Summary: Report
    • Expression: sumRecordNumber([ProductName])

    add-line-numbers

  4. Format the currency data. Click the UnitPrice cell's smart tag and set Format String to {0:$0.00}. Set the ExtendedPrice cell's format string to the same value.

    format-cells

The resulting report lists all items from all invoices.

preview-1

Group Data

Group table data by Order ID to produce invoices.

  1. Right-click the design surface. Select Insert Band / GroupHeader from the context menu.

    add-group-header

  2. Click the GroupFields property's ellipsis button in the GroupHeader's smart tag to invoke the Group Field Collection Editor.

    invoke-group-editor

  3. Click the Add button to add a group field. Expand the FieldName property's drop down and select OrderID from the list.

    create-group-field

  4. Correct the line numbers, as the records are now arranged in groups. Select the cell that displays line numbers and change the Summary property to Group.

    change-line-numbers

The GroupHeader band is printed for each group. Use it to add a heading that includes column titles, an invoice ID and date.

  1. Switch to the Field List and select the fields for which you want to create column titles. Drag the selected fields onto the GroupHeader band with the right mouse button.

    drop-titles

  2. Switch to the Field List, select the OrderID field and drop it onto the band. Do the same with the OrderDate field.

    identify-invoice

  3. Add captions to the Order ID and OrderDate fields:

    • Click the OrderID label's smart tag and set its Format String property to Order ID: {0}.

    • Click the OrderDate label's smart tag and set its Format String to Order Date: {0:dddd, MMMM d, yyyy}.

    adjust-label-text

The records are now grouped by orders.

preview-2

Add Totals

Add a footer to display totals and other summary data on invoices.

  1. Right-click the design surface. Select Insert Band / GroupFooter from the context menu.

    add-group-footer

  2. Drop an XRTable from the Toolbox. Configure the table's cells to display the following totals:

    Caption

    Format String

    Summary

    Expression

    Sub Total:

    {0:$0.00}

    Group

    sumSum([Quantity] * [UnitPrice])

    Discount:

    {0:$0.00}

    Group

    sumSum([UnitPrice] * [Discount] * [Quantity])

    Grand Total:

    {0:$0.00}

    Group

    sumSum([ExtendedPrice])

    format-totals

  3. Align the invoice totals at the page bottom. Click the GroupFooter's smart tag and check the PrintAtBottom property.

    align-footer

Each invoice is now printed on a separate page.

preview-3

Populate the Empty Space

Add empty lines to invoices to populate the empty space between the Detail band's data and the totals.

Click the Detail band's smart tag and check the FillEmptySpace property.

fill-empty-space

Each invoice now includes the numbered lines that continue until the totals.

preview-4

Add Cross-Band Data

Add a panel with recipient details across the entire invoice. Place the panel on a separate GroupHeader band that is printed on the background of other bands.

  1. Add another GroupHeader band to the top of the report. Click the added band's smart tag and set the PrintAcrossBands property. This makes the band content start at the top of the GroupHeader1 and end at the bottom of the GroupFooter1 band.

    printundernextband

    Tip

    Choose PageHeaderBand instead of the GroupHeader band to limit the cross-band content to a page, even if the GroupFooter is on the next page.

  2. As the new GroupHeader band is above the invoice header, it is not grouped by orders. To include it in the grouping, remove the OrderID group field from the GroupHeader1 band, and add it to GroupHeader2.

  3. Add an XRPanel control to the GroupHeader. Specify the panel's BackColor property and drop fields onto the panel.

    add-recipient

  4. Adjust the panel's width and height. The height should match the page height, as the GroupFooter is printed at the bottom of the page.

    adjust-crossband-height

  5. Switch to Print Preview. The panel is printed on the background of the group content.

    preview-5

  6. Adjust the content in other bands to print it side-by-side with the panel.

    adjust-width

See the final report in Print Preview.

preview-6