Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Wrox Professional Crystal Reports for Visual Studio NET Second Edition phần 4 pdf
MIỄN PHÍ
Số trang
38
Kích thước
1.8 MB
Định dạng
PDF
Lượt xem
1153

Wrox Professional Crystal Reports for Visual Studio NET Second Edition phần 4 pdf

Nội dung xem thử

Mô tả chi tiết

03 557300 Ch03.qxd 3/24/04 9:40 AM Page 92

Chapter 3

When you click OK to exit the Chart Expert, your Chart will be added to your Report Header. When you

see the report in the designer, a pie chart should now be displayed in the Report Header. This isn’t an

accurate drawing of your graph. In fact it is nothing like your graph; it is just a placeholder to show

where in the report the graph will be positioned. If you preview the graph in a Windows form, it will

look something like Figure 3-34.

Another option to increase readability would be to make the chart larger. The chart object inserted into

your report is just like any other object in that it can be resized to fit your needs; you could even resize

the graph to take up the entire first page if that suits the needs of the report.

If you have a graph or chart inserted into your report, you can control the content by right-clicking

directly on top of the chart and selecting an option from the menu. The Chart Expert can be used to alter

the graph in the way that we have described so far in this section. You may have noticed that the Chart

Expert includes an option on the first tab labeled “Automatically set chart options.” If you uncheck this

box, two more tabs will appear, allowing you to control other aspects of the report, including the format￾ting for the graph axes and the general settings (like color, marker size, and so on).

Under Format Chart are the Template, General, and Titles options, which also allow you to customize

the appearance of your chart. The options in all of these menus are context sensitive; for example, you

can perform different types of formatting to a pie chart than you can to a bar chart. These options are all

relatively simple, so we’ll leave it to you to explore the almost endless possibilities.

Figure 3-34

92

03 557300 Ch03.qxd 3/24/04 9:40 AM Page 93

Designing Reports

Unfortunately, if you have used the retail version of Crystal Reports before, you will probably be won￾dering what happened to the Chart Analyzer, which allows you to open the graph in another tabbed

window. Crystal Reports .NET does not include the full capabilities of the Chart Analyzer, so if you

really need to use some of the advanced formatting features for charts and graphs, you are going to

have to buy a retail copy of Crystal Reports.

Working with Subreports

Within Crystal Reports .NET, multiple subreports can be combined into one main report, which allows

you to create information-rich reports from multiple sources and display this information side by side.

Both linked and unlinked subreports are available in the code download, found in the solution:

C:\CrystalReports\Chapter02\Demo\Chapter2.sln. Open and run this solution from Visual

Studio .NET and choose the report from the drop-down box at the top right of the window.

To run the unlinked report, you will need access to the Northwind sample database.

Subreports come in two varieties — unlinked and linked. Unlinked subreports allow you to insert subreports

that are totally unrelated to the main report content. In Figure 3-35, a sales graph has been inserted into an

employee listing report (included in the sample files as employee_listing_unlinked.rpt). Both of

these reports were developed independently and are from different tables and a different data source.

Figure 3-35

93

03 557300 Ch03.qxd 3/24/04 9:40 AM Page 94

Chapter 3

The second type of report is the linked subreport. Linked subreports allow the passing of parameters and

variables between the main report and the subreport, which can be used to filter the subreport content.

The report shown in Figure 3-36 has a main report that is the same employee listing report, only this

time a linked subreport has been inserted showing a commission amount for each employee (included in

the sample files as employee_listing_linked.rpt). The commission report is a separate report, but it

is inserted into the details section and linked on the employee ID field.

Figure 3-36

For each employee, the subreport is run again, and the employee ID is used in record selection on the

subreport. When the page is printed, each instance of the subreport is printed next to the corresponding

employee, with only their details shown.

Inserting Subreports

To insert a subreport into your report, right-click a blank area of the report, and select Insert →

Subreport from the right-click menu, which will open the dialog shown in Figure 3-37.

You have three options for adding a new subreport: First, if the report you want to add is a report that

exists in your current project, you can use the drop-down list at the top of the dialog to select the report.

94

Tải ngay đi em, còn do dự, trời tối mất!