Dev Report Basics Tutorial (ii)

Source: Internet
Author: User


Well, recently the customer needs change, the number of document details to more than one page. Cause now the document does not meet the demand (PS: This is not reference to the consequences of the previous product), fortunately, I remembered how to change, now write, save the forgotten.

Previous document style (only single page, also write code to fill blank lines ...) )

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/57/10/wKiom1SQIbeR7wb5AAKm10khF7w347.jpg "title=" image 1. PNG "alt=" wkiom1sqiber7wb5aakm10khf7w347.jpg "/>

Note: The ReportHeader and reportfooter in the red box will only appear once in a single document, and reportfooter back to detail

Then, if it's more than the set height per page, that's it.

First page

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/10/wKiom1SQIcqh_cO9AAIBlPXivG8809.jpg "style=" float: none; "title=" Image 2.png "alt=" Wkiom1sqicqh_co9aaiblpxivg8809.jpg "/>

Second page

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/10/wKiom1SQIcriQ3VgAAIXqQemcM4799.jpg "title=" Image 4. PNG "alt=" wkiom1sqicriq3vgaaixqqemcm4799.jpg "style=" float:none; "/>

Third page

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/0D/wKioL1SQImrhq2hAAAE8zCB-jKM639.jpg "title=" Image 3. PNG "alt=" wkiol1sqimrhq2haaae8zcb-jkm639.jpg "/>





It can't be used at all.

So the transformation begins.

Note: If you want to customize the paper size, remember to select the PaperKind value of the report as custom, then PageHeight and PageWidth can be modified, the unit is pixels.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/10/wKiom1SQIhzS58xJAAAzUQIJilw039.jpg "title=" image 6. PNG "alt=" wkiom1sqihzs58xjaaazuqijilw039.jpg "/>

First, click on the top left corner to add Datasourse

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/10/wKiom1SQIhLBO0qOAAE1TU3mnNo529.jpg "title=" image 11. PNG "alt=" wkiom1sqihlbo0qoaae1tu3mnno529.jpg "/>

To add a specified report detail to the design page

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/57/0D/wKioL1SQIvzBi9jBAAEIiVS8aSg092.jpg "title=" Image 9. PNG "alt=" wkiol1sqivzbi9jbaaeiivs8asg092.jpg "/>


Add a table and bind the detail data that you want to display (note that you want to bind the Schedule field under the main table)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/10/wKiom1SQIr3hkinUAAJrMKPBkPI178.jpg "title=" image 13. PNG "alt=" wkiom1sqir3hkinuaajrmkpbkpi178.jpg "/>

pull out a blank area at the top and bottom 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/57/0D/ Wkiol1sqitgivcn3aaizv3wffbo553.jpg "title=" image 12.png "alt=" Wkiol1sqitgivcn3aaizv3wffbo553.jpg "/>


Note: The bottom is the independent white space, and the detail does not have any relation, the red single arrow is the dividing line

Then add lable above and below and bind the data you want to display

(so you don't need to empty the line with code, and the header and footer are fixed on each page)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/10/wKiom1SQIm_DySD0AAI4VYYO7JA065.jpg "title=" image 14. PNG "alt=" wkiom1sqim_dysd0aai4vyyo7ja065.jpg "/>

Note: The Xrpageinfo Runningband in the upper right corner is set to Detailreport

This page will be the denominator of the number of pages that the main table records

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/0D/wKioL1SQIxzRKiHvAAEygtO-qlU841.jpg "title=" image 15. PNG "alt=" wkiol1sqixzrkihvaaeygto-qlu841.jpg "/>

Add the following code in the background of the report

 public xtrareport1 ()        {            initializecomponent ();            //all Clear             This.dataSetForReport1.Clear ();            // Binding mastertable           databindmaster ();            //binding databindclidren            databindclidren ();       }          #region  databindmaster       private  void databindmaster ()        {            //emptying mastertable  &Nbsp;        this.datasetforreport1.mastertable.clear ();             datatable dt = new datatable () ;            dt. Columns.Add ("ID");             dt. Columns.Add ("Name");            dt. Columns.Add ("Password");             //loop Add Data             for  (int i = 0; i  < 5; i++)            {                 datarow dr = dt. NewRow ();                 dr["ID"] = i;                 dr["Name"] = i.tostring ();                 dr["Password"] = "YDNZ14111200810";                 dt. Rows.Add (DR);           }             //Mapping Data Sources             this.datasetforreport1.mastertable.merge (DT);       }         #endregion          #region   Databindclidren       private void databindclidren ()         {           //emptying databindclidren            this.datasetforreport1.clidrentable.clear ();             datatable dt = new datatable ();            dt. Columns.Add ("ID");            dt. Columns.Add ("Clidrenid");            dt. Columns.Add ("Comment");             //loop Add Data             for  (int i = 0; i  < 5; i++)            {                 for  (int j =  0; j < 55;  j + +)                 {                      datarow dr = dt. NewRow ();                     dr["ID"] = i;                     dr["Clidrenid"] =j.tostring ();                     dr ["Comment"] = "comment "  + j.tostring ();                     dt. Rows.Add (DR);                 }            }             //Mapping Data Sources             This.dataSetForReport1.ClidrenTable.Merge (DT);        }         #endregion

And then run it.


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/0D/wKioL1SQI5qTvK07AAH9i9Rq2bQ874.jpg "style=" float: none; "title=" Image 17.png "alt=" Wkiol1sqi5qtvk07aah9i9rq2bq874.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/10/wKiom1SQIvqRLf3lAAEvrPbtPlw210.jpg "style=" float: none; "title=" Image 18.png "alt=" Wkiom1sqivqrlf3laaevrpbtplw210.jpg "/>


Total 5 Main Table records, 275 detail records,

Display up to 13 details per page, total 25 pages


This article is from the "270 plus 40" blog, be sure to keep this source http://270jia40.blog.51cto.com/9149400/1590819

Dev Report Basics Tutorial (ii)

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.