Series Review
From previousArticleStep by step teach you how to use agileeas. net basic library for application development-winform application-an instance module (commodity dictionary) I will lead you to the winform article, in addition, the example shows in detail how to manually bind the query and list of data table objects.
Arguments in this article
Today, based on the previous article, I will introduce another very important function of the information system, report and printing. The function to be implemented in this article is to query the product dictionary result (already displayed on the UI) print it out.
This article introduces the report Making Technology andProgramSpecifically, if you create a report definition based on an existing data object (data table object), and how to use the report printing and preview components in a program, use the query result (data table object) of the commodity dictionary as the data source for filling the report.
The following describes how to create a report:
Prepare reports
Run the report designer reportdesigner.start.exe and choose create> Object report from the File menu to open the "Create Data Object Report" dialog box:
Switch to the "Data Object" tab and click "Browse" to select the Assembly product. dal. sqlserver. DLL, and then select "product. dal. sqlserver. product, and then confirm to open the design interface:
It is a report automatically generated by the report designer based on the data entity. We need to modify the report. The modification is reasonable and nice-looking, and you can preview it:
This section describes a problem. Because a report is created based on a data table object and is not connected to a database, the Preview Data is randomly generated. Finally, we save the report definition to the file, for example, keep it as a "commodity dictionary. RDL ", so we have completed the report system.
Use reports
After the report is created, the next task is to use the report in the program. reference rdlengine In the UI. DLL, rdlviewer. DLL, EAS. report. dal. interface. DLL, EAS. report. controls. DLL files, and then we will compile the click event processing of the print button of the toolbar.Code:
1 Private Void Tsbprint_click ( Object Sender, eventargs E)
2 {
3 If ( This . Lvinfo. Items. Count = 0 )
4 {
5 MessageBox. Show ( " No data to print! " , " Prompt " , Messageboxbuttons. OK, messageboxicon. information );
6 Return ;
7 }
8
9 If ( This . Printform = Null )
10 This . Printform = New Rdlviewdialog ();
11
12 //
13 System. Io. textreader = Null ;
14 Try
15 {
16 String Filename = Path. Combine (application. startuppath, " Reports \ product dictionary. RDL " );
17 Textreader = New System. Io. streamreader (filename );
18 This . Printform. sourcerdl = Textreader. readtoend ();
19 }
20 Finally
21 {
22 If (Textreader ! = Null )
23 Textreader. Close ();
24 }
25
26 This . Printform. dataobject = This . Lvinfo. Tag;
27 This . Printform. printpreview ();
28 }
Compile and run the program to see the effect:
For the structure of the data table involved in this example, refer to the data table structure based on agileeas. NET platform basic library for application development-General description and data definition, for data object model definition files, documents, DDL scripts download: Workshop.
Link
Step by step teach you how to use the agileeas. net base class library for application development-series directory
Agileeas. NET platform development guide-series Directories
Introduction to agileeas. NET application development platform-Index
Agileeas. NET platform application development tutorial-case plan
Official website of agileeas. net
Agile Software Engineering Lab
QQ: 116773358