How to quickly automatically generate and customize reports

Source: Internet
Author: User

In a variety of management information system applications, the need to produce a large number of reports, the usual practice is to be manually produced by programmers, low efficiency; In addition, users want to be able to generate a report of the results queried in the application to print. In order to solve the above two problems, this paper uses the dynamic generation technology to achieve the rapid automatic generation of reports, allowing users to manually modify the report, and encapsulate the implementation process into a class.

1. Design ideas

Programmers who have used C + + Builder or Delphi know that there is a Tdbgrid control that can display and manipulate the data records of a user's query in tabular form, and to make a report that can be printed, you need to use the Tquickrep control, which adds Tqrlabel, Tqrdbtext, Tqrshape, and other controls, setting their corresponding datasets, data fields, and so on, and then arranging their positions, displayed in tabular or other format for previewing and printing, is a tedious process. Sometimes, the user wants to be able to print out the data that the query displays in the Tdbgrid control, according to the previous practice, it is necessary for the programmer to design the report according to the Tdbgrid's display content manually. In this paper, the dynamic generation technology is used to read out the display information of Tdbgrid, to dynamically generate the corresponding Tqrlabel, Tqrdbtext, Tqrshape and other control in the Tquickrep control, and to set the headings and data of each field and the table partition bar. This is entirely feasible because all the controls in C + + Builder can be dynamically generated by the program, not just in the design phase. In addition, if the user of the resulting report table layout is not satisfied, this article provides the interface allows users to manually adjust the report, adjust the table height, width and other layouts, to achieve a certain degree of user-report customization.

Using the encapsulation features of C + +, the realization of automatic production and customization of the report is encapsulated into a new class Tgridprint, which provides the public interface that programmers care about, shields the internal information and concrete realization, embodies the object-oriented design idea, and brings convenience to the programmer. Programmers can also further expand functionality on its basis. The new class design reduces the programmer's workload and provides the user with the interface of customizing the report, which improves the quality of the report and the enthusiasm of the user to participate.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.