Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the document directory of interactive reports in ActiveReports

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to analyze the document catalogue of interactive reports in ActiveReports, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Through the document directory, users can clearly view the report data structure, and can easily jump to the specified chapter, and finally export the report to PDF and other format files. Taking the 2012 monthly product sales classified summary report as an example, the following demonstrates how to implement the document catalog in the ActiveReports report control.

1. Create a report file

Create an ActiveReports report file named rptMonthlySalesByCategory.cs in the application, the ActiveReports area report (based on code).

2. Create a report data source

Click the icon to create the report data source. The data source we use is NWind_CHS.mdb under the Data directory in the source code project. In the open report data source dialog box, select the "provider" tab, click the establish connection button to open the "data Link Properties" dialog box, and select the "Microsoft Jet 4.0 OLE DB Provider" data provider. Click the "next" button to switch to the "connections" tab. Click "…" Click the button to locate the NWind_CHS.mdb file, and then click the OK button to complete the creation of the data source.

After returning to the "OLE DB" tab, enter the SQL statement in the query area:

SELECT

DATEPART ("yyyy", order. Order date)

AS

Order year, DATEPART ("m"), order. Order date)

AS

Order month, category. Category name, category. Description, product. Product name, order details. Quantity, order details. Unit price, order details. Discount

FROM

(order

INNERJOIN

Order details

ON

Order. Order ID = order details. Order ID)

INNERJOIN

Product

ON

Details of the order. Product ID = product. Product ID)

INNERJOIN

Category

ON

Product。 Category ID = category. Category ID

WHERE

DATEDIFF ("yyyy", order. Order date, '2012-01-01') = 0

ORDERBY

DATEPART ("yyyy", order. Order date), DATEPART ("m", order. Order date), category. Category ID, order details. Product ID

3. Design the report interface

3.1. Right-click in the report design interface and select insert-> Group header / Group tail. In this report, you need to insert a three-level grouping, and then set the following properties:

GroupHeader1DataField= ordering month

GroupKeepTogether=FirstDetail

RepeatStyle=OnPagegroupHeader2DataField= category name

GroupKeepTogether=FirstDetail

RepeatStyle=OnPagegroupHeader3DataField= product name

GroupKeepTogether=FirstDetail

RepeatStyle=OnPage

3.2. Add the following code to the report background code to set up the report directory:

Privatevoid groupHeader1_Format (object sender, EventArgs e) {this.groupHeader1.AddBookmark (txt ordering month 1.Text);}

Privatevoid groupHeader2_Format (object sender, EventArgs e) {this.groupHeader2.AddBookmark (txt ordering month 1.Text + "\\" + txt category 1.Text);}

After reading the above, have you mastered how to analyze the document directory of interactive reports in ActiveReports? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report