ActiveReports Report Control official Chinese Introductory Tutorial (3)-How to select page reports and regional reports

Source: Internet
Author: User

Original: ActiveReports Report control official Chinese Introductory Tutorial (3)-How to select page reports and regional reports

This article describes common usage scenarios for regional and page reports, some suggestions for distinguishing and selecting report types, the template design for both reports, the data source (design-time and run-time) settings, and the differences between browsing reports.

ActiveReports Report Control official Chinese Introductory tutorial (1)-Installation, activation, and product resources

ActiveReports Report Control official Chinese Introductory Tutorial (2)-Create, data source, browse, and publish

This article includes the following sections:

1. Differences between a regional report and a page report

    • Specific scenarios for both reports
    • Differences between a regional report and a page report
    • How to select a report type in a project
      2. Regional reports and page report data source settings
  • Run-time
  • Design Time
    3. Differences in report browser loading reports
1. Differences between regional reports and page reports 1.1 first, let's take a look at the specific scenarios for both reports
  • Fixed page Layout report: One of the first in ActiveReports. NET report model, the Run-Time report page is fully consistent with the design time, and the location and size of the controls are not changed, making it ideal for creating traditional paper report formats such as financial documents, bank bills, and other forms that require rigorous reporting.
  • Continuous page layout report: Mainly through the data region to control the layout of the report, can automatically achieve the data paging display, and provide the most powerful report interactivity ability, can easily achieve a variety of interactive reports. The control of the report page can be enlarged or reduced, the data filter is implemented by the parameter report, the interactive sorting can be set up, the drill-through report is hidden, the details are concealed in the initial state, the button is clicked, you can also add a drillthrough link to another report, and a bookmark link to other areas in the report.
  • Area Layout Report: A typical report model for ActiveReports products, where reports are divided into different areas. By default, the area layout report contains the header, detail, and footer areas, which can be further inserted into the report Header/report footer and the group header/Group footer area. This layout is also widely used in access and Crystal Reports. You can use the knowledge of C # and VB.net already mastered, and combine the rich API provided by the regional layout report model to realize the various report systems such as subreport, cross-report, group report, column report, master-slave report and so on.
  • 1.2 Differences between a regional report and a page report

    The main difference between a regional report and a page report is the composition structure, which, by definition, consists of multiple regions, and the regional report is eventually composed of multiple regions, including the header, detail area, and footer.

    Page report final rendering layout only one unit is-page, page report final rendering effect is a combination of multiple pages, further said, the final page layout of continuous pages depends on the amount of data to be displayed. Fixed page report The main emphasis is the preview effect and the print effect is exactly the same. Ideal for creating traditional paper report formats such as financial documents, bank bills, and other forms that require rigorous reporting.

    1.3 How to select a report type in a project

    about how to choose the report in the actual project, often the subjective factor has a greater impact, each developer's focus on different angles will affect the choice of results. For example, some programmers would be more inclined to split the report into three parts of a regular header, data area, and footer, so that he would consider the regional report to be more responsive to the project's needs and select a regional report. There are other programmers who need to base all of the report pages on a single report template, and they will choose a continuous page report. For example, a continuous page report is a good choice if you need to use multiple data sources.

    If you need interactive report analysis (down and through drill, Dynamic Data sorting) in your report, the requirements for sparklines, data bars, map controls, and multiple data sources need to be implemented using a page report.

    Of course, ActiveReports provides a wide range of resources such as product documentation, random installation examples, and online samples to provide you with a lot of guidance on choosing the right report type, to help you select the correct report template and save development time.

    2. Regional reports and page report data Source Settings 2.1 page report design the data source steps are as follows:
      • First step: Create a page report named PAGEREPORT_DATASOURCE_DESIGNTIME.RDLX in the project

    Second step: after creation, the report design interface is automatically opened, and we see a fixed page report (FPL), which is displayed through the " reports " in the Visual Studio menu bar Convert to Continuous page layout (CPL) Report convert report to CPL report.

    Open ActiveReports Report Explorer from Report Explorer V8, view , Other Windows , in the Visual Studio menu bar, and you can now see the Data sources node, right-click the Add Data source menu item on the node, and follow the wizard steps in the pop-up report Data Source dialog box to connect to an Access database, such as:

    Click " OK " button to complete the data source creation operation, at this time, in the Report Explorer window, under the data sources node, a new child node named "DataSource1", click the right mouse button on the node, select " Add DataSet menu item, write the following SQL query statement in the Query tab of the Pop-up dialog [Select * from Product], and then click the OK button to complete the dataset creation operation. After returning to the Report Resource Management window, click the "DataSet1" node and you can see that the SQL query statement returns all data fields for the query results.

    Step Three: in the Visual Studio Toolbox, under theactivereports 8 page layout report category, drag the Table control (table) to the report Design screen and click the table detail row , all fields in the dataset in DataSet1 are automatically displayed, and then the fields that need to be bound are specified for each cell.

    more To set the report data source content at design time, please refer to:

    Http://blog.gcpowertools.com.cn/post/2014/08/01/ActiveReports_DataSource_DesignTime.aspx

    2.1 page report runtime setting the data source key code is as follows:
    private void Runtime Data source page report Toolstripmenuitem_click (object sender, EventArgs e)
        {
            GrapeCity.ActiveReports.PageReport pReport1 = new GrapeCity.ActiveReports.PageReport (New System.IO.FileInfo (" PAGEREPORT_DATASOURCE_RUNTIME.RDLX "));
            Viewer1. Loaddocument (preport1.document);            
        }
        private void Form1_Load (object sender, EventArgs e)
        {
            Viewer1. Locatedatasource + = new GrapeCity.ActiveReports.LocateDataSourceEventHandler (Viewer1_locatedatasource);
        }
        void Viewer1_locatedatasource (object sender, GrapeCity.ActiveReports.LocateDataSourceEventArgs args)
        {
            if (args. DataSourceName = = "DataSource1")
            {
                if (args. DatasetName = = "DataSet1")
                {
                    Args. Data = Getdatasource ();
                }
            }
        }
        Private DataTable Getdatasource ()
        {
            DataTable dt = new DataTable ();
            Dt. Columns.Add ("Product number");
            Dt. Columns.Add ("Product name");
            Dt. Columns.Add ("Unit Price");
            Dt. Columns.Add ("Stock Amount");
            Dt. Rows.Add ("A10002", "Apple", 20, 50);
            Dt. Rows.Add ("A15681", "banana", 20, 50);
            Dt. Rows.Add ("A15681", "pineapple", 20, 50);
            return DT;
        }

    For more information on setting report data sources at run time, please refer to:

    Http://blog.gcpowertools.com.cn/post/2014/08/01/ActiveReports_DataSource_RunTime.aspx

    3. Differences in report browser loading reports

    Page reports and area reports differ in how they are browsed, and this section takes Webviewer as an example to see the difference between the Load page report and the regional report:

    GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport ();
    Rpt. Load (New System.IO.FileInfo (Server.MapPath (") +" \\INVOICE.RDLX "));
    Webviewer1.report = rpt;

    Webviewer loading a code-based regional report:

    Secionreport rpt = new Secionreport ();

    Webviewer loading XML-based regional reports:

    Sectionreport sr = new Sectionreport ();
    Sr. Loadlayout (Server.MapPath ("") + "\\Invoice.RPX);
    Webviewer1.report = SR;

    For more detailed information on WinForms, WPF, Silverlight, and more, please refer to the Help documentation section: http://www.gcpowertools.com.cn/docs/activereports/ar8guide/#! Documents/_28.htm

    The above is the full content of the ActiveReports report control Getting Started tutorial, these three articles are the only things you need to know to use the ActiveReports report control, and hopefully, by reading this series of articles, you will have a general understanding of the use of ActiveReports report controls, Successfully completed the actual development of the work.

    If you have any questions about using the product, you can log in to the official product technology community and experienced technical engineers, activereports developers to Exchange: Click to Exchange

    Learn more about the ActiveReports product features:

    Http://www.gcpowertools.com.cn/products/activereports_overview.htm

    Download product Experience Product Features:

    Http://www.gcpowertools.com.cn/products/download.aspx?pid=16

    ActiveReports Report Control official Chinese Introductory Tutorial (3)-How to select page reports and regional reports

    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.