|
Tip: To easily select a control within the report, in the Report Explorer, expand the section node and select the control. The control is highlighted in the Report Explorer and on the report design surface. |
This sample includes a ViewerForm with three tabs and three Viewer controls to highlight several new report features, and an Invoice report. Run the project to display the report in the viewer, and click the tabs to see the new features.
ViewerForm
The ViewerForm has three tabs, each with an ActiveReports Viewer control on it. Right-click the form and select View Code to see the code used to change the Invoice report's section properties at run time.
Select one of the Viewer controls and in the Properties window, expand the Toolbar property to see where the Visible property is set to False.
Invoice
The Invoice report demonstrates the usage of the following features:
PageHeader Section
- The Shape control provides a border around the Order ID and Order Date fields and labels.
- The OrderDate TextBox control has the OutputFormat property set to d to display a short date.
- The Label controls use the BackColor, ForeColor, and Font properties to add a distinctive style to the report.
GroupHeader Section
- The new CrossSectionBox control is hosted in the GroupHeader section, and spans the Detail section to end in the GroupFooter section, forming a rectangle around the details of the invoice at run time.
- Three of the new CrossSectionLine controls are hosted in the GroupHeader section, and span the Detail section to end in the GroupFooter section, forming vertical lines between columns of invoice details at run time.
|
Note: If you try to drop a cross-section control into a section other than a header or footer, the mouse pointer changes to Unavailable, and you cannot drop the control. |
- Two of the TextBox controls use a CalculatedField in the DataField property.
|
Tip: In the Report Explorer, expand the Fields node, then Calculated to see all of the calculated fields.
Select BillingAddress or ShippingAddress to take a closer look at the Formula used in the Properties window. |
- The Line control is used below the column header labels to draw a horizontal line across the width of the report. (It is not visible at design time unless you make the Height of the GroupHeader section larger.)
- The DataField property of the section is set to the OrderID field, so that the section (followed by related details and GroupFooter) prints once per order.
Detail Section
- Click the Detail RepeatToFill tab to see the Detail section with the new RepeatToFill property set to True. This ensures that the formatting (alternating purple and white rows and CrossSection controls) fills space as needed to push the GroupFooter section to the bottom of the page, just above the PageFooter section.
- Four TextBox controls display each row of data associated with the current GroupHeader OrderID.
- The OutputFormat property of the UnitPrice and Total fields is set to C to display currency.
- The Line control is used below the text boxes to draw horizontal lines across the width of the report under each row of data. (It is not visible at design time unless you make the Height of the Detail section larger.)
- Right-click the report and select View Code to see the code used in the Detail Format event to create a green bar (or in this case, purple bar) report by alternating the BackColor property of the section.
- Click the Data Source icon on the Detail band to review the Connection String and SQL Query used in the report.
GroupFooter Section
- Select the GroupFooter PrintAtBottom tab to see the GroupFooter section with the new PrintAtBottom property set to True. This pulls the GroupFooter section to the bottom of the page, just above the PageFooter section. Run the project and click the PrintAtBottom tab to see this feature in action.
- This section also has the NewPage property set to After so that a new page is printed for each OrderID (the associated GroupHeader's DataField).
- The Subtotal text box uses the following properties:
-
- The DataField property uses a CalculatedField.
- The SummaryFunc property is set to Sum, to add the values of the field in the detail section.
- The SummaryGroup property is set to the name of the GroupHeader, to reset the summary value each time the GroupHeader section runs.
- The SummaryRunning property is set to Group so that the value accumulates for the group rather than for the entire report or not at all.
- The SummaryType property is set to GrandTotal.
- Right-click the report and select View Code to see the code used in the GroupFooter Format event to calculate the value for the Grand Total text box, and to format it as currency.
PageFooter Section
- The ReportInfo control uses a FormatString property value of Page {PageNumber} of {PageCount}, one of the preset values you can use for quick page numbering.
Design Time
See Also