A , allows you to create a layout at design time on a single page tab and apply it to the entire report. Designing a layout in this format gives you the advantage of creating a layout that appears exactly the same at design time and run time. This walkthrough illustrates how to create a report that contains a single layout and preview it.
This walkthrough is split into the following activities:
- Adding an ActiveReport to a Visual Studio project
- Connecting to a the data source
- Adding a dataset
- Creating a layout
- Viewing the report
Note:
- This walkthrough uses the DVDStock table from the Reels database. By default, in ActiveReports, the Reels.mdb file is located at [User Documents folder]\GrapeCity Samples\ActiveReports 11\Samples\Data\Reels.mdb.
- Although this walkthrough uses Page reports, you can also implement this using RDL reports.
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
Notice that the run time report layout below is similar to the one you see at design time except for the data which you see at run time or when you preview the report.
Run-Time Layout
To add an ActiveReport to the Visual Studio project
- Create a new Visual Studio project.
- From the Project menu, select Add New Item.
- In the Add New Item dialog that appears, select ActiveReports 11 Page Report and in the Name field, rename the file as rptSingleLayout.
- Click the Add button to open a new fixed page 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
- In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
- In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ReportData.
- On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.
To add a dataset
- In the Report Explorer, right-click the data source node and select the Add Data Set option or select Data Set from the Add button.
- In the DataSet Dialog that appears, select the General page and enter the name of the dataset as DVDList. This name appears as a child node to the data source icon in the Report Explorer.
- On the Query page of this dialog, in the Query field enter the following SQL query.
SQL Query |
Copy Code
|
Select * from dvdstock
|
- Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.
- Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.
To create a layout for the report
- In the Visual Studio toolbox, go to the ActiveReports 11 Page Report tab and drag a TextBox control onto the design surface.
- Select the TextBox control and go to the Properties window to set the following properties.
Property Name |
Property Value |
Location |
0.25in, 0.5in |
BackgroundColor |
Khaki |
Color |
Maroon |
Font |
Normal, Arial, 16pt, Bold |
Size |
6in, 0.5in |
TextAlign |
Center |
Value |
DVD STOCK |
- From the Visual Studio toolbox, drag a Table data region and place it on the design surface.
- Select the Table and go to the Properties window to set the following properties.
Property Name |
Property Value |
Location |
0.25in, 1in |
BackgroundColor |
Khaki |
|
6in, 7.5in |
RepeatHeaderOnNewPage |
True |
Size |
6in, 0.75in |
- In the Table data region, place your mouse over the cells of the row to display the .
-
Click the adorner to show a list of available fields from the DataSet and add the following fields to the cells of the table details row.
Cell |
Field |
Left Cell |
Title |
Middle Cell |
InStock |
Right Cell |
StorePrice |
This automatically places an expression in the details row and simultaneously places a static label in the header row of the same column.
Tip: You can also directly drag fields from the
Report Explorer onto the textbox cells of the Table data region.
- Select the columns of the Table and set their Width property as follows:
Cell |
Field |
Left Cell |
2.5in |
Middle Cell |
1.75in |
Right Cell |
1.75in |
- Select the following table rows and go to the Properties window to set their following properties.
Row |
Properties |
Table Header |
BorderStyle: Solid
Color: Maroon
Font: Normal, Arial, 12pt, Bold
TextAlign: Left |
Table Details |
BorderStyle: Solid
Font: Normal, Arial, 10pt, Bold
TextAlign: Left |
To view the report
- Click the to view the report at design time.
OR
See Also