To create the Categories-Products master-detail report, do the  following.
1.       Start MS Visual Studio (2008 or 2010).
2.       Open the Windows Application with the data-aware  report, which was created in Lesson  2 of this tutorial.
3.       This report is already bound to the Categories  table from the Northwind database (nwind.mdb file located in the  directory where you installed DevExpress  demos). To create a master-detail report, you must add the Products  table to the nwindDataSet's schema. To do this, right-click nwindDataSet1  in the component tray, and choose the Edit in DataSet Designer... option  from the context menu.
4.       When the nwindDataSet.xsd designer is opened,  expand the Server Explorer pane, which shows all data connections that  are currently available in Visual Studio. For this, on the View menu,  choose the Server Explorer option or press Ctrl+Alt+S.
5.       In the list of available Data Connections,  locate the one that points to the nwind.mdb file, then select the Products  data table and drop it onto the designer. This will add the Products  table to nwindDataSet.
6.       When the Products table is added to the dataset  schema, the appropriate master-detail relationship between Categories  and Products table is automatically created by Visual Studio. To apply  these changes, click Save on the toolbar.
7.       Switch to the report designer and right-click the  report to invoke its context  menu. In this menu, choose the Insert Detail Report/CategoriesProducts  option to add a new detail  report. In this instance, the detail report's DataSource property is  set to nwindDataSet1; the DataAdapter property - productsTableAdapter;  the DataMember property - Categories.CategoriesProducts.
8.       Right-click the detail report and choose the Insert  Band/Group Header item in the context menu. This will add the GroupHeaderBand  to the detail report.
9.       To make the detail report look more professional, set  the GroupBand.RepeatEveryPage  property to true and the GroupHeaderBand.GroupUnion  property to WithFirstDetail. If these settings are applied, the Group  Header band will be repeated on every report page with its group, and its  position will be chosen in such a way that it will be always printed with at  least one Detail band below it.
Customize the Detail Report's  Layout 
10.  Add  two XRTable  controls to the Group Header and Detail bands of the detail  report. To do this, open the DX.12.1: Reporting toolbox tab and select XRTable.  Then, in the GroupHeader band's content area, click and hold down the  left mouse button while dragging the mouse cursor across the Detail  band.
Note that you can add cells to these tables, adjust  their size, and set the font of the text shown in the cells. For instance, set  the second table's XRControl.Borders  property value to Left, Right, Bottom to avoid double borders between  repeating table rows.
11.  Then,  bind the second table's cells to the required data fields,..
... and enter the column names into the first  table's cells to get the following layout.
The master-detail report is now ready. Switch to the Preview  tab and view the result.










 
No comments:
Post a Comment